blazing 0.2.10 → 0.2.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. data/.rvmrc +26 -20
  2. data/CHANGELOG.md +28 -8
  3. data/Gemfile +0 -1
  4. data/Guardfile +10 -2
  5. data/README.md +3 -3
  6. data/blazing.gemspec +8 -5
  7. data/lib/blazing/cli.rb +6 -7
  8. data/lib/blazing/commands.rb +72 -0
  9. data/lib/blazing/config.rb +5 -0
  10. data/lib/blazing/hook.rb +85 -0
  11. data/lib/blazing/logger.rb +1 -0
  12. data/lib/blazing/recipe.rb +5 -0
  13. data/lib/blazing/repository.rb +53 -0
  14. data/lib/blazing/target.rb +35 -91
  15. data/lib/blazing/templates/config.erb +1 -1
  16. data/lib/blazing/templates/hook/base.erb +7 -0
  17. data/lib/blazing/templates/hook/bundler.erb +3 -0
  18. data/lib/blazing/templates/hook/git-reset.erb +10 -0
  19. data/lib/blazing/templates/hook/rake.erb +5 -0
  20. data/lib/blazing/templates/hook/recipes.erb +5 -0
  21. data/lib/blazing/templates/{hook.erb → hook/rvm.erb} +0 -29
  22. data/lib/blazing/templates/hook/setup.erb +9 -0
  23. data/lib/blazing.rb +3 -2
  24. data/spec/blazing/cli_spec.rb +33 -0
  25. data/spec/blazing/commands_spec.rb +134 -0
  26. data/spec/blazing/dsl_setter_spec.rb +29 -0
  27. data/spec/blazing/hook_spec.rb +148 -0
  28. data/spec/blazing/integration/deployment_spec.rb +32 -0
  29. data/spec/blazing/integration/init_spec.rb +3 -4
  30. data/spec/blazing/integration/list_spec.rb +4 -3
  31. data/spec/blazing/integration/recipes_spec.rb +2 -2
  32. data/spec/blazing/integration/setup_spec.rb +2 -2
  33. data/spec/blazing/integration/update_spec.rb +1 -3
  34. data/spec/blazing/logger_spec.rb +34 -0
  35. data/spec/blazing/recipe_spec.rb +1 -1
  36. data/spec/blazing/repository_spec.rb +41 -0
  37. data/spec/blazing/shell_spec.rb +19 -0
  38. data/spec/blazing/target_spec.rb +0 -25
  39. metadata +66 -35
  40. data/.rspec +0 -2
  41. data/lib/blazing/runner.rb +0 -79
  42. data/lib/blazing/version.rb +0 -7
  43. data/spec/blazing/runner_spec.rb +0 -24
@@ -0,0 +1,7 @@
1
+ <%= load_template 'hook/setup' %>
2
+ <%= load_template 'hook/git-reset' %>
3
+ <%= load_template 'hook/rvm' %>
4
+ <%= load_template 'hook/bundler' %>
5
+ <%= load_template 'hook/recipes' %>
6
+ <%= load_template 'hook/rake' %>
7
+
@@ -0,0 +1,3 @@
1
+ echo "------> [blazing] Bundling gems"
2
+ bundle --deployment --quiet --without development test
3
+
@@ -0,0 +1,10 @@
1
+ while read oldrev newrev refname
2
+ do
3
+ # Reset so we dont have unstaged changes... and then checkout the pushed ref
4
+ echo "------> [blazing] Doing a hard reset and checking out $refname since thats what you pushed"
5
+ git reset --hard HEAD
6
+ git checkout $refname
7
+ done
8
+
9
+ unset GIT_DIR
10
+ unset GIT_WORK_TREE
@@ -0,0 +1,5 @@
1
+ <% if rake_command %>
2
+ echo "------> [blazing] running <%= rake_command %>"
3
+ <%= rake_command %>
4
+ <% end %>
5
+
@@ -0,0 +1,5 @@
1
+ <% unless @config.recipes.empty? %>
2
+ echo "------> [blazing] Running recipes for <%= @target.name.to_s %>"
3
+ bundle exec blazing recipes <%= @target.name.to_s %>
4
+ <% end %>
5
+
@@ -1,20 +1,3 @@
1
- #!/bin/bash
2
-
3
- echo "------"
4
- echo "------ [blazing] ENTERING POST RECEIVE HOOK FOR: <%= name %>"
5
- echo "------"
6
-
7
- cd ..
8
- GIT_DIR='.git'
9
-
10
- while read oldrev newrev refname
11
- do
12
- # Reset so we dont have unstaged changes... and then checkout the pushed ref
13
- echo "------> [blazing] Doing a hard reset and checking out $refname since thats what you pushed"
14
- git reset --hard HEAD
15
- git checkout $refname
16
- done
17
-
18
1
  <% if @config.rvm %>
