kumade 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. data/README.md +9 -1
  2. data/features/kumade_executable.feature +11 -12
  3. data/features/kumade_without_jammit.feature +2 -2
  4. data/kumade.gemspec +1 -0
  5. data/lib/kumade.rb +7 -1
  6. data/lib/kumade/cli.rb +4 -4
  7. data/lib/kumade/command_line.rb +33 -0
  8. data/lib/kumade/configuration.rb +13 -6
  9. data/lib/kumade/deployer.rb +9 -9
  10. data/lib/kumade/git.rb +25 -20
  11. data/lib/kumade/heroku.rb +18 -11
  12. data/lib/kumade/outputter.rb +21 -0
  13. data/lib/kumade/packager.rb +23 -76
  14. data/lib/kumade/packager_list.rb +29 -0
  15. data/lib/kumade/packagers/jammit_packager.rb +20 -0
  16. data/lib/kumade/packagers/more_packager.rb +20 -0
  17. data/lib/kumade/packagers/noop_packager.rb +14 -0
  18. data/lib/kumade/rake_task_runner.rb +29 -0
  19. data/lib/kumade/version.rb +1 -1
  20. data/spec/kumade/cli_spec.rb +5 -5
  21. data/spec/kumade/command_line_spec.rb +107 -0
  22. data/spec/kumade/configuration_spec.rb +15 -2
  23. data/spec/kumade/deployer_spec.rb +39 -25
  24. data/spec/kumade/git_spec.rb +168 -57
  25. data/spec/kumade/heroku_spec.rb +19 -25
  26. data/spec/kumade/outputter_spec.rb +50 -0
  27. data/spec/kumade/packager_list_spec.rb +31 -0
  28. data/spec/kumade/packager_spec.rb +66 -275
  29. data/spec/kumade/packagers/jammit_packager_spec.rb +27 -0
  30. data/spec/kumade/packagers/more_packager_spec.rb +37 -0
  31. data/spec/kumade/packagers/noop_packager_spec.rb +9 -0
  32. data/spec/kumade/rake_task_runner_spec.rb +75 -0
  33. data/spec/spec_helper.rb +13 -2
  34. data/spec/support/define_constant.rb +41 -0
  35. data/spec/support/environments.rb +32 -0
  36. data/spec/support/git.rb +5 -0
  37. data/spec/support/heroku.rb +6 -6
  38. data/spec/support/shared_examples/packager.rb +6 -0
  39. metadata +65 -28
  40. data/lib/kumade/base.rb +0 -35
  41. data/spec/kumade/base_spec.rb +0 -99
@@ -1,35 +0,0 @@
1
- require "thor"
2
-
3
- module Kumade
4
- class Base < Thor::Shell::Color
5
- def initialize
6
- super()
7
- end
8
-
9
- def run_or_error(command, error_message)
10
- say_status(:run, command)
11
- if ! Kumade.configuration.pretending?
12
- error(error_message) unless run(command)
13
- end
14
- end
15
-
16
- def run(command)
17
- line = Cocaine::CommandLine.new(command)
18
- begin
19
- line.run
20
- true
21
- rescue Cocaine::ExitStatusError => e
22
- false
23
- end
24
- end
25
-
26
- def error(message)
27
- say("==> ! #{message}", :red)
28
- raise Kumade::DeploymentError.new(message)
29
- end
30
-
31
- def success(message)
32
- say("==> #{message}", :green)
33
- end
34
- end
35
- end
@@ -1,99 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Kumade::Base, "#success" do
4
- it { should respond_to(:success) }
5
- end
6
-
7
- describe Kumade::Base, "#error" do
8
- before { STDOUT.stubs(:puts) }
9
-
10
- it { should respond_to(:error) }
11
-
12
- it "prints its message and raises its message" do
13
- lambda { subject.error("I'm an error!") }.should raise_error(Kumade::DeploymentError)
14
-
15
- STDOUT.should have_received(:puts).with(regexp_matches(/I'm an error!/))
16
- end
17
- end
18
-
19
- describe Kumade::Base, "#run_or_error" do
20
- let(:command) { "dummy command" }
21
- let(:error_message) { "dummy error message" }
22
-
23
- before do
24
- STDOUT.stubs(:puts)
25
- end
26
-
27
- context "when pretending" do
28
- before do
29
- Kumade.configuration.pretending = true
30
- subject.stubs(:run)
31
- end
32
-
33
- it "does not run the command" do
34
- subject.run_or_error("dummy command", "dummy error message")
35
-
36
- subject.should_not have_received(:run)
37
- STDOUT.should have_received(:puts).with(regexp_matches(/#{command}/))
38
- end
39
- end
40
-
41
- context "when not pretending" do
42
- context "when it runs successfully" do
43
- before do
44
- Cocaine::CommandLine.stubs(:new).returns(stub(:run))
45
- end
46
-
47
- it "does not print an error" do
48
- subject.run_or_error(command, error_message)
49
-
50
- STDOUT.should_not have_received(:puts).with(regexp_matches(/#{error_message}/))
51
- end
52
- end
53
-
54
- context "when it does not run successfully " do
55
- let(:failing_command_line) { stub("Failing Cocaine::CommandLine") }
56
-
57
- before do
58
- subject.stubs(:error)
59
- failing_command_line.stubs(:run).raises(Cocaine::ExitStatusError)
60
- Cocaine::CommandLine.stubs(:new).returns(failing_command_line)
61
- end
62
-
63
- it "prints an error message" do
64
- subject.run_or_error(command, error_message)
65
-
66
- subject.should have_received(:error).with(error_message)
67
- end
68
- end
69
- end
70
- end
71
-
72
- describe Kumade::Base, "#run" do
73
- let(:command_line) { stub("Cocaine::CommandLine") }
74
- let(:command) { "command" }
75
-
76
- before do
77
- Cocaine::CommandLine.stubs(:new).with(command).returns(command_line)
78
- end
79
-
80
- context "when not successful" do
81
- before do
82
- command_line.stubs(:run)
83
- end
84
-
85
- it "returns true" do
86
- subject.run(command).should == true
87
- end
88
- end
89
-
90
- context "when successful" do
91
- before do
92
- command_line.stubs(:run).raises(Cocaine::ExitStatusError)
93
- end
94
-
95
- it "returns false" do
96
- subject.run(command).should == false
97
- end
98
- end
99
- end