bard 0.6.9 → 0.6.10

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.
data/Rakefile CHANGED
@@ -13,9 +13,8 @@ begin
13
13
  gem.add_development_dependency "ruby-debug"
14
14
  gem.add_development_dependency "rspec"
15
15
  gem.add_development_dependency "cucumber"
16
- gem.add_dependency(%q<rubygems-update>, [">= 1.3.2"])
17
16
  gem.add_dependency(%q<thor>, [">= 0.11.7"])
18
- gem.add_dependency(%q<grit>, [">= 1.1.1"])
17
+ gem.add_dependency(%q<grit>, ["= 1.1.1"])
19
18
  gem.add_dependency(%q<git_remote_branch>, [">= 0.3.0"])
20
19
  gem.add_dependency(%q<systemu>, [">= 1.2.0"])
21
20
  gem.add_dependency(%q<term-ansicolor>, [">= 1.0.3"])
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.9
1
+ 0.6.10
@@ -1,15 +1,15 @@
1
1
  # Generated by jeweler
2
- # DO NOT EDIT THIS FILE
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{bard}
8
- s.version = "0.6.9"
8
+ s.version = "0.6.10"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Micah Geisel", "Nick Hogle"]
12
- s.date = %q{2009-11-05}
12
+ s.date = %q{2009-12-08}
13
13
  s.default_executable = %q{bard}
14
14
  s.description = %q{This immaculate work of engineering genius allows mere mortals to collaborate with beings of transcendent intelligence like Micah, Michael, and Nick.}
15
15
  s.email = %q{info@botandrose.com}