19
2
 
20
3
  #
@@ -58,15 +41,3 @@ done
58
41
 
59
42
  <% end %>
60
43
 
61
- echo "------> [blazing] Bundling gems"
62
- bundle --deployment --quiet --without development test
63
-
64
- <% unless @config.recipes.empty? %>
65
- echo "------> [blazing] Running recipes for <%= name.to_s %>"
66
- bundle exec blazing recipes <%= name.to_s %>
67
- <% end %>
68
-
69
- <% if @target.rake_command %>
70
- echo "------> [blazing] running <%= @target.rake_command %>"
71
- <%= @target.rake_command %>
72
- <% end %>
@@ -0,0 +1,9 @@
1
+ #!/bin/bash
2
+
3
+ echo "------"
4
+ echo "------ [blazing] ENTERING POST RECEIVE HOOK FOR: <%= @target.name %>"
5
+ echo "------"
6
+
7
+ cd ..
8
+ GIT_DIR='.git'
9
+
data/lib/blazing.rb CHANGED
@@ -4,12 +4,13 @@ module Blazing
4
4
 
5
5
  autoload :CLI, 'blazing/cli'
6
6
  autoload :Config, 'blazing/config'
7
- autoload :Version, 'blazing/version'
8
7
  autoload :DSLSetter, 'blazing/dsl_setter'
9
8
  autoload :Recipe, 'blazing/recipe'
10
- autoload :Runner, 'blazing/runner'
9
+ autoload :COmmands, 'blazing/commands'
11
10
  autoload :Shell, 'blazing/shell'
12
11
  autoload :Target, 'blazing/target'
12
+ autoload :Hook, 'blazing/hook'
13
+ autoload :Repository, 'blazing/repository'
13
14
 
14
15
  TEMPLATE_ROOT = File.expand_path(File.dirname(__FILE__) + File.join('/', 'blazing', 'templates'))
15
16
  DEFAULT_CONFIG_LOCATION = 'config/blazing.rb'
