bard 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.1
1
+ 0.6.2
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{bard}
8
- s.version = "0.6.1"
8
+ s.version = "0.6.2"
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-10-06}
12
+ s.date = %q{2009-10-07}
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}
@@ -63,6 +63,12 @@ Feature: Bard can check its environment for missing dependencies and potential p
63
63
  When I type "bard check ."
64
64
  Then I should see the fatal error "missing integration branch"
65
65
 
66
+ Scenario: Bard check detects non-tracking integration branch
67
+ Given a shared rails project
68
+ And the integration branch isnt tracking origin/integration
69
+ When I type "bard check ."
70
+ Then I should see the fatal error "tracking"
71
+
66
72
  Scenario: Bard check detects missing RAILS_ENV environment variable
67
73
  Given a shared rails project
68
74
  And my "RAILS_ENV" environment variable is ""
@@ -13,6 +13,7 @@ Feature: bard pull
13
13
  Then the "integration" branch should match the "origin/integration" branch
14
14
  And there should be one new submodule
15
15
  And the submodule branch should match the submodule origin branch
16
+ And the submodule working directory should be clean
16
17
 
17
18
  Scenario: Pulling down when the latest changes include a submodule update
18
19
  Given a submodule
@@ -20,6 +21,7 @@ Feature: bard pull
20
21
  When I type "bard pull"
21
22
  Then the "integration" branch should match the "origin/integration" branch
22
23
  And the submodule branch should match the submodule origin branch
24
+ And the submodule working directory should be clean
23
25
 
24
26
  Scenario: Pulling down when the latest changes include a submodule url change
25
27
  Given a submodule
@@ -28,6 +30,7 @@ Feature: bard pull
28
30
  Then the "integration" branch should match the "origin/integration" branch
29
31
  And the submodule url should be changed
30
32
  And the submodule branch should match the submodule origin branch
33
+ And the submodule working directory should be clean
31
34
 
32
35
  # TODO
33
36
  #Scenario: Pulling down when the latest changes include a submodule deletion
@@ -44,6 +47,11 @@ Feature: bard pull
44
47
  Then I should see the warning "Someone has pushed some changes"
45
48
  And the "integration" branch should be a fast-forward from the "origin/integration" branch
46
49
 
50
+ Scenario: Trying to bard pull when not in the project root
51
+ Given I am in a subdirectory
52
+ When I type "bard pull"
53
+ Then I should see the fatal error "root directory"
54
+
47
55
  Scenario: Trying to bard pull with a dirty working directory
48
56
  Given the remote integration branch has had a commit since I last pulled
49
57
  And a dirty working directory
@@ -30,12 +30,14 @@ Feature: bard push
30
30
  When I type "bard push"
31
31
  Then there should be one new submodule on the remote
32
32
  And the submodule branch should match the submodule origin branch
33
+ Then the remote submodule working directory should be clean
33
34
 
34
35
  Scenario: Pushing a change that includes a submodule update
35
36
  Given a submodule
36
37
  And I have committed a set of changes that includes a submodule update
37
38
  When I type "bard push"
38
39
  Then the submodule branch should match the submodule origin branch
40
+ Then the remote submodule working directory should be clean
39
41
 
40
42
  Scenario: Pushing a change that includes a submodule url change
41
43
  Given a submodule
@@ -43,6 +45,7 @@ Feature: bard push
43
45
  When I type "bard push"
44
46
  Then the remote submodule url should be changed
45
47
  And the submodule branch should match the submodule origin branch
48
+ Then the remote submodule working directory should be clean
46
49
 
47
50
  # TODO
48
51
  #Scenario: Pushing a change that includes a submodule deletion
@@ -51,6 +54,11 @@ Feature: bard push
51
54
  # When I type "bard push"
52
55
  # Then the remote submodule should be deleted
53
56
 
57
+ Scenario: Trying to bard push when not in the project root
58
+ Given I am in a subdirectory
59
+ When I type "bard push"
60
+ Then I should see the fatal error "root directory"
61
+
54
62
  Scenario: Trying to bard push when not on the integration branch
