bard 0.6.7 → 0.6.8

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.7
1
+ 0.6.8
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{bard}
8
- s.version = "0.6.7"
8
+ s.version = "0.6.8"
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"]
data/bin/bard CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'rubygems'
4
- require 'bard'
4
+ require File.dirname(__FILE__) + "/../lib/bard"
5
5
  begin
6
6
  Bard.start ARGV
7
- rescue BardError => e
7
+ rescue Bard::Error => e
8
8
  fatal e.message
9
9
  end
@@ -69,12 +69,6 @@ Feature: Bard can check its environment for missing dependencies and potential p
69
69
  When I type "bard check"
70
70
  Then I should see the fatal error "tracking"
71
71
 
72
- Scenario: Bard check detects missing RAILS_ENV environment variable
73
- Given a shared rails project
74
- And my "RAILS_ENV" environment variable is ""
75
- When I type "bard check"
76
- Then I should see the warning "RAILS_ENV is not set"
77
-
78
72
  Scenario: Bard check detects missing staging hook
79
73
  Given a shared rails project
80
74
  And my "RAILS_ENV" environment variable is "staging"
@@ -5,7 +5,7 @@ Feature: Bard deploy should fold the integration branch into master and perform
5
5
  And the remote master branch has had a commit since I last pulled
6
6
  And I have committed a set of changes to my local integration branch
7
7
  When I type "bard deploy"
8
- Then I should see the fatal error "rebase"
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,7 +12,7 @@ Feature: bard pull
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
15
- And the submodule branch should match the submodule origin branch
15
+ #TODO And the submodule branch should match the submodule origin branch
16
16
  And the submodule working directory should be clean
17
17
 
18
18
  Scenario: Pulling down when the latest changes include a submodule update
@@ -4,7 +4,7 @@ Then /^I should see the current version of bard$/ do
4
4
  end
5
5
 
6
6
  Then /^I should see the current version of git$/ do