@@ -0,0 +1,33 @@
1
+ require 'spec_helper'
2
+
3
+ module Blazing
4
+
5
+ describe CLI do
6
+
7
+ let(:cli) { CLI.new }
8
+ it 'has an init method' do
9
+ cli.respond_to? :init
10
+ end
11
+
12
+ it 'has a setup method' do
13
+ cli.respond_to? :setup
14
+ end
15
+
16
+ it 'has an update method' do
17
+ cli.respond_to? :update
18
+ end
19
+
20
+ it 'has a recipes method' do
21
+ cli.respond_to? :recipes
22
+ end
23
+
24
+ it 'has a list method' do
25
+ cli.respond_to? :list
26
+ end
27
+
28
+ it 'has a help method' do
29
+ cli.respond_to? :help
30
+ end
31
+ end
32
+ end
33
+
@@ -0,0 +1,134 @@
1
+ require 'spec_helper'
2
+ require 'blazing/commands'
3
+
4
+ module Blazing
5
+
6
+ describe Commands do
7
+
8
+ let(:config_instance) { Blazing::Config.new }
9
+
10
+ let(:target_a) { double('target_a', :name => 'target_a', :update => nil, :setup => nil) }
11
+ let(:target_b) { double('target_b', :name => 'target_b', :update => nil, :setup => nil) }
12
+ let(:targets) { [target_a, target_b] }
13
+
14
+ let(:recipe_a) { double('recipe_a', :name => 'recipe_a', :run => nil) }
15
+ let(:recipe_b) { double('recipe_b', :name => 'recipe_b', :run => nil) }
16
+ let(:recipes) { [recipe_a, recipe_b] }
17
+
18
+ let(:config) do
19
+ config = config_instance
20
+ config.targets = targets
21
+ config.recipes = recipes
22
+
23
+ config
24
+ end
25
+
26
+ let(:commands) { Commands }
27
+ let(:commands_instance) { commands.new }
28
+
29
+ before :each do
30
+ Config.stub(:parse).and_return(config)
31
+ end
32
+
33
+ describe '.new' do
34
+ it 'reads to config file' do
35
+ Config.should_receive(:parse).and_return(config)
36
+ commands.new
37
+ end
38
+ end
39
+
40
+ describe '#run' do
41
+ it 'creates an instance of itself' do
42
+ commands_instance.stub!(:dummy_command)
43
+ commands.should_receive(:new).with({}).and_return(commands_instance)
44
+ commands.run(:dummy_command)
45
+ end
46
+
47
+ it 'runs the specified command' do
48
+ commands_instance.should_receive(:dummy_command)
49
+ commands.stub(:new).with({}).and_return(commands_instance)
50
+ commands.run(:dummy_command)
51
+ end
52
+
53
+ it 'raises an exception if the command does not exist' do
54
+ pending 'Implement after reading exceptional Ruby ;-)'
55
+ end
56
+ end
57
+
58
+ describe '#init' do
59
+ it 'creates a config directory if it does not exist' do
60
+ Dir.should_receive(:mkdir).with('config')
61
+ File.stub(:exists?).and_return(false)
62
+ File.stub(:open)
63
+ commands.run(:init)
64
+ end
65
+
66
+ it 'creates a config file' do
67
+ file = double('file').as_null_object
68
+ File.should_receive(:open).with("config/blazing.rb", "wb").and_yield(file)
69
+ commands.run(:init)
70
+ end
71
+ end
72
+
73
+ describe '#setup' do
74
+ it 'runs the setup method on the specified target' do
75
+ target_a.should_receive(:setup)
76
+ target_b.should_not_receive(:setup)
77
+ commands.run(:setup, :target_name => target_a.name)
78
+ end
79
+
80
+ it 'does nothing when no target is specified' do
81
+ target_a.should_not_receive(:setup)
82
+ target_b.should_not_receive(:setup)
83
+ commands.run(:setup)
84
+ end
85
+
86
+ it 'runs setup on all targets if "all" is specified' do
87
+ target_a.should_receive(:setup)
88
+ target_b.should_receive(:setup)
89
+ commands.run(:setup, :target_name => 'all')
90
+ end
91
+
92
+ it 'runs the update command' do
93
+ commands_instance.should_receive(:update)
94
+ commands.stub(:new).with({}).and_return(commands_instance)
95
+ commands.run(:setup)
96
+ end
97
+ end
98
+
99
+ describe '#update' do
100
+ it 'runs the update method on the specified target' do
101
+ target_a.should_receive(:update)
102
+ target_b.should_not_receive(:update)
103
+ commands.run(:update, :target_name => target_a.name)
104
+ end
105
+
106
+ it 'does nothing when no target is specified' do
107
+ target_a.should_not_receive(:update)
108
+ target_b.should_not_receive(:update)
109
+ commands.run(:update)
110
+ end
111
+
112
+ it 'runs update on all targets if "all" is specified' do
113
+ target_a.should_receive(:update)
114
+ target_b.should_receive(:update)
115
+ commands.run(:update, :target_name => 'all')
116
+ end
117
+ end
118
+
119
+ describe '#recipes' do
120
+ it 'runs each recipe' do
121
+ recipes.each { |r| r.should_receive(:run) }
122
+ commands.run(:recipes)
123
+ end
124
+ end
125
+
126
+ describe '#list' do
127
+ it 'lists each recipe' do
128
+ Blazing::Recipe.should_receive(:pretty_list)
129
+ commands.run(:list)
130
+ end
131
+ end
132
+ end
133
+ end
134
+
@@ -0,0 +1,29 @@
1
+ require 'spec_helper'
2
+
3
+ module Blazing
4
+
5
+ describe DSLSetter do
6
+
7
+ let(:dummy) { class Dummy; extend DSLSetter; end }
8
+ let(:dummy_instance) { Dummy.new }
9
+
10
+ it 'it defines a dsl method named after each argument provided' do
11
+ dummy.dsl_setter(:foo, :bar)
12
+ dummy_instance.should respond_to :foo
13
+ dummy_instance.should respond_to :bar
14
+ end
15
+
16
+ context 'the generated dsl method' do
17
+ it 'sets an instance variable when provided with an argumnent' do
18
+ dummy_instance.foo('something')
19
+ dummy_instance.instance_variable_get(:@foo).should == 'something'
20
+ end
21
+
22
+ it 'returns the value of the istance variable when no argument is provided' do
23
+ dummy_instance.instance_variable_set(:@foo, 'something')
24
+ dummy_instance.foo.should == 'something'
25
+ end
26
+ end
27
+ end
28
+ end
29
+
@@ -0,0 +1,148 @@
1
+ require 'spec_helper'
2
+
3
+ module Blazing
4
+
5
+ class Recipe::Dummy < Blazing::Recipe
6
+ end
7
+
8
+ describe Hook do
9
+
10
+ let(:config) { Config.new }
11
+
12
+ describe '#rake_command' do
13
+ it 'prepends the environment variables specified in the rake call' do
14
+ config.rake :deploy, 'SOMEFUNKYVARIABLE=foobar'
15
+ target = Blazing::Target.new(:sometarget, '/path', config)
16
+ hook = Hook.new(target)
17
+ hook.rake_command.should == 'SOMEFUNKYVARIABLE=foobar bundle exec rake deploy'
18
+ end
19
+
20
+ it 'appends the RAILS_ENV specified as :rails_env option to the target call' do
21
+ config.rake :deploy
22
+ target = Blazing::Target.new(:sometarget, '/path', config, :rails_env => 'production')
23
+ hook = Hook.new(target)
24
+ hook.rake_command.should == ' RAILS_ENV=production bundle exec rake deploy'
25
+ end
26
+
27
+ it 'returns nil when no rake task was specified in config' do
28
+ target = Blazing::Target.new(:sometarget, '/path', config, :rails_env => 'production')
29
+ hook = Hook.new(target)
30
+ hook.rake_command.should be nil
31
+ end
32
+ end
33
+
34
+ describe 'Generated Hook' do
35
+
36
+ let(:target) { Blazing::Target.new(:sometarget, '/path', config, :rails_env => 'production') }
37
+ let(:hook_file) { Hook.new(target).send(:generate_hook) }
38
+
39
+ context 'Always' do
40
+ it 'logs the header with the target name' do
41
+ hook_file.should include("ENTERING POST RECEIVE HOOK FOR: sometarget")
42
+ end
43
+
44
+ it 'goes one directory up' do
45
+ hook_file.should include('cd ..')
46
+ end
47
+
48
+ it 'sets the GIT_DIR variable to .git' do
49
+ hook_file.should include("GIT_DIR='.git'")
50
+ end
51
+
52
+ it 'does a hard reset' do
53
+ hook_file.should include("git reset --hard HEAD")
54
+ end
55
+
56
+ it 'checks out the pushed branch' do
57
+ hook_file.should include("git checkout $refname")
58
+ end
59
+
60
+ it 'resets the GIT_DIR variable' do
61
+ hook_file.should include("unset GIT_DIR")
62
+ end
63
+
64
+ it 'resets the GIT_WORK_TREE variable' do
65
+ hook_file.should include("unset GIT_WORK_TREE")
66
+ end
67
+
68
+ it 'runs bundler with the correct options' do
69
+ hook_file.should include("bundle --deployment --quiet --without development test")
70
+ end
71
+ end
72
+
73
+ context 'RVM Setup' do
74
+ context 'when rvm is enabled' do
75
+ context 'loading rvm' do
76
+ it 'uses the load mechanism suggested by rvm' do
77
+ config.rvm 'someruby@somegemset'
78
+ hook_file.should include("source \"$HOME/.rvm/scripts/rvm\"")
79
+ hook_file.should include("source \"/usr/local/rvm/scripts/rvm\"")
80
+ end
81
+
82
+ it 'sources the rvm_scripts directory when rvm_scripts is specified' do
83
+ config.rvm 'someruby@somegemset'
84
+ config.rvm_scripts '/location/of/rvm/scripts'
85
+ hook_file.should include("source /location/of/rvm/scripts")
86
+ end
87
+ end
88
+
89
+ context 'loading the rvm ruby and gemset' do
90
+ it 'sources the rvmrc to load the env' do
91
+ config.rvm 'someruby@somegemset'
92
+ hook_file.should include("rvm use someruby@somegemset")
93
+ end
94
+
95
+ it 'uses rvm use to load the env when an rvm string was specified' do
96
+ config.rvm :rvmrc
97
+ hook_file.should include("source .rvmrc")
98
+ end
99
+ end
100
+ end
101
+
102
+ context 'when rvm is disabled' do
103
+ it 'does not include any rvm handling' do
104
+ hook_file.should_not include("Loading rvm")
105
+ end
106
+ end
107
+ end
108
+
109
+ context 'Recipes Handling' do
110
+
111
+ context 'when there are no recipes configured' do
112
+ it 'does not run blazing recipes' do
113
+ hook_file.should_not include("bundle exec blazing recipes")
114
+ end
115
+ end
116
+
117
+ context 'when there are recipes configured' do
118
+ before :each do
119
+ config.recipe :dummy
120
+ end
121
+
122
+ it 'runs the blazing recipes command with the correct target name' do
123
+ hook_file.should include("bundle exec blazing recipes sometarget")
124
+ end
125
+ end
126
+ end
127
+
128
+ context 'Rake Command Handling' do
129
+ context 'when the rake_command is specified' do
130
+ before :each do
131
+ config.rake :deploy
132
+ end
133
+
134
+ it 'runs the rake command' do
135
+ hook_file.should include(' RAILS_ENV=production bundle exec rake deploy')
136
+ end
137
+ end
138
+
139
+ context 'when no rake_command is specified' do
140
+ it 'does not run the rake_command' do
141
+ hook_file.should_not include(" RAILS_ENV=production bundle exec rake")
142
+ end
143
+ end
144
+ end
145
+ end
146
+ end
147
+ end
148
+
@@ -0,0 +1,32 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'deployment with git push' do
4
+
5
+ before :each do
6
+ setup_sandbox
7
+ #@config = Blazing::Config.new
8
+ #@config.target :production, "#{@sandbox_directory}/target"
9
+ #@config.target :staging, "#{@sandbox_directory}/staging"
10
+ #@cli = Blazing::CLI.new
11
+ #Blazing::Config.stub(:parse).and_return @config
12
+ end
13
+
14
+ after :each do
15
+ teardown_sandbox
16
+ end
17
+
18
+ context 'git push <remote> <ref>' do
19
+ it 'deploys the pushed ref'
20
+ end
21
+
22
+ context 'git push <remote>' do
23
+ context 'when one ref is pushed' do
24
+ it 'deploys the pushed ref'
25
+ end
26
+
27
+ context 'when multiple refs are pushed' do
28
+ it 'deploys the currently checked out ref'
29
+ end
30
+ end
31
+ end
32
+
@@ -1,12 +1,11 @@
1
1
  require 'spec_helper'
