blazing 0.0.16 → 0.1.0.alpha1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. data/.gitignore +2 -0
  2. data/.rvmrc +1 -1
  3. data/Gemfile +0 -10
  4. data/Gemfile.lock +53 -44
  5. data/Guardfile +8 -0
  6. data/README.md +23 -99
  7. data/Rakefile +21 -4
  8. data/bin/blazing +23 -5
  9. data/blazing.gemspec +19 -8
  10. data/features/help_banner.feature +13 -0
  11. data/features/step_definitions/blazing_steps.rb +1 -0
  12. data/features/support/env.rb +9 -0
  13. data/lib/blazing.rb +4 -13
  14. data/lib/blazing/config.rb +38 -73
  15. data/lib/blazing/dsl_setter.rb +20 -0
  16. data/lib/blazing/recipe.rb +5 -78
  17. data/lib/blazing/runner.rb +44 -2
  18. data/lib/blazing/shell.rb +7 -0
  19. data/lib/blazing/target.rb +44 -134
  20. data/lib/blazing/templates/config.erb +21 -0
  21. data/lib/blazing/templates/hook.erb +43 -0
  22. data/lib/blazing/version.rb +1 -1
  23. data/spec/blazing/config_spec.rb +104 -48
  24. data/spec/blazing/integration/init_spec.rb +8 -37
  25. data/spec/blazing/integration/setup_local_spec.rb +27 -0
  26. data/spec/blazing/integration/setup_remote_spec.rb +32 -0
  27. data/spec/blazing/integration/update_spec.rb +38 -0
  28. data/spec/blazing/recipe_spec.rb +5 -66
  29. data/spec/blazing/runner_spec.rb +41 -6
  30. data/spec/blazing/target_spec.rb +26 -99
  31. data/spec/spec_helper.rb +18 -12
  32. data/spec/support/{config.rb → empty_config.rb} +0 -0
  33. metadata +170 -97
  34. data/TODO +0 -3
  35. data/lib/blazing/base.rb +0 -41
  36. data/lib/blazing/bootstrap.rb +0 -27
  37. data/lib/blazing/cli/base.rb +0 -64
  38. data/lib/blazing/cli/create.rb +0 -32
  39. data/lib/blazing/cli/hook.rb +0 -22
  40. data/lib/blazing/cli/templates/blazing.tt +0 -7
  41. data/lib/blazing/cli/templates/post-hook.tt +0 -25
  42. data/lib/blazing/core_ext/object.rb +0 -8
  43. data/lib/blazing/logger.rb +0 -31
  44. data/lib/blazing/recipes/bundler_recipe.rb +0 -20
  45. data/lib/blazing/recipes/rvm_recipe.rb +0 -11
  46. data/spec/blazing/binary_spec.rb +0 -11
  47. data/spec/blazing/cli/base_spec.rb +0 -94
  48. data/spec/blazing/cli/create_spec.rb +0 -27
  49. data/spec/blazing/cli/hook_spec.rb +0 -16
  50. data/spec/blazing/logger_spec.rb +0 -50
  51. data/spec/blazing/recipes/bundler_recipe_spec.rb +0 -32
  52. data/spec/blazing/recipes/passenger_recipe_spec.rb +0 -6
  53. data/spec/blazing/recipes/rvm_recipe_spec.rb +0 -11
  54. data/spec/blazing/remote_spec.rb +0 -136