@@ -51,11 +51,11 @@ Gem::Specification.new do |s|
51
51
  s.homepage = %q{http://github.com/botandrose/bard}
52
52
  s.rdoc_options = ["--charset=UTF-8"]
53
53
  s.require_paths = ["lib"]
54
- s.rubygems_version = %q{1.3.4}
54
+ s.rubygems_version = %q{1.3.5}
55
55
  s.summary = %q{Tools for collaborating with Bot and Rose Design.}
56
56
  s.test_files = [
57
- "spec/spec_helper.rb",
58
- "spec/bard_spec.rb"
57
+ "spec/bard_spec.rb",
58
+ "spec/spec_helper.rb"
59
59
  ]
60
60
 
61
61
  if s.respond_to? :specification_version then
@@ -66,9 +66,8 @@ Gem::Specification.new do |s|
66
66
  s.add_development_dependency(%q<ruby-debug>, [">= 0"])
67
67
  s.add_development_dependency(%q<rspec>, [">= 0"])
68
68
  s.add_development_dependency(%q<cucumber>, [">= 0"])
69
- s.add_runtime_dependency(%q<rubygems-update>, [">= 1.3.2"])
70
69
  s.add_runtime_dependency(%q<thor>, [">= 0.11.7"])
71
- s.add_runtime_dependency(%q<grit>, [">= 1.1.1"])
70
+ s.add_runtime_dependency(%q<grit>, ["= 1.1.1"])
72
71
  s.add_runtime_dependency(%q<git_remote_branch>, [">= 0.3.0"])
73
72
  s.add_runtime_dependency(%q<systemu>, [">= 1.2.0"])
74
73
  s.add_runtime_dependency(%q<term-ansicolor>, [">= 1.0.3"])
@@ -76,9 +75,8 @@ Gem::Specification.new do |s|
76
75
  s.add_dependency(%q<ruby-debug>, [">= 0"])
77
76
  s.add_dependency(%q<rspec>, [">= 0"])
78
77
  s.add_dependency(%q<cucumber>, [">= 0"])
79
- s.add_dependency(%q<rubygems-update>, [">= 1.3.2"])
80
78
  s.add_dependency(%q<thor>, [">= 0.11.7"])
81
- s.add_dependency(%q<grit>, [">= 1.1.1"])
79
+ s.add_dependency(%q<grit>, ["= 1.1.1"])
82
80
  s.add_dependency(%q<git_remote_branch>, [">= 0.3.0"])
83
81
  s.add_dependency(%q<systemu>, [">= 1.2.0"])
84
82
  s.add_dependency(%q<term-ansicolor>, [">= 1.0.3"])
@@ -87,11 +85,11 @@ Gem::Specification.new do |s|
87
85
  s.add_dependency(%q<ruby-debug>, [">= 0"])
88
86
  s.add_dependency(%q<rspec>, [">= 0"])
89
87
  s.add_dependency(%q<cucumber>, [">= 0"])
90
- s.add_dependency(%q<rubygems-update>, [">= 1.3.2"])
91
88
  s.add_dependency(%q<thor>, [">= 0.11.7"])
92
- s.add_dependency(%q<grit>, [">= 1.1.1"])
89
+ s.add_dependency(%q<grit>, ["= 1.1.1"])
93
90
  s.add_dependency(%q<git_remote_branch>, [">= 0.3.0"])
94
91
  s.add_dependency(%q<systemu>, [">= 1.2.0"])
95
92
  s.add_dependency(%q<term-ansicolor>, [">= 1.0.3"])
96
93
  end
97
94
  end
95
+
@@ -20,7 +20,7 @@ Feature: Bard can check its environment for missing dependencies and potential p
20
20
 
21
21
  Scenario: Bard check detects pending migrations
22
22
  Given a shared rails project
23
- And I have committed a set of changes that includes a new migration
23
+ And a commit with a new migration
24
24
  When I type "bard check"
25
25
  Then I should see the fatal error "pending migrations"
26
26
 
@@ -46,8 +46,8 @@ Feature: Bard can check its environment for missing dependencies and potential p
46
46
 
47
47
  Scenario: Bard check detects missing gems
48
48
  Given a shared rails project
49
- And I have committed a set of changes that adds the test gem as a dependency
50
- And I dont have the test gem installed
49
+ And the test gem is not installed
50
+ And a commit that adds the test gem as a dependency
51
51
  When I type "bard check"
52
52
  Then I should see the fatal error "missing gems"
53
53
 
@@ -73,26 +73,26 @@ Feature: Bard can check its environment for missing dependencies and potential p
73
73
  Given a shared rails project
74
74
  And my "RAILS_ENV" environment variable is "staging"
75
75
  And there is no git hook on the staging server
76
- When I type "bard check" on the staging server
76
+ When on staging, I type "bard check"
77
77
  Then I should see the fatal error "missing git hook"
78
78
 
79
79
  Scenario: Bard check detects unexecutable staging hook
80
80
  Given a shared rails project
81
81
  And my "RAILS_ENV" environment variable is "staging"
82
82
  And the git hook on the staging server is not executable
83
- When I type "bard check" on the staging server
83
+ When on staging, I type "bard check"
84
84
  Then I should see the fatal error "unexecutable git hook"
85
85
 
86
86
  Scenario: Bard check detects improper staging hook
87
87
  Given a shared rails project
88
88
  And my "RAILS_ENV" environment variable is "staging"
89
89
  And the git hook on the staging server is bad
90
- When I type "bard check" on the staging server
90
+ When on staging, I type "bard check"
91
91
  Then I should see the fatal error "improper git hook"
92
92
 
93
93
  Scenario: Bard check detects missing receive.denyCurrentBranch git variable on staging
94
94
  Given a shared rails project
95
95
  And my "RAILS_ENV" environment variable is "staging"
96
96
  And the staging server git config for receive.denyCurrentBranch is not "ignore"
97
- When I type "bard check" on the staging server
97
+ When on staging, I type "bard check"
98
98
  Then I should see the fatal error "denyCurrentBranch"
@@ -2,14 +2,14 @@ Feature: Bard deploy should fold the integration branch into master and perform
2
2
 
3
3
  Scenario: Bard deploy detects non-fast-forward merge from integration to master
4
4
  Given a shared rails project
5
- And the remote master branch has had a commit since I last pulled
6
- And I have committed a set of changes to my local integration branch
5
+ And on staging, a commit to the master branch
6
+ And a commit
7
7
  When I type "bard deploy"
8
8
  Then I should see the fatal error "Rebase"
9
9
 
10
10
  Scenario: Bard deploy works
11
11
  Given a shared rails project
12
- And I have committed a set of changes to my local integration branch
12
+ And a commit
13
13
  When I type "bard deploy"
14
14
  Then the "master" branch should match the "integration" branch
15
15
  And the "integration" branch should match the "origin/integration" branch
@@ -3,12 +3,12 @@ Feature: bard pull
3
3
  Given a shared rails project
4
4
 
5
5
  Scenario: Pulling down the latest changes from the remote integration branch
6
- Given the remote integration branch has had a commit since I last pulled
6
+ Given on staging, a commit
7
7
  When I type "bard pull"
8
8
  Then the "integration" branch should match the "origin/integration" branch
9
9
 
10
10
  Scenario: Pulling down when the latest changes include a submodule addition
11
- Given the remote integration branch has had a commit that includes a new submodule
11
+ Given on staging, a commit with a new submodule
12
12
  When I type "bard pull"
13
13
  Then the "integration" branch should match the "origin/integration" branch
14
14
  And there should be one new submodule
@@ -17,7 +17,7 @@ Feature: bard pull
17
17
 
18
18
  Scenario: Pulling down when the latest changes include a submodule update
19
19
  Given a submodule
20
- And the remote integration branch has had a commit that includes a submodule update
20
+ And on staging, a commit
21
21
  When I type "bard pull"
22
22
  Then the "integration" branch should match the "origin/integration" branch
23
23
  And the submodule branch should match the submodule origin branch
@@ -25,7 +25,7 @@ Feature: bard pull
25
25
 
26
26
  Scenario: Pulling down when the latest changes include a submodule url change
27
27
  Given a submodule
28
- And the remote integration branch has had a commit that includes a submodule url change
28
+ And on staging, a commit with a submodule url change
29
29
  When I type "bard pull"
30
30
  Then the "integration" branch should match the "origin/integration" branch
31
31
  And the submodule url should be changed
@@ -35,14 +35,14 @@ Feature: bard pull
35
35
  # TODO
36
36
  #Scenario: Pulling down when the latest changes include a submodule deletion
37
37
  # Given a submodule
38
- # And the remote integration branch has had a commit that includes a submodule deletion
38
+ # And on staging, a commit with a submodule deletion
39
39
  # When I type "bard pull"
40
40
  # Then the "integration" branch should match the "origin/integration" branch
41
41
  # And the submodule should be deleted
42
42
 
43
43
  Scenario: Pulling latest changes from the remote integration branch after committing locally
44
- Given the remote integration branch has had a commit since I last pulled
45
- And I have committed a set of changes to my local integration branch
44
+ Given on staging, a commit
45
+ And a commit
46
46
  When I type "bard pull"
47
47
  Then I should see the warning "Someone has pushed some changes"
48
48
  And the "integration" branch should be a fast-forward from the "origin/integration" branch
@@ -53,38 +53,40 @@ Feature: bard pull
53
53
  Then I should see the fatal error "root directory"
54
54
 
55
55
  Scenario: Trying to bard pull with a dirty working directory
56
- Given the remote integration branch has had a commit since I last pulled
56
+ Given on staging, a commit
57
57
  And a dirty working directory
58
58
  When I type "bard pull"
59
59
  Then I should see the fatal error "You have uncommitted changes!"
60
60
  And the "integration" branch should not match the "origin/integration" branch
61
61
 
62
62
  Scenario: Trying to bard pull when not on the integration branch
63
- Given the remote integration branch has had a commit since I last pulled
63
+ Given on staging, a commit
64
64
  And I am on a non-integration branch
65
65
  When I type "bard pull"
66
66
  Then I should see the fatal error "not on the integration branch"
67
67
  And the "integration" branch should not match the "origin/integration" branch
68
68
 
69
69
  Scenario: Pulling in a change that includes a migration on a dev machine
70
- Given the remote integration branch has had a commit that includes a new migration
71
- And I have a development environment set up locally
70
+ Given on staging, a commit with a new migration
71
+ And a development database
72
72
  When I type "bard pull"
73
73
  Then the development database should include that migration
74
74
 
75
75
  Scenario: Pulling in a change that includes a migration on a dev and testing machine
76
- Given the remote integration branch has had a commit that includes a new migration
77
- And I have development and test environments set up locally
76
+ Given on staging, a commit with a new migration
77
+ And a development database
78
+ And a test database
78
79
  When I type "bard pull"
79
- Then both the development and test databases should include that migration
80
+ Then the development database should include that migration
81
+ And the test database should include that migration
80
82
 
81
83
  Scenario: Pulling in a change that includes a gem dependency change
82
- Given I dont have the test gem installed
83
- And the remote integration branch has had a commit that adds the test gem as a dependency
84
+ Given the test gem is not installed
85
+ And on staging, a commit that adds the test gem as a dependency
84
86
  When I type "bard pull"
85
87
  Then the test gem should be installed
86
88
 
87
89
  Scenario: Pulling in a change should restart the rails server
88
- Given the remote integration branch has had a commit since I last pulled
90
+ Given on staging, a commit
89
91
  When I type "bard pull"
90
92
  Then passenger should have been restarted
@@ -3,49 +3,51 @@ Feature: bard push
3
3
  Given a shared rails project
4
4
 
5
5
  Scenario: Uploading local changes onto the remote integration branch
6
- Given I have committed a set of changes to my local integration branch
6
+ Given a commit
7
7
  When I type "bard push"
8
8
  Then the "integration" branch should match the "origin/integration" branch
9
9
 
10
10
  Scenario: Pushing a change that includes a migration
11
- Given I have committed a set of changes that includes a new migration
12
- And the staging server has a staging and test environment set up
11
+ Given on staging, a staging database
12
+ And on staging, a test database
13
+ And a commit with a new migration
13
14
  When I type "bard push"
14
- Then the both the staging and test databases should include that migration
15
+ Then on staging, the staging database should include that migration
16
+ And on staging, the test database should include that migration
15
17
 
16
18
  Scenario: Pushing a change that includes a gem dependency change
17
- Given I dont have the test gem installed
18
- And I have committed a set of changes that adds the test gem as a dependency
19
+ Given the test gem is not installed
20
+ And a commit that adds the test gem as a dependency
19
21
  When I type "bard push"
20
- Then the test gem should be installed
22
+ Then on staging, the test gem should be installed
21
23
 
22
24
  Scenario: Pushing a change should advance the staging HEAD and restart the staging rails server
23
- Given I have committed a set of changes to my local integration branch
25
+ Given a commit
24
26
  When I type "bard push"
25
- Then the remote directory should not be dirty
26
- And the staging passenger should have been restarted
27
+ Then on staging, the directory should not be dirty
28
+ And on staging, passenger should have been restarted
27
29
 
28
30
  Scenario: Pushing a change that includes a submodule addition
29
- Given I have committed a set of changes that includes a new submodule
31
+ Given a commit with a new submodule
30
32
  When I type "bard push"
31
- Then there should be one new submodule on the remote
33
+ Then on staging, there should be one new submodule
32
34
  And the submodule branch should match the submodule origin branch
33
- Then the remote submodule working directory should be clean
35
+ And on staging, the submodule working directory should be clean
34
36
 
35
37
  Scenario: Pushing a change that includes a submodule update
36
38
  Given a submodule
37
- And I have committed a set of changes that includes a submodule update
39
+ And a commit with a submodule update
38
40
  When I type "bard push"
39
41
  Then the submodule branch should match the submodule origin branch
40
- Then the remote submodule working directory should be clean
42
+ Then on staging, the submodule working directory should be clean
41
43
 
42
44
  Scenario: Pushing a change that includes a submodule url change
43
45
  Given a submodule
44
- And I have committed a set of changes that includes a submodule url change
46
+ And a commit with a submodule url change
45
47
  When I type "bard push"
46
- Then the remote submodule url should be changed
48
+ Then on staging, the submodule url should be changed
47
49
  And the submodule branch should match the submodule origin branch
48
- Then the remote submodule working directory should be clean
50
+ Then on staging, the submodule working directory should be clean
49
51
 
50
52
  # TODO
51
53
  #Scenario: Pushing a change that includes a submodule deletion
@@ -60,29 +62,29 @@ Feature: bard push
60
62
  Then I should see the fatal error "root directory"
61
63
 
62
64
  Scenario: Trying to bard push when not on the integration branch
63
- Given I have committed a set of changes to my local integration branch
65
+ Given a commit
64
66
  And I am on a non-integration branch
65
67
  When I type "bard push"
66
68
  Then I should see the fatal error "not on the integration branch"
67
69
  And the "integration" branch should not match the "origin/integration" branch
68
70
 
69
71
  Scenario: Trying to bard push with a dirty working directory
70
- Given I have committed a set of changes to my local integration branch
72
+ Given a commit
71
73
  And a dirty working directory
72
74
  When I type "bard push"
73
75
  Then I should see the fatal error "You have uncommitted changes!"
74
76
  And the "integration" branch should not match the "origin/integration" branch
75
77
 
76
78
  Scenario: Trying to bard push with a non-fast-foward changeset
77
- Given I have committed a set of changes to my local integration branch
78
- And the remote integration branch has had a commit since I last pulled
79
+ Given a commit
80
+ And on staging, a commit
79
81
  When I type "bard push"
80
82
  Then I should see the fatal error "Someone has pushed some changes"
81
83
  And the "integration" branch should not match the "origin/integration" branch
82
84
 
83
85
  Scenario: Trying to bard push with an uncommitted change to a submodule
84
86
  Given a submodule
85
- And I have committed a set of changes to my local integration branch
87
+ And a commit
86
88
  And the submodule working directory is dirty
87
89
  When I type "bard push"
88
90
  Then I should see the fatal error "Micah"
@@ -90,8 +92,8 @@ Feature: bard push
90
92
 
91
93
  Scenario: Trying to bard push with a committed but unpushed change to a submodule
92
94
  Given a submodule
93
- And I have committed a set of changes to the submodule
94
- And I have committed a set of changes to my local integration branch
95
+ And a commit to the submodule
96
+ And a commit
95
97
  When I type "bard push"
96
98
  Then I should see the fatal error "Micah"
97
99
  And the "integration" branch should not match the "origin/integration" branch
@@ -5,7 +5,7 @@ end
5
5
 
6
6
  Then /^I should see the current version of git$/ do
7
7
  version = `git --version`[/[0-9]+\.[0-9]+\.[0-9]+/]
8
- @stdout.should =~ /git\s+\(#{Regexp.escape(version)}\)/
8
+ @stdout.should =~ /git\s+\(#{Regexp.escape(version)}/
9
9
  end
10
10
 
11
11
  Then /^I should see the current version of rubygems$/ do
@@ -11,14 +11,6 @@ Given /^there is no integration branch$/ do
11
11
  type "git branch -d integration"
12
12
  end
13
13
 
14
- Given /^there is no integration branch on the staging server$/ do
15
- type "git branch -d origin/integration"
16
- Dir.chdir "#{ROOT}/tmp/origin" do
17
- type "git checkout master"
18
- type "git branch -d integration"
19
- end
20
- end
21
-
22
14
  Given /^the integration branch isnt tracking origin\/integration$/ do
23
15
  type "git checkout master"
24
16
  type "git branch -d integration"
@@ -29,41 +21,26 @@ Given /^a dirty working directory$/ do
29
21
  File.open("dirty_file", "w") { |f| f.puts "dirty dirty" }
30
22
  end
31
23
 
32
- Given /^I have committed a set of changes to my local integration branch$/ do
33
- type "echo 'fuck shit' > fuck_file"
24
+ Given /^a commit$/ do
25
+ text = (rand * 100000000).round
26
+ type "echo '#{text}' > foobar_#{text}_file"
34
27
  type "git add ."
35
- type "git commit -am'test commit to local integration branch.'"
36
- end
37
-
38
- Given /^the remote master branch has had a commit since I last pulled$/ do
39
- Dir.chdir "#{ROOT}/tmp/origin" do
40
- type "git checkout master"
41
- type "echo 'zomg' > origin_master_change_file"
42
- type "git add ."
43
- type "git commit -am 'testing origin master change'"
44
- type "git checkout integration"
45
- end
28
+ type "git commit -am'test commit'"
46
29
  end
47
30
 
48
- Given /^the remote integration branch has had a commit since I last pulled$/ do
49
- Dir.chdir "#{ROOT}/tmp/origin" do
50
- type "git checkout integration"
51
- type "echo 'zomg' > origin_change_file"
52
- type "git add ."
53
- type "git commit -am 'testing origin change'"
54
- end
31
+ Given /^a commit to the master branch$/ do
32
+ text = (rand * 100000000).round
33
+ type "git checkout master"
34
+ type "echo '#{text}' > master_#{text}_file"
35
+ type "git add ."
36
+ type "git commit -am 'testing master change'"
37
+ type "git checkout integration"
55
38
  end
56
39
 
57
40
  Then /^the directory should not be dirty$/ do
58
41
  type("git status").should include "working directory clean"
59
42
  end
60
43
 
61
- Then /^the remote directory should not be dirty$/ do
62
- Dir.chdir "#{ROOT}/tmp/origin" do
63
- type("git status").should include "working directory clean"
64
- end
65
- end
66
-
67
44
  Then /^I should be on the "([^\"]*)" branch$/ do |branch|
68
45
  @repo.head.name.should == branch
69
46
  end
@@ -1,36 +1,19 @@
1
1
  Given /^a shared rails project$/ do
2
2
  # TEARDOWN
3
- Dir.chdir ROOT
4
- type "rm -rf tmp"
3
+ Dir.foreach "#{ROOT}/tmp" do |file|
4
+ FileUtils.rm_rf("#{ROOT}/tmp/#{file}") unless %w(fixtures . ..).include? file
5
+ end
5
6
 
6
7
  # SETUP
7
8
  Dir.chdir ROOT
8
- Dir.mkdir 'tmp'
9
- type "cp -R fixtures/repo tmp/origin"
10
- Dir.chdir 'tmp/origin' do
11
- type "git config receive.denyCurrentBranch ignore"
12
- File.open ".git/hooks/post-receive", "w" do |f|
13
- f.puts <<-BASH
14
- #!/bin/bash
15
- RAILS_ENV=staging #{ROOT}/bin/bard stage $@
16
- BASH
17
- f.chmod 0775
18
- end
19
- type "cp config/database.sample.yml config/database.yml"
20
- type "git checkout -b integration"
21
- end
22
- type "cp -R fixtures/repo tmp/submodule"
23
- type "cp -R fixtures/repo tmp/submodule2"
24
- type "git clone tmp/origin tmp/local"
9
+ `cp -r tmp/fixtures/* tmp/`
25
10
  Dir.chdir 'tmp/local'
26
11
  @repo = Grit::Repo.new "."
27
- type "grb fetch integration"
28
- type "git checkout integration"
29
- type "cp config/database.sample.yml config/database.yml"
12
+
30
13
  end
31
14
 
32
15
  Given /^I am in a subdirectory$/ do
33
- type "mkdir test_subdirectory"
16
+ FileUtils.mkdir "test_subdirectory"
34
17
  Dir.chdir "test_subdirectory"
35
18
  end
36
19
 
@@ -38,9 +21,9 @@ When /^I type "([^\"]*)"$/ do |command|
38
21
  type command.sub /\b(bard)\b/, "#{ROOT}/bin/bard"
39
22
  end
40
23
 
41
- When /^I type "([^\"]*)" on the staging server$/ do |command|
24
+ When /^on staging, (.*$)/ do |step|
42
25
  Dir.chdir "#{ROOT}/tmp/origin" do
43
- When %(I type "#{command}")
26
+ When step
44
27
  end
45
28
  end
46
29
 
@@ -1,92 +1,30 @@
1
- Given /^I have committed a set of changes that includes a new migration$/ do
2
- Dir.chdir "#{ROOT}/tmp/local" do
3
- type "script/generate migration test_migration"
4
- type "git add ."
5
- type "git commit -am'added test migration.'"
6
- end
1
+ Given /^a commit with a new migration$/ do
2
+ type "script/generate migration test_migration"
3
+ type "git add ."
4
+ type "git commit -am'added test migration.'"
7
5
  end
8
6
 
9
- Given /^the remote integration branch has had a commit that includes a new migration$/ do
10
- Dir.chdir "#{ROOT}/tmp/origin" do
11
- type "script/generate migration test_migration"
12
- type "git add ."
13
- type "git commit -am'added test migration.'"
14
- end
7
+ Given /^a (\w+) database$/ do |env|
8
+ type "rake db:create RAILS_ENV=#{env} && rake db:migrate RAILS_ENV=#{env}"
15
9
  end
16
10
 
17
- Given /^I have a development environment set up locally$/ do
18
- Dir.chdir "#{ROOT}/tmp/local" do
19
- type "rake db:create"
20
- type "rake db:migrate"
21
- end
11
+ Then /^the (\w+) database should include that migration$/ do |env|
12
+ db_version = type("rake db:version RAILS_ENV=#{env}")[/[0-9]{14}/]
13
+ migration_version = type("ls db/migrate/*_test_migration.rb")[/[0-9]{14}/]
14
+ db_version.should == migration_version
22
15
  end
23
16
 
24
- Given /^the staging server has a staging and test environment set up$/ do
25
- Dir.chdir "#{ROOT}/tmp/origin" do
26
- type "rake db:create RAILS_ENV=staging && rake db:create RAILS_ENV=test"
27
- type "rake db:migrate RAILS_ENV=staging && rake db:migrate RAILS_ENV=test"
28
- end
29
- end
30
-
31
- Given /^I have development and test environments set up locally$/ do
32
- Dir.chdir "#{ROOT}/tmp/local" do
33
- type "rake db:create && rake db:create RAILS_ENV=test"
34
- type "rake db:migrate && rake db:migrate RAILS_ENV=test"
35
- end
36
- end
37
-
38
- Then /^the development database should include that migration$/ do
39
- Dir.chdir "#{ROOT}/tmp/local" do
40
- db_version = type("rake db:version")[/[0-9]{14}/]
41
- test_migration_version = type("ls db/migrate/*_test_migration.rb")[/[0-9]{14}/]
42
- db_version.should == test_migration_version
43
- end
44
- end
45
-
46
- Then /^the both the staging and test databases should include that migration$/ do
47
- Dir.chdir "#{ROOT}/tmp/origin" do
48
- staging_db_version = type("rake db:version RAILS_ENV=staging")[/[0-9]{14}/]
49
- test_db_version = type("rake db:version RAILS_ENV=test")[/[0-9]{14}/]
50
- test_migration_version = type("ls db/migrate/*_test_migration.rb")[/[0-9]{14}/]
51
- staging_db_version.should == test_migration_version
52
- test_db_version.should == test_migration_version
53
- end
54
- end
55
-
56
- Then /^both the development and test databases should include that migration$/ do
57
- Dir.chdir "#{ROOT}/tmp/local" do
58
- dev_db_version = type("rake db:version")[/[0-9]{14}/]
59
- test_db_version = type("rake db:version RAILS_ENV=test")[/[0-9]{14}/]
60
- test_migration_version = type("ls db/migrate/*_test_migration.rb")[/[0-9]{14}/]
61
- dev_db_version.should == test_migration_version
62
- test_db_version.should == test_migration_version
63
- end
64
- end
65
-
66
- Given /^I dont have the test gem installed$/ do
17
+ Given /^the test gem is not installed$/ do
67
18
  type "gem uninstall rake-dotnet -v=0.0.1 -x"
68
19
  end
69
20
 
70
- Given /^I have committed a set of changes that adds the test gem as a dependency$/ do
71
- Dir.chdir "#{ROOT}/tmp/local" do
72
- file_inject "config/environment.rb", "
73
- Rails::Initializer.run do |config|", <<-RUBY
74
- config.gem "rake-dotnet", :version => "0.0.1"
75
- RUBY
76
- type "git add ."
77
- type "git commit -am'added test gem dependency.'"
78
- end
79
- end
80
-
81
- Given /^the remote integration branch has had a commit that adds the test gem as a dependency$/ do
82
- Dir.chdir "#{ROOT}/tmp/origin" do
83
- file_inject "config/environment.rb", "
21
+ Given /^a commit that adds the test gem as a dependency$/ do
22
+ file_inject "config/environment.rb", "
84
23
  Rails::Initializer.run do |config|", <<-RUBY
85
24
  config.gem "rake-dotnet", :version => "0.0.1"
86
25
  RUBY
87
- type "git add ."
88
- type "git commit -am'added test gem dependency.'"
89
- end
26
+ type "git add ."
27
+ type "git commit -am'added test gem dependency.'"
90
28
  end
91
29
 
92
30
  Then /^the test gem should be installed$/ do
@@ -96,9 +34,3 @@ end
96
34
  Then /^passenger should have been restarted$/ do
97
35
  File.exist?("tmp/restart.txt").should be_true
98
36
  end
99
-
100
- Then /^the staging passenger should have been restarted$/ do
101
- Dir.chdir "#{ROOT}/tmp/origin" do
102
- File.exist?("tmp/restart.txt").should be_true
103
- end
104
- end
@@ -1,44 +1,32 @@
1
1
  Given /^a submodule$/ do
2
- Given 'the remote integration branch has had a commit that includes a new submodule'
3
- Dir.chdir "#{ROOT}/tmp/local" do
4
- type "git checkout integration"
5
- type "git pull --rebase"
6
- type "git submodule init"
7
- type "git submodule update"
8
- Dir.chdir "submodule" do
9
- type "git checkout master"
10
- end
11
- @submodule_url = File.read(".gitmodules").match(/url = (.*)$/)[1]
12
- @submodule_commit = type "git submodule status"
2
+ Given 'on staging, a commit with a new submodule'
3
+ type "git checkout integration"
4
+ type "git pull --rebase"
5
+ type "git submodule init"
6
+ type "git submodule update"
7
+ Dir.chdir "submodule" do
8
+ type "git checkout master"
13
9
  end
10
+ @submodule_url = File.read(".gitmodules").match(/url = (.*)$/)[1]
11
+ @submodule_commit = type "git submodule status"
14
12
  end
15
13
 
16
14
  Given /^the submodule working directory is dirty$/ do
17
- Dir.chdir "#{ROOT}/tmp/local/submodule" do
15
+ Dir.chdir "submodule" do
18
16
  type "git checkout master"
19
17
  type "echo 'submodule_update' > submodule_update"
20
18
  end
21
19
  end
22
20
 
23
- Given /^I have committed a set of changes to the submodule$/ do
24
- Dir.chdir "#{ROOT}/tmp/local/submodule" do
21
+ Given /^a commit to the submodule$/ do
22
+ Dir.chdir "submodule" do
25
23
  type "echo 'submodule_update' > submodule_update"
26
24
  type "git add ."
27
25
  type "git commit -am 'update in submodule'"
28
26
  end
29
27
  end
30
28
 
31
- Given /^the remote integration branch has had a commit that includes a new submodule$/ do
32
- Dir.chdir "#{ROOT}/tmp/origin" do
33
- type "git submodule add #{ROOT}/tmp/submodule submodule"
34
- type "git submodule init"
35
- type "git submodule update"
36
- type "git add ."
37
- type "git commit -m 'added submodule'"
38
- end
39
- end
40
-
41
- Given /^I have committed a set of changes that includes a new submodule$/ do
29
+ Given /^a commit with a new submodule$/ do
42
30
  type "git submodule add #{ROOT}/tmp/submodule submodule"
43
31
  type "git submodule init"
44
32
  type "git submodule update --merge"
@@ -49,7 +37,7 @@ Given /^I have committed a set of changes that includes a new submodule$/ do
49
37
  type "git commit -m 'added submodule'"
50
38
  end
51
39
 
52
- Given /^I have committed a set of changes that includes a submodule update$/ do
40
+ Given /^a commit with a submodule update$/ do
53
41
  type "git checkout integration"
54
42
  Dir.chdir "submodule" do
55
43
  type "git checkout master"
@@ -62,62 +50,24 @@ Given /^I have committed a set of changes that includes a submodule update$/ do
62
50
  type "git commit -m 'updated submodule'"
63
51
  end
64
52
 
65
- Given /^the remote integration branch has had a commit that includes a submodule update$/ do
66
- Dir.chdir "#{ROOT}/tmp/origin" do
67
- Dir.chdir "submodule" do
68
- type "git checkout master"
69
- type "echo 'submodule_update' > submodule_update"
70
- type "git add ."
71
- type "git commit -m 'update in submodule'"
72
- type "git push origin HEAD"
73
- end
74
- type "git add ."
75
- type "git commit -m 'updated submodule'"
76
- end
77
- end
78
-
79
- Given /^I have committed a set of changes that includes a submodule url change$/ do
53
+ Given /^a commit with a submodule url change$/ do
80
54
  gsub_file ".gitmodules", /(url = .*submodule)$/ do |match| "#{match}2" end
81
55
  type "git add ."
82
56
  type "git commit -m 'updated submodule url'"
83
57
  end
84
58
 
85
- Given /^the remote integration branch has had a commit that includes a submodule url change$/ do
86
- Dir.chdir "#{ROOT}/tmp/origin" do
87
- gsub_file ".gitmodules", /(url = .*submodule)$/ do |match| "#{match}2" end
88
- type "git add ."
89
- type "git commit -m 'updated submodule url'"
90
- end
91
- end
92
-
93
- Given /^I have committed a set of changes that includes a submodule deletion$/ do
59
+ Given /^I a commit a with a submodule deletion$/ do
94
60
  type "rm .gitmodules"
95
61
  type "rm -rf --cached submodule"
96
62
  type "git add ."
97
63
  type "git commit -am'removed submodule'"
98
64
  end
99
65
 
100
- Given /^the remote integration branch has had a commit that includes a submodule deletion$/ do
101
- Dir.chdir "#{ROOT}/tmp/origin" do
102
- type "rm .gitmodules"
103
- type "rm -rf --cached submodule"
104
- type "git add ."
105
- type "git commit -am'removed submodule'"
106
- end
107
- end
108
-
109
66
  Then /^there should be one new submodule$/ do
110
67
  status = type "git submodule status"
111
68
  status.should match /.[a-z0-9]{40} submodule/
112
69
  end
113
70
 
114
- Then /^there should be one new submodule on the remote$/ do
115
- Dir.chdir "#{ROOT}/tmp/origin" do
116
- status = type "git submodule status"
117
- status.should match /.[a-z0-9]{40} submodule/
118
- end
119
- end
120
-
121
71
  Then /^the submodule branch should match the submodule origin branch$/ do
122
72
  @submodule_url = File.read(".gitmodules").match(/url = (.*)$/)[1]
123
73
  @submodule_commit = type "git submodule status"
@@ -134,24 +84,16 @@ Then /^the submodule branch should match the submodule origin branch$/ do
134
84
  end
135
85
  end
136
86
 
137
- Then /^the remote submodule should be checked out$/ do
138
- Dir.chdir "#{ROOT}/tmp/origin" do
139
- @submodule_url = File.read(".gitmodules").match(/url = (.*)$/)[1]
140
- @submodule_commit = type "git submodule status"
141
- @submodule_commit.should match %r( [a-z0-9]{40} submodule)
142
- end
87
+ Then /^the submodule should be checked out$/ do
88
+ @submodule_url = File.read(".gitmodules").match(/url = (.*)$/)[1]
89
+ @submodule_commit = type "git submodule status"
90
+ @submodule_commit.should match %r( [a-z0-9]{40} submodule)
143
91
  end
144
92
 
145
93
  Then /^the submodule should be updated$/ do
146
94
  @submodule_commit[/[a-z0-9]{40}/].should_not == type("git submodule status")[/[a-z0-9]{40}/]
147
95
  end
148
96
 
149
- Then /^the remote submodule should be updated$/ do
150
- Dir.chdir "#{ROOT}/tmp/origin" do
151
- @submodule_commit[/[a-z0-9]{40}/].should_not == type("git submodule status")[/[a-z0-9]{40}/]
152
- end
153
- end
154
-
155
97
  Then /^the submodule url should be changed$/ do
156
98
  Dir.chdir "submodule" do
157
99
  remote = type "git remote show origin"
@@ -160,14 +102,6 @@ Then /^the submodule url should be changed$/ do
160
102
  end
161
103
  end
162
104
 
163
- Then /^the remote submodule url should be changed$/ do
164
- Dir.chdir "#{ROOT}/tmp/origin/submodule" do
165
- remote = type "git remote show origin"
166
- remote.should_not match %r(Fetch URL: #{@submodule_url}$)
167
- remote.should_not match %r(Push URL: #{@submodule_url}$)
168
- end
169
- end
170
-
171
105
  Then /^the submodule should be deleted$/ do
172
106
  Then 'the directory should not be dirty'
173
107
  @submodule_commit = type "git submodule status"
@@ -175,22 +109,8 @@ Then /^the submodule should be deleted$/ do
175
109
 
176
110
  end
177
111
 
178
- Then /^the remote submodule should be deleted$/ do
179
- Then 'the remote directory should not be dirty'
180
- Dir.chdir "#{ROOT}/tmp/origin" do
181
- @submodule_commit = type "git submodule status"
182
- @submodule_commit.should_not match /.[a-z0-9]{40} submodule/
183
- end
184
- end
185
-
186
112
  Then /^the submodule working directory should be clean$/ do
187
113
  Dir.chdir "submodule" do
188
114
  type("git status").should include "working directory clean"
189
115
  end
190
116
  end
191
-
192
- Then /^the remote submodule working directory should be clean$/ do
193
- Dir.chdir "#{ROOT}/tmp/origin/submodule" do
194
- type("git status").should include "working directory clean"
195
- end
196
- end
@@ -3,7 +3,36 @@ require 'ruby-debug'
3
3
  require 'grit'
4
4
  require 'spec/expectations'
5
5
  require 'systemu'
6
+ gem 'sqlite3-ruby'
6
7
 
7
8
  ENV["PATH"] += ":#{File.dirname(File.expand_path(__FILE__))}/../../bin"
8
9
 
9
10
  ROOT = File.expand_path(File.dirname(__FILE__) + '/../..')
11
+
12
+ # setup fixtures
13
+ FileUtils.rm_rf "tmp"
14
+ FileUtils.mkdir "tmp"
15
+ FileUtils.cp_r "fixtures/repo", "tmp/origin"
16
+ Dir.chdir 'tmp/origin' do
17
+ `git config receive.denyCurrentBranch ignore`
18
+ File.open ".git/hooks/post-receive", "w" do |f|
19
+ f.puts <<-BASH
20
+ #!/bin/bash
21
+ RAILS_ENV=staging #{ROOT}/bin/bard stage $@
22
+ BASH
23
+ f.chmod 0775
24
+ end
25
+ FileUtils.cp "config/database.sample.yml", "config/database.yml"
26
+ `git checkout -b integration`
27
+ end
28
+ FileUtils.cp_r "fixtures/repo", "tmp/submodule"
29
+ FileUtils.cp_r "fixtures/repo", "tmp/submodule2"
30
+ `git clone tmp/origin tmp/local`
31
+ Dir.chdir 'tmp/local' do
32
+ `grb fetch integration && git checkout integration`
33
+ FileUtils.cp "config/database.sample.yml", "config/database.yml"
34
+ end
35
+ FileUtils.mkdir "tmp/fixtures"
36
+ Dir.foreach "tmp" do |file|
37
+ FileUtils.mv("tmp/#{file}", "tmp/fixtures/") unless %w(fixtures . ..).include? file
38
+ end
@@ -2,7 +2,7 @@ class Bard < Thor
2
2
  private
3
3
  def check_dependencies
4
4
  required = {
5
- 'bard' => Net::HTTP.get(URI.parse("http://gemcutter.org/gems/bard.json")).match(/"version":"([0-9.]+)"/)[1],
5
+ 'bard' => Net::HTTP.get(URI.parse("http://gemcutter.org/api/v1/gems/bard.json")).match(/"version":"([0-9.]+)"/)[1],
6
6
  'git' => '1.6.4',
7
7
  'rubygems' => '1.3.4',
8
8
  'ruby' => '1.8.6'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.9
4
+ version: 0.6.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Micah Geisel
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-11-05 00:00:00 -08:00
13
+ date: 2009-12-08 00:00:00 -08:00
14
14
  default_executable: bard
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -43,16 +43,6 @@ dependencies:
43
43
  - !ruby/object:Gem::Version
44
44
  version: "0"
45
45
  version:
46
- - !ruby/object:Gem::Dependency
47
- name: rubygems-update
48
- type: :runtime
49
- version_requirement:
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: 1.3.2
55
- version:
56
46
  - !ruby/object:Gem::Dependency
57
47
  name: thor
58
48
  type: :runtime
@@ -69,7 +59,7 @@ dependencies:
69
59
  version_requirement:
70
60
  version_requirements: !ruby/object:Gem::Requirement
71
61
  requirements:
72
- - - ">="
62
+ - - "="
73
63
  - !ruby/object:Gem::Version
74
64
  version: 1.1.1
75
65
  version:
@@ -165,10 +155,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
165
155
  requirements: []
166
156
 
167
157
  rubyforge_project:
168
- rubygems_version: 1.3.4
158
+ rubygems_version: 1.3.5
169
159
  signing_key:
170
160
  specification_version: 3
171
161
  summary: Tools for collaborating with Bot and Rose Design.
172
162
  test_files:
173
- - spec/spec_helper.rb
174
163
  - spec/bard_spec.rb
164
+ - spec/spec_helper.rb