2
2
  require 'blazing/config'
3
- require 'blazing/runner'
4
3
 
5
- describe 'blazing init' do
4
+ describe '$ blazing init' do
6
5
 
7
6
  before :each do
8
7
  setup_sandbox
9
- Blazing::Runner.init
8
+ Blazing::Commands.new(:file => File.join(File.dirname(__FILE__), '../../support/empty_config.rb')).init
10
9
  end
11
10
 
12
11
  after :each do
@@ -20,5 +19,5 @@ describe 'blazing init' do
20
19
  it 'creates a config file in config/blazing.rb' do
21
20
  File.exists?('config/blazing.rb').should be true
22
21
  end
23
-
24
22
  end
23
+
@@ -1,6 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe 'blazing list' do
3
+ describe '$ blazing list' do
4
+
4
5
 
5
6
  before :each do
6
7
  setup_sandbox
@@ -13,7 +14,7 @@ describe 'blazing list' do
13
14
  it 'prints a list of the available recipes' do
14
15
  class Blazing::Recipe::Dummy < Blazing::Recipe
15
16
  end
16
- capture(:stdout) { Blazing::Runner.list }.should == "dummy\n"
17
+ capture(:stdout) { Blazing::Commands.new(:file => File.join(File.dirname(__FILE__), '../../support/empty_config.rb')).list }.should == "dummy\n"
17
18
  end