@@ -1,50 +0,0 @@
1
- require 'spec_helper'
2
- require 'blazing/logger'
3
- require 'blazing/core_ext/object'
4
-
5
- describe Blazing::Logger do
6
-
7
- before :each do
8
- @output = double
9
- @logger = Blazing::Logger.new(@output)
10
- end
11
-
12
- context 'message logger' do
13
- it 'saves the message within the logging class' do
14
- @logger.log :info, 'something'
15
- @logger.instance_variable_get('@messages').should_not be_blank
16
- end
17
-
18
- it 'keeps track what log level a message has' do
19
- @logger.log :info, 'something'
20
- @logger.instance_variable_get('@messages').first[:type].should be :info
21
- end
22
-
23
- it 'fails if the log level is unknown' do
24
- lambda { @logger.log(:meh, 'something') }.should raise_error
25
- end
26
- end
27
-
28
- context 'message reporter' do
29
- it 'prints the messages from the messages hash' do
30
- @logger.log :info, 'just a message'
31
- @output.should_receive(:puts).with('just a message')
32
- @logger.report
33
- end
34
-
35
- it 'prints all messages when no type given' do
36
- @logger.log :info, 'an info message'
37
- @logger.log :warn, 'a warn message'
38
- @output.should_receive(:puts).exactly(2).times
39
- @logger.report
40
- end
41
-
42
- it 'prints only the message of the given type when a type is supplied' do
43
- @logger.log :info, 'an info message'
44
- @logger.log :info, 'another info message'
45
- @logger.log :warn, 'a warn message'
46
- @output.should_receive(:puts).exactly(2).times
47
- @logger.report(:info)
48
- end
49
- end
50
- end
@@ -1,32 +0,0 @@
1
- require 'spec_helper'
2
- require 'blazing/recipes/bundler_recipe'
3
-
4
- describe Blazing::BundlerRecipe do
5
-
6
- before :each do
7
- @recipe_without_options = Blazing::BundlerRecipe.new('bundler')
8
- @recipe_with_options = Blazing::BundlerRecipe.new('bundler', :flags => '--without=production')
9
- @runner = double('runner', :run => nil)
10
- @recipe_with_options.instance_variable_set('@runner', @runner)
11
- @recipe_without_options.instance_variable_set('@runner', @runner)
12
- end
13
-
14
- describe '#run' do
15
- it 'fails if there is no gemfile' do
16
- File.stub!(:exists?).and_return(false)
17
- @recipe_without_options.run.should be false
18
- end
19
-
20
- it 'runs bundle install with default options when no options given' do
21
- File.stub!(:exists?).and_return(true)
22
- @runner.should_receive(:run).with('bundle install --deployment')
23
- @recipe_without_options.run
24
- end
25
-
26
- it 'runs bundle install with the options supplied' do
27
- File.stub!(:exists?).and_return(true)
28
- @runner.should_receive(:run).with('bundle install --without=production')
29
- @recipe_with_options.run
30
- end
31
- end
32
- end
@@ -1,6 +0,0 @@
1
- # require 'spec_helper'
2
- # require 'blazing/recipe/rvm'
3
-
4
- # describe Blazing::RvmRecipe do
5
- # pending 'write rvm recipe specs'
6
- # end
@@ -1,11 +0,0 @@
1
- require 'spec_helper'
2
- require 'blazing/recipes/rvm_recipe'
3
-
4
- describe Blazing::RvmRecipe do
5
-
6
- describe '#run' do
7
- it 'returns false, as the recipe itself is handled in shellscript' do
8
- Blazing::RvmRecipe.new('rvm_recipe').run.should be false
9
- end
10
- end
11
- end
@@ -1,136 +0,0 @@
1
- # require 'spec_helper'
2
- # require 'blazing/remote'
3
-
4
- # describe Blazing::Remote do
5
-
6
- # before :each do
7
- # # recipes = []
8
- # # @config = double('config', :load => double('actual_config', :recipes => recipes, :find_target => double('target', :recipes => recipes)))
9
- # @config = Blazing::Config.new
10
- # @config.target :some_name, :deploy_to => 'user@hostname:/path'
11
- # @remote = Blazing::Remote.new('some_name', :config => @config)
12
- # @remote.instance_variable_set('@_dir', double('Dir', :chdir => nil))
13
- # end
14
-
15
- # describe '#post_receive' do
16
- # before :each do
17
- # @remote.instance_variable_set('@runner', double('runner', :run => true))
18
- # Dir.stub!(:chdir)
19
- # end
20
-
21
- # it 'sets up the git dir' do
22
- # @remote.should_receive(:set_git_dir)
23
- # @remote.post_receive
24
- # end
25
-
26
- # it 'runs the recipes' do
27
- # @remote.should_receive(:run_recipes)
28
- # @remote.post_receive
29
- # end
30
-
31
- # it 'resets the git repository' do
32
- # @remote.should_receive(:reset_head!)
33
- # @remote.post_receive
34
- # end
35
- # end
36
-
37
- # describe '#gemfile_present?' do
38
- # it 'checks if a Gemfile is in the cwd' do
39
- # File.should_receive(:exists?).with('Gemfile')
40
- # @remote.gemfile_present?
41
- # end
42
- # end
43
-
44
- # describe '#set_git_dir' do
45
- # it 'sets .git as gitdir if git dir is "."' do
46
- # # Dir.should_receive(:chdir).with('.git')
47
- # # @remote.set_git_dir
48
- # end
49
- # end
50
-
51
- # describe '#reset_head!' do
52
- # it 'does a git reset --hard HEAD' do
53
- # runner = double('runner', :run => nil)
54
- # @remote.instance_variable_set('@runner', runner)
55
- # runner.should_receive(:run).with('git reset --hard HEAD')
56
- # @remote.reset_head!
57
- # end
58
- # end
59
-
60
- # describe '#use_rvm?' do
61
- # context 'with rvm recipe enabled' do
62
- # it 'returns the rvm string' do
63
- # @remote.instance_variable_set('@recipes', double('recipes', :find => double('recipe', :options => { :rvm_string => 'someruby@somegemset'}), :delete_if => nil))
64
- # @remote.use_rvm?.should == 'someruby@somegemset'
65
- # end
66
-
67
- # it 'deletes the rvm recipes from the recipes array' do
68
- # @remote.instance_variable_set('@recipes', [double('rvm_recipe', :name => 'rvm', :options => {})])
69
- # @remote.use_rvm?
70
- # @remote.instance_variable_get('@recipes').should be_blank
71
- # end
72
- # end
73
-
74
- # context 'without rvm_recipe' do
75
- # it 'returns false' do
76
- # @remote.instance_variable_set('@recipes', double('rvm_recipe', :find => false, :delete_if => nil))
77
- # @remote.use_rvm?.should be false
78
- # end
79
- # end
80
- # end
81
-
82
- # describe '#setup_recipes' do
83
- # context 'when the target has no recipes' do
84
- # it 'assigns the global recipes settings from the config' do
85
- # recipe_probe = double('recipe_probe', :name => 'noname', :run => nil)
86
- # config = double('config', :recipes => [recipe_probe])
87
- # @remote.instance_variable_set('@config', config)
88
- # @remote.setup_recipes
89
- # @remote.instance_variable_get('@recipes').first.should be recipe_probe
90
- # end
91
- # end
92
-
93
- # context 'when the target has recipes' do
94
- # it 'does not touch the target recipes' do
95
- # target_recipe_probe = double('target_recipe_probe', :name => 'target', :run => nil)
96
- # global_recipe_probe = double('global_recipe_probe', :name => 'global', :run => nil)
97
- # global_config = double('config', :recipes => [global_recipe_probe])
98
- # blazing_config_class = double('blazing_config', :parse => global_config)
99
- # @remote.instance_variable_set('@_config', blazing_config_class)
100
- # @remote.instance_variable_set('@recipes', [target_recipe_probe])
101
- # @remote.setup_recipes
102
- # @remote.instance_variable_get('@recipes').first.name.should == 'target'
103
- # end
104
- # end
105
- # end
106
-
107
- # describe '#run_recipes' do
108
- # it 'runs all recipes' do
109
- # recipes = [double('one', :name => nil), double('two', :name => nil), double('three', :name => nil)]
110
- # @remote.instance_variable_set('@recipes', recipes)
111
- # recipes.each do |recipe|
112
- # recipe.should_receive(:run)
113
- # end
114
- # @remote.run_recipes
115
- # end
116
- # end
117
-
118
- # describe '#run_bootstrap_recipes' do
119
-
120
- # before :each do
121
- # @bundler = double('bundler', :name => 'bundler', :run => nil)
122
- # @recipes = [@bundler, double('two', :name => nil), double('three', :name => nil)]
123
- # @remote.instance_variable_set('@recipes', @recipes)
124
- # end
125
-
126
- # it 'runs bundler recipe if it is enabled' do
127
- # @bundler.should_receive(:run)
128
- # @remote.run_bootstrap_recipes
129
- # end
130
-
131
- # it 'deletes the bundler recipe from the array after running it' do
132
- # @remote.run_bootstrap_recipes
133
- # @recipes.find { |r| r.name == 'bundler' }.should be nil
134
- # end
135
- # end
136
- # end