bundler-auto-update 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -2,3 +2,7 @@ source "http://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in bundler-auto-update.gemspec
4
4
  gemspec
5
+
6
+ group :development do
7
+ gem 'rake'
8
+ end
data/Rakefile CHANGED
@@ -1 +1,13 @@
1
1
  require 'bundler/gem_tasks'
2
+
3
+ desc "Run specs"
4
+ task :spec do
5
+ raise unless system 'bundle exec rspec spec'
6
+ end
7
+
8
+ desc "Run cucumber"
9
+ task :cucumber do
10
+ raise unless system 'bundle exec cucumber features'
11
+ end
12
+
13
+ task :default => [:spec, :cucumber]
@@ -4,7 +4,7 @@ Feature: Auto update Gemfile
4
4
  In order to keep my application up to date
5
5
  I want Bundler AutoUpdate to attempt to update every single gem of my Gemfile
6
6
 
7
- Scenario: Auto Update
7
+ Background:
8
8
  Given a file named "Gemfile" with:
9
9
  """
10
10
  source "http://rubygems.org"
@@ -15,6 +15,8 @@ Feature: Auto update Gemfile
15
15
  Then the output should contain "dmg (0.0.2) "
16
16
  Then the output should contain "complete!"
17
17
 
18
+
19
+ Scenario: Auto Update
18
20
  When I run `bundle-auto-update`
19
21
  Then the output should contain:
20
22
  """
@@ -29,16 +31,6 @@ Feature: Auto update Gemfile
29
31
  """
30
32
 
31
33
  Scenario: Auto Update with custom command
32
- Given a file named "Gemfile" with:
33
- """
34
- source "http://rubygems.org"
35
-
36
- gem 'dmg', '0.0.2'
37
- """
38
- When I run `bundle install`
39
- Then the output should contain "dmg (0.0.2) "
40
- Then the output should contain "complete!"
41
-
42
34
  When I run `git init`
43
35
  When I run `git add .`
44
36
  When I run `git commit -a -m "Initial Commit"`
@@ -66,14 +66,16 @@ module Bundler
66
66
 
67
67
  gem.version = new_version
68
68
 
69
- gemfile.update_gem(gem)
70
-
71
- if run_test_suite
69
+ if gemfile.update_gem(gem) && run_test_suite
72
70
  Logger.log_indent "Test suite ran successfully. Committing changes."
73
71
  commit_new_version
72
+
73
+ true
74
74
  else
75
75
  Logger.log_indent "Test suite failed to run. Reverting changes."
76
76
  revert_to_previous_version
77
+
78
+ false
77
79
  end
78
80
  end
79
81
 
@@ -87,6 +89,7 @@ module Bundler
87
89
 
88
90
  def revert_to_previous_version
89
91
  run_cmd "git checkout Gemfile Gemfile.lock"
92
+ gemfile.reload!
90
93
  end
91
94
 
92
95
  def run_test_suite
@@ -94,8 +97,6 @@ module Bundler
94
97
  end
95
98
 
96
99
  def run_cmd(cmd)
97
- Logger.log cmd
98
-
99
100
  CommandRunner.system(cmd)
100
101
  end
101
102
  end # class Updater
@@ -129,6 +130,10 @@ module Bundler
129
130
  @content ||= read
130
131
  end
131
132
 
133
+ def reload!
134
+ @content = read
135
+ end
136
+
132
137
  private
133
138
 
134
139
  def update_content(gem)
@@ -155,7 +160,7 @@ module Bundler
155
160
  end
156
161
 
157
162
  def run_bundle_update(gem)
158
- CommandRunner.system("bundle install")
163
+ CommandRunner.system("bundle install") or CommandRunner.system("bundle update #{gem.name}")
159
164
  end
160
165
  end # class Gemfile
161
166
 
@@ -196,16 +201,19 @@ module Bundler
196
201
  end
197
202
 
198
203
  def gem_remote_list_output
199
- CommandRunner.run "gem list #{name} -r"
204
+ CommandRunner.run "gem list #{name} -r -a"
200
205
  end
201
206
  end # class Dependency
202
207
 
203
208
  class CommandRunner
204
209
  def self.system(cmd)
210
+ Logger.log cmd
205
211
  Kernel.system cmd
206
212
  end
207
213
 
208
214
  def self.run(cmd)
215
+ Logger.log cmd
216
+
209
217
  `#{cmd}`
210
218
  end
211
219
  end
@@ -1,5 +1,5 @@
1
1
  module Bundler
2
2
  module AutoUpdate
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
@@ -67,8 +67,8 @@ EOF
67
67
  gemfile.update_gem(Dependency.new('rails', '3.1.0'))
68
68
  end
69
69
 
70
- it "should run 'bundle update' against the gem" do
71
- CommandRunner.should_receive(:system).with("bundle update rails")
70
+ it "should run 'bundle install' against the gem" do
71
+ CommandRunner.should_receive(:system).with("bundle install")
72
72
 
73
73
  gemfile.update_gem(Dependency.new('rails', '3.1.0'))
74
74
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bundler-auto-update
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Philippe Creux