55
63
  Given I have committed a set of changes to my local integration branch
56
64
  And I am on a non-integration branch
@@ -19,6 +19,12 @@ Given /^there is no integration branch on the staging server$/ do
19
19
  end
20
20
  end
21
21
 
22
+ Given /^the integration branch isnt tracking origin\/integration$/ do
23
+ type "git checkout master"
24
+ type "git branch -d integration"
25
+ type "git checkout -b integration"
26
+ end
27
+
22
28
  Given /^a dirty working directory$/ do
23
29
  File.open("dirty_file", "w") { |f| f.puts "dirty dirty" }
24
30
  end
@@ -29,6 +29,11 @@ BASH
29
29
  type "cp config/database.sample.yml config/database.yml"
30
30
  end
31
31
 
32
+ Given /^I am in a subdirectory$/ do
33
+ type "mkdir test_subdirectory"
34
+ Dir.chdir "test_subdirectory"
35
+ end
36
+
32
37
  When /^I type "([^\"]*)"$/ do |command|
33
38
  type command.sub /\b(bard)\b/, "#{ROOT}/bin/bard"
34
39
  end
@@ -182,3 +182,15 @@ Then /^the remote submodule should be deleted$/ do
182
182
  @submodule_commit.should_not match /.[a-z0-9]{40} submodule/
183
183
  end
184
184
  end
185
+
186
+ Then /^the submodule working directory should be clean$/ do
187
+ Dir.chdir "submodule" do
188
+ type("git status").should include "working directory clean"
189
+ end
190
+ 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
@@ -49,6 +49,7 @@ class Bard < Thor
49
49
  def pull
50
50
  invoke :check
51
51
 
52
+ ensure_project_root!
52
53
  ensure_integration_branch!
53
54
  ensure_clean_working_directory!
54
55
 
@@ -69,7 +70,8 @@ class Bard < Thor
69
70
  run_crucial "git submodule sync"
70
71
  run_crucial "git submodule init"
71
72
  end
72
- run_crucial "git submodule update --rebase"
73
+ run_crucial "git submodule update --merge"
74
+ run_crucial "git submodule foreach 'git reset --hard'"
73
75
 
74
76
  if changed_files.any? { |f| f =~ %r(^config/environment.+) }
75
77
  run_crucial "rake gems:install"
@@ -82,6 +84,7 @@ class Bard < Thor
82
84
  def push
83
85
  invoke :check
84
86
 
87
+ ensure_project_root!
85
88
  ensure_integration_branch!
86
89
  ensure_clean_working_directory!
87
90
 
@@ -182,6 +185,7 @@ class Bard < Thor
182
185
  errors << "missing gems, please run `rake gems:install`" if `rake gems` =~ /\[ \]/
183
186
 
184
187
  errors << "missing integration branch, please complain to micah" if `git branch` !~ /\bintegration\b/
188
+ errors << "integration branch isnt tracking the remote integration branch, please run `grb track integration`" if `git config branch.integration.merge` !~ %r%\brefs/heads/integration\b%
185
189
  errors << "you shouldn't be working on the master branch, please work on the integration branch" if `cat .git/HEAD`.include? "refs/heads/master"
186
190
 
187
191
  if ENV['RAILS_ENV'] == "staging"
@@ -1,5 +1,9 @@
1
1
  module BardGit
2
2
  private
3
+ def ensure_project_root!
4
+ fatal "You are not in the project's root directory!" unless File.directory? ".git"
5
+ end
6
+
3
7
  def ensure_integration_branch!
4
8
  return if `git name-rev --name-only HEAD`.chomp == "integration"
5
9
  fatal "You are not on the integration branch! Type `git checkout integration` to switch to it. If you have made changes to your current branch, please see Micah for assistance."
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.1
4
+ version: 0.6.2
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-10-06 00:00:00 -07:00
13
+ date: 2009-10-07 00:00:00 -07:00
14
14
  default_executable: bard
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency