diff --git a/lib/releasy/builders/osx_app.rb b/lib/releasy/builders/osx_app.rb index ac0853c..0592a3a 100644 --- a/lib/releasy/builders/osx_app.rb +++ b/lib/releasy/builders/osx_app.rb @@ -29,7 +29,7 @@ class OsxApp < Builder DEFAULT_FOLDER_SUFFIX = "OSX" # Binary gems included in app. - BINARY_GEMS = %w[gosu texplay chipmunk] + BINARY_GEMS = %w[gosu texplay chipmunk bundler] # Icon type used in the app. ICON_EXTENSION = ".icns" # Source gems included in app that we should remove. diff --git a/lib/releasy/mixins/register.rb b/lib/releasy/mixins/register.rb index 1974d40..79df308 100644 --- a/lib/releasy/mixins/register.rb +++ b/lib/releasy/mixins/register.rb @@ -10,12 +10,12 @@ module Mixins # end # # class Frogs::BlueFrog - # TYPE = :blue # Type must be defined before registering. + # TYPE = :blue unless const_defined?(:TYPE) # Type must be defined before registering. # Frogs.register self # end # # class Frogs::RedFrog - # TYPE = :red # Type must be defined before registering. + # TYPE = :red unless const_defined?(:TYPE) # Type must be defined before registering. # Frogs.register self # end # diff --git a/lib/releasy/mixins/utilities.rb b/lib/releasy/mixins/utilities.rb index 24ce7a4..034f035 100644 --- a/lib/releasy/mixins/utilities.rb +++ b/lib/releasy/mixins/utilities.rb @@ -47,13 +47,14 @@ def command_available?(command) find = Releasy.win_platform? ? "where" : "which" # Call this Kernel version of `` so it can be mocked in testing. result = Kernel.`("#{find} #{command}") - return false unless $? == 0 - result + kernel_result == 0 && result != "" end protected def null_file; Releasy.win_platform? ? "NUL" : "/dev/null"; end + private + def kernel_result; $?; end end end end diff --git a/test/releasy/builders/helpers/builder_helper.rb b/test/releasy/builders/helpers/builder_helper.rb index afad54c..193aa2b 100644 --- a/test/releasy/builders/helpers/builder_helper.rb +++ b/test/releasy/builders/helpers/builder_helper.rb @@ -4,9 +4,9 @@ def acts_like_a_builder context Releasy::Builders::Builder do asserts_topic.kind_of Releasy::Builders::Builder - asserts_topic.respond_to :setup - asserts_topic.respond_to :task_group - asserts_topic.respond_to :folder + asserts('#setup') { topic.respond_to?(:setup, true) }.equals true + asserts('#task_group') { topic.respond_to?(:task_group, true) }.equals true + asserts('#folder') { topic.respond_to?(:folder, true) }.equals true asserts(:type).equals { topic.class::TYPE } asserts(:suffix).equals { topic.class::DEFAULT_FOLDER_SUFFIX } diff --git a/test/releasy/deployers/local_test.rb b/test/releasy/deployers/local_test.rb index 903accd..3020246 100644 --- a/test/releasy/deployers/local_test.rb +++ b/test/releasy/deployers/local_test.rb @@ -46,7 +46,7 @@ stub(File).exists?("fish/file.zip").returns false mock(topic).mkdir_p("fish", :verbose => false) - mock(topic).cp("file.zip", "fish", :verbose => false, :force => false) + mock(topic).cp("file.zip", "fish", :verbose => false) topic.send :deploy, "file.zip" true @@ -56,19 +56,19 @@ stub(File).exists?("fish").returns true stub(File).exists?("fish/file.zip").returns false - mock(topic).cp("file.zip", "fish", :verbose => false, :force => false) + mock(topic).cp("file.zip", "fish", :verbose => false) topic.send :deploy, "file.zip" true end - should "copy file forcefully if destination file is older" do + should "copy file if destination file is older" do stub(File).exists?("fish").returns true stub(File).exists?("fish/file.zip").returns true stub(File).ctime("fish/file.zip").returns 0 stub(File).ctime("file.zip").returns 1 - mock(topic).cp("file.zip", "fish", :verbose => false, :force => true) + mock(topic).cp("file.zip", "fish", :verbose => false) topic.send :deploy, "file.zip" true diff --git a/test/releasy/mixins/log_test.rb b/test/releasy/mixins/log_test.rb index 7b01b2a..e6f7260 100644 --- a/test/releasy/mixins/log_test.rb +++ b/test/releasy/mixins/log_test.rb @@ -8,8 +8,8 @@ context "included" do setup { Object.new.extend topic } - asserts_topic.respond_to :heading - asserts_topic.respond_to :info - asserts_topic.respond_to :warn + asserts('#heading') { topic.respond_to?(:heading, true) }.equals true + asserts('#info') { topic.respond_to?(:info, true) }.equals true + asserts('#warn') { topic.respond_to?(:warn, true) }.equals true end end \ No newline at end of file diff --git a/test/releasy/mixins/utilities_test.rb b/test/releasy/mixins/utilities_test.rb index 55d0d95..d388c03 100644 --- a/test/releasy/mixins/utilities_test.rb +++ b/test/releasy/mixins/utilities_test.rb @@ -23,12 +23,14 @@ should "return true if available" do stub(Releasy).win_platform?.returns true mock(Kernel, :`).with("where command").returns "/frog/command" + mock(topic).kernel_result.returns 0 topic.send(:command_available?, "command") end.equals true should "return false if not available" do stub(Releasy).win_platform?.returns true mock(Kernel, :`).with("where command").returns "" + mock(topic).kernel_result.returns 1 topic.send(:command_available?, "command") end.equals false end @@ -37,12 +39,14 @@ should "return true if available" do stub(Releasy).win_platform?.returns false mock(Kernel, :`).with("which command").returns "/frog/command" + mock(topic).kernel_result.returns 0 topic.send(:command_available?, "command") end.equals true should "return false if not available" do stub(Releasy).win_platform?.returns false mock(Kernel, :`).with("which command").returns "" + mock(topic).kernel_result.returns 256 topic.send(:command_available?, "command") end.equals false end diff --git a/test/releasy/packagers/packager_test.rb b/test/releasy/packagers/packager_test.rb index f625aec..1da8f2d 100644 --- a/test/releasy/packagers/packager_test.rb +++ b/test/releasy/packagers/packager_test.rb @@ -19,11 +19,12 @@ asserts(:extension=, "frog").raises ArgumentError, /extension must be valid/ asserts(:package, "fish").equals "fish.bleh" - asserts_topic.respond_to :checksum - asserts_topic.respond_to :generate_tasks - asserts_topic.respond_to :archive + asserts('#checksum') { topic.respond_to?(:checksum, true) }.equals true + asserts('#generate_tasks') { topic.respond_to?(:generate_tasks, true) }.equals true + asserts('#archive') { topic.respond_to?(:archive, true) }.equals true - context "#seven_zip_command" do context "on Windows" do + context "#seven_zip_command" do + context "on Windows" do context "7za command available" do asserts :seven_zip_command do stub(Releasy).win_platform?.returns true diff --git a/test/releasy/project_test.rb b/test/releasy/project_test.rb index 9c05cb5..8f8af0f 100644 --- a/test/releasy/project_test.rb +++ b/test/releasy/project_test.rb @@ -275,7 +275,7 @@ [ :Task, "build:windows", %w[build:windows:installer] ], [ :Task, "build:windows:installer", ["#{folder_base}_WIN32_INSTALLER"] ], - [ :FileTask, 'pkg', [] ], + # [ :FileTask, 'pkg', [] ], [ :FileTask, "#{folder_base}_SOURCE", source_files ], [ :FileTask, "#{folder_base}_SOURCE.7z", ["#{folder_base}_SOURCE"] ], diff --git a/test/teststrap.rb b/test/teststrap.rb index d356a04..6cd0dbf 100644 --- a/test/teststrap.rb +++ b/test/teststrap.rb @@ -43,7 +43,7 @@ def same_contents?(file1, file2) end $original_path = Dir.pwd -def output_path; "../test_output"; end +def output_path; File.expand_path("./test_output"); end Releasy::Mixins::Log.log_level = :silent