18
-
19
19
  end
20
+
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe 'blazing recipes' do
3
+ describe '$ blazing recipes' do
4
4
 
5
5
  before :each do
6
6
  setup_sandbox
@@ -25,5 +25,5 @@ describe 'blazing recipes' do
25
25
  output = capture(:stdout) { @cli.recipes(:production) }
26
26
  output.should == "dummy recipe was run\n"
27
27
  end
28
-
29
28
  end
29
+
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe 'blazing setup' do
3
+ describe '$ blazing setup' do
4
4
 
5
5
  before :each do
6
6
  setup_sandbox
@@ -37,5 +37,5 @@ require 'spec_helper'
37
37
  File.exists?("#{@sandbox_directory}/staging/.git/hooks/post-receive").should be true
38
38
  end
39
39
  end
40
-
41
40
  end
41
+
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe 'blazing update' do
3
+ describe '$ blazing update' do
4
4
 
5
5
  before :each do
6
6
  setup_sandbox
@@ -15,7 +15,6 @@ require 'spec_helper'
15
15
  teardown_sandbox
16
16
  end
17
17
 
18
-
19
18
  context 'when a target is specified' do
20
19
 
21
20
  before :each do
@@ -40,6 +39,5 @@ require 'spec_helper'
40
39
  File.exists?("#{@sandbox_directory}/staging/.git/hooks/post-receive").should be true