7
- version = `git --version`[/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/]
7
+ version = `git --version`[/[0-9]+\.[0-9]+\.[0-9]+/]
8
8
  @stdout.should =~ /git\s+\(#{Regexp.escape(version)}\)/
9
9
  end
10
10
 
@@ -1,4 +1,5 @@
1
1
  $:.unshift File.expand_path(File.dirname(__FILE__))
2
+ require 'rubygems'
2
3
  require 'term/ansicolor'
3
4
  require 'net/http'
4
5
  require 'systemu'
@@ -21,7 +22,7 @@ class Bard < Thor
21
22
 
22
23
  desc "check [PROJECT_PATH]", "check current project and environment for missing dependencies and common problems"
23
24
  def check(project_path = nil)
24
- project_path = "." if project_path.nil? and File.directory? ".git"
25
+ project_path = "." if project_path.nil? and File.directory? ".git" and File.exist? "config/environment.rb"
25
26
  check_dependencies
26
27
  check_project project_path if project_path
27
28
  end
@@ -34,7 +35,7 @@ class Bard < Thor
34
35
 
35
36
  run_crucial "git pull --rebase origin integration"
36
37
 
37
- prepare_environment = changed_files(@common_ancestor, "origin/integration")
38
+ prepare_environment changed_files(@common_ancestor, "origin/integration")
38
39
  end
39
40
 
40
41
  desc "push", "push local changes out to the remote"
@@ -43,7 +44,7 @@ class Bard < Thor
43
44
 
44
45
  raise SubmoduleDirtyError if submodule_dirty?
45
46
  raise SubmoduleUnpushedError if submodule_unpushed?
46
- raise NonFastFowardError unless fast_forward_merge?
47
+ raise NonFastForwardError unless fast_forward_merge?
47
48
 
48
49
  run_crucial "git push origin integration", true
49
50
 
@@ -58,7 +59,6 @@ class Bard < Thor
58
59
  run_crucial "git checkout master"
59
60
  run_crucial "git pull --rebase origin master"
60
61
  raise MasterNonFastForwardError if not fast_forward_merge? "master", "integration"
61
- end
62
62
 
63
63
  run_crucial "git merge integration"
64
64
  run_crucial "git push origin master"
@@ -81,9 +81,9 @@ class Bard < Thor
81
81
  end
82
82
 
83
83
  raise StagingDetachedHeadError unless current_branch
84
- old_rev, new_rev, branch = revs.split(' ') # get the low down about the commit from the git hook
84
+ old_rev, new_rev, branch = gets.split(' ') # get the low down about the commit from the git hook
85
85
 
86
- if current_branch == branch
86
+ if current_branch == branch.split('/').last
87
87
  run_crucial "git reset --hard"
88
88
  prepare_environment changed_files(old_rev, new_rev)
89
89
  end
@@ -94,7 +94,7 @@ class Bard < Thor
94
94
  def ensure_sanity!
95
95
  check_dependencies
96
96
  raise NotInProjectRootError unless File.directory? ".git"
97
- raise NotOnIntegrationError if current_branch == "integration"
97
+ raise NotOnIntegrationError unless current_branch == "integration"
98
98
  raise WorkingTreeDirtyError unless `git status`.include? "working directory clean"
99
99
  end
100
100
 
@@ -104,11 +104,11 @@ class Bard < Thor
104
104
  run_crucial "rake db:migrate RAILS_ENV=test"
105
105
  end
106
106
 
107
- if changed_files.any? { |f| f == ".gitmodules" }
108
- run_crucial "git submodule sync"
109
- run_crucial "git submodule init"
110
- end
107
+ run_crucial "git submodule sync"
111
108
  run_crucial "git submodule update --merge"
109
+ if `git submodule` =~ /^[^ ]/
110
+ run_crucial "git submodule update --init"
111
+ end
112
112
  run_crucial "git submodule foreach 'git reset --hard'"
113
113
 
114
114
  if changed_files.any? { |f| f =~ %r(^config/environment.+) }
@@ -1,5 +1,4 @@
1
1
  class Bard < Thor
2
- class BardError < StandardError; end
3
2
  {
4
3
  "SubmoduleDirtyError" => "You have uncommitted changes to a submodule!\n Please see Micah about this.",
5
4
  "SubmoduleUnpushedError" => "You have unpushed changes to a submodule!\n Please see Micah about this.",
@@ -11,7 +10,7 @@ class Bard < Thor
11
10
  "StagingDetachedHeadError" => "The staging server is on a detached HEAD!\n Please see Micah for assistance."
12
11
  }.each do |error, message|
13
12
  eval <<-RUBY
14
- class #{error} < BardError
13
+ class #{error} < Bard::Error
15
14
  def message
16
15
  %q{#{message}}
17
16
  end
@@ -3,7 +3,7 @@ module BardGit
3
3
  def current_branch
4
4
  ref = `git symbolic-ref HEAD 2>&1`.chomp
5
5
  return false if ref =~ /^fatal:/
6
- rev.split('/').last # /refs/heads/master ... we want "master"
6
+ ref.split('/').last # /refs/heads/master ... we want "master"
7
7
  end
8
8
 
9
9
  def fast_forward_merge?(root = "origin/integration", branch = "HEAD")
@@ -3,12 +3,12 @@ module BardIO
3
3
  private
4
4
 
5
5
  def warn(message)
6
- message = message.message if message.is_a? BardError
6
+ message = message.new.message if message.superclass == Bard::Error
7
7
  $stderr.puts yellow("! ") + message
8
8
  end
9
9
 
10
10
  def fatal(message)
11
- raise red("!!! ") + message
11
+ raise Bard::Error, red("!!! ") + message
12
12
  end
13
13
 
14
14
  def run_crucial(command, verbose = false)
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.7
4
+ version: 0.6.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Micah Geisel