41
40
  end
42
41
  end
43
-
44
42
  end
45
43
 
@@ -0,0 +1,34 @@
1
+ require 'spec_helper'
2
+
3
+ module Blazing
4
+
5
+ describe Logger do
6
+
7
+ let(:logger) { Logger.new }
8
+ let(:dummy) { class Dummy; include Logger; end }
9
+
10
+ context 'defines convenience methods' do
11
+ it 'for debug messages' do
12
+ dummy.respond_to? :debug
13
+ end
14
+
15
+ it 'for info messages' do
16
+ dummy.respond_to? :info
17
+ end
18
+
19
+ it 'for warn messages' do
20
+ dummy.respond_to? :warn
21
+ end
22
+
23
+ it 'for error messages' do
24
+ dummy.respond_to? :error
25
+ end
26
+
27
+ it 'for fatal messages' do
28
+ dummy.respond_to? :fatal
29
+ end
30
+
31
+ end
32
+ end
33
+ end
34
+
@@ -19,7 +19,7 @@ describe Blazing::Recipe do
19
19
 
20
20
  describe '.list' do
21
21
  it 'retunrs an array of the available recipe classes' do
22
- Blazing::Recipe.list.first.should == Blazing::Recipe::Dummy
22
+ Blazing::Recipe.list.should include Blazing::Recipe::Dummy
23
23
  end
24
24
  end
25
25
 
@@ -0,0 +1,41 @@
1
+ require 'spec_helper'
2
+
3
+ module Blazing
4
+
5
+ describe Repository do
6
+
7
+ let(:shell_probe) { double(:shell, :run => nil) }
8
+
9
+ describe '#setup' do
10
+ it 'initializes and sets up the repository over ssh' do
11
+ target = double(:target, :host => 'host', :user => 'user', :path => '/some/where')
12
+ repository = Repository.new(target)
13
+ repository.instance_variable_set(:@shell, shell_probe)
14
+
15
+ shell_probe.should_receive(:run).with("ssh user@host 'mkdir /some/where; cd /some/where && git init && cd /some/where && git config receive.denyCurrentBranch ignore'")
16
+ repository.setup
17
+ end
18
+
19
+ it 'initializes and sets up the repository locally when no host provided' do
20
+ target = double(:target, :host => nil, :user => 'user', :path => '/some/where')
21
+ repository = Repository.new(target)
22
+ repository.instance_variable_set(:@shell, shell_probe)
23
+
24
+ shell_probe.should_receive(:run).with("mkdir /some/where; cd /some/where && git init && cd /some/where && git config receive.denyCurrentBranch ignore")
25
+ repository.setup
26
+ end
27
+ end
28
+
29
+ describe '#add_git_remote' do
30
+
31
+ let(:target) { double(:target, :host => 'host', :user => 'user', :path => '/some/where', :name => :foo, :location => '/url/for/git/remote') }
32
+ let(:repository) { Repository.new(target) }
33
+ let(:grit_object) { repository.instance_variable_get(:@grit_object) }
34
+
35
+ it 'adds a git remote for the target' do
36
+ repository.add_git_remote
37
+ grit_object.config["remote.#{target.name}.url"].should == target.location
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,19 @@
1
+ require 'spec_helper'
2
+
3
+ module Blazing
4
+
5
+ describe Shell do
6
+
7
+ let(:shell) { Shell.new }
8
+
9
+ describe '#run' do
10
+ it 'runs the provided command' do
11
+ shell.should_receive(:`)
12
+ shell.run('command')
13
+ end
14
+
15
+ it 'raises an exception when the command fails'
16
+ end
17
+ end
18
+ end
19
+