bundler-auto-update 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +31 -0
- data/Gemfile +4 -0
- data/Rakefile +1 -0
- data/bin/bundle-auto-update +8 -0
- data/bundler-auto-update.gemspec +24 -0
- data/features/bundler_auto_update.feature +61 -0
- data/features/support/env.rb +8 -0
- data/lib/bundler_auto_update.rb +213 -0
- data/lib/bundler_auto_update/version.rb +5 -0
- data/spec/spec_helper.rb +14 -0
- data/spec/unit/cli_spec.rb +18 -0
- data/spec/unit/dependency_spec.rb +38 -0
- data/spec/unit/gem_updater_spec.rb +71 -0
- data/spec/unit/gemfile_spec.rb +76 -0
- metadata +124 -0
data/.gitignore
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
## MAC OS
|
2
|
+
.DS_Store
|
3
|
+
|
4
|
+
## TEXTMATE
|
5
|
+
*.tmproj
|
6
|
+
tmtags
|
7
|
+
|
8
|
+
## EMACS
|
9
|
+
*~
|
10
|
+
\#*
|
11
|
+
.\#*
|
12
|
+
|
13
|
+
## VIM
|
14
|
+
*.swp
|
15
|
+
|
16
|
+
## PROJECT::GENERAL
|
17
|
+
tags
|
18
|
+
coverage
|
19
|
+
rdoc
|
20
|
+
doc
|
21
|
+
.yardoc
|
22
|
+
pkg
|
23
|
+
|
24
|
+
## PROJECT::SPECIFIC
|
25
|
+
.bundle
|
26
|
+
Gemfile.lock
|
27
|
+
Gemfile-*.lock
|
28
|
+
.rvmrc
|
29
|
+
.rspec
|
30
|
+
aruba
|
31
|
+
tmp
|
data/Gemfile
ADDED
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "bundler_auto_update/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "bundler-auto-update"
|
7
|
+
s.version = Bundler::AutoUpdate::VERSION
|
8
|
+
s.authors = ["Philippe Creux"]
|
9
|
+
s.email = ["pcreux@gmail.com"]
|
10
|
+
s.homepage = ""
|
11
|
+
s.summary = %q{Auto update your Gemfile}
|
12
|
+
s.description = %q{Attempt to update every single gem of your Gemfile to its latest patch, minor then major release. Runs a test command to ensure the update succeeded}
|
13
|
+
|
14
|
+
s.default_executable = %q{bundle-auto-update}
|
15
|
+
|
16
|
+
s.add_development_dependency "rspec"
|
17
|
+
s.add_development_dependency "cucumber"
|
18
|
+
s.add_development_dependency "aruba", "0.4.6"
|
19
|
+
|
20
|
+
s.files = `git ls-files`.split("\n")
|
21
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
22
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
23
|
+
s.require_paths = ["lib"]
|
24
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
Feature: Auto update Gemfile
|
2
|
+
|
3
|
+
As a developer
|
4
|
+
In order to keep my application up to date
|
5
|
+
I want Bundler AutoUpdate to attempt to update every single gem of my Gemfile
|
6
|
+
|
7
|
+
Scenario: Auto Update
|
8
|
+
Given a file named "Gemfile" with:
|
9
|
+
"""
|
10
|
+
source "http://rubygems.org"
|
11
|
+
|
12
|
+
gem 'dmg', '0.0.2'
|
13
|
+
"""
|
14
|
+
When I run `bundle install`
|
15
|
+
Then the output should contain "dmg (0.0.2) "
|
16
|
+
Then the output should contain "complete!"
|
17
|
+
|
18
|
+
When I run `bundle-auto-update`
|
19
|
+
Then the output should contain:
|
20
|
+
"""
|
21
|
+
Updating dmg.
|
22
|
+
- Updating to patch version 0.0.4
|
23
|
+
"""
|
24
|
+
Then the output should contain:
|
25
|
+
"""
|
26
|
+
rake
|
27
|
+
- Test suite failed to run. Reverting changes.
|
28
|
+
git checkout Gemfile Gemfile.lock
|
29
|
+
"""
|
30
|
+
|
31
|
+
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
|
+
When I run `git init`
|
43
|
+
When I run `git add .`
|
44
|
+
When I run `git commit -a -m "Initial Commit"`
|
45
|
+
|
46
|
+
When I run `bundle-auto-update -c echo Hello`
|
47
|
+
Then the output should contain:
|
48
|
+
"""
|
49
|
+
Updating dmg.
|
50
|
+
- Updating to patch version 0.0.4
|
51
|
+
"""
|
52
|
+
Then the output should contain:
|
53
|
+
"""
|
54
|
+
echo Hello
|
55
|
+
Hello
|
56
|
+
- Test suite ran successfully. Committing changes.
|
57
|
+
git commit Gemfile Gemfile.lock -m 'Auto update dmg to version 0.0.4'
|
58
|
+
"""
|
59
|
+
When I run `git log`
|
60
|
+
Then the output should contain "Auto update dmg to version 0.0.4"
|
61
|
+
|
@@ -0,0 +1,213 @@
|
|
1
|
+
require "bundler_auto_update/version"
|
2
|
+
|
3
|
+
module Bundler
|
4
|
+
module AutoUpdate
|
5
|
+
class CLI
|
6
|
+
def initialize(argv)
|
7
|
+
@argv = argv
|
8
|
+
end
|
9
|
+
|
10
|
+
def run!
|
11
|
+
Updater.new(test_command).auto_update!
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_command
|
15
|
+
if @argv.first == '-c'
|
16
|
+
@argv[1..-1].join(' ')
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end # class CLI
|
20
|
+
|
21
|
+
class Updater
|
22
|
+
DEFAULT_TEST_COMMAND = "rake"
|
23
|
+
|
24
|
+
attr_reader :test_command
|
25
|
+
|
26
|
+
def initialize(test_command = nil)
|
27
|
+
@test_command = test_command || DEFAULT_TEST_COMMAND
|
28
|
+
end
|
29
|
+
|
30
|
+
def auto_update!
|
31
|
+
gemfile.gems.each do |gem|
|
32
|
+
GemUpdater.new(gem, gemfile, test_command).auto_update
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def gemfile
|
37
|
+
@gemfile ||= Gemfile.new
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
class GemUpdater
|
42
|
+
attr_reader :gem, :gemfile, :test_command
|
43
|
+
|
44
|
+
def initialize(gem, gemfile, test_command)
|
45
|
+
@gem, @gemfile, @test_command = gem, gemfile, test_command
|
46
|
+
end
|
47
|
+
|
48
|
+
def auto_update
|
49
|
+
if updatable?
|
50
|
+
Logger.log "Updating #{gem.name}."
|
51
|
+
update(:patch) and update(:minor) and update(:major)
|
52
|
+
else
|
53
|
+
Logger.log "#{gem.name} is not auto-updatable, passing it."
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def update(version_type)
|
58
|
+
new_version = gem.last_version(version_type)
|
59
|
+
|
60
|
+
if new_version == gem.version
|
61
|
+
Logger.log_indent "Current gem already at latest #{version_type} version. Passing this update."
|
62
|
+
return
|
63
|
+
end
|
64
|
+
|
65
|
+
Logger.log_indent "Updating to #{version_type} version #{new_version}"
|
66
|
+
|
67
|
+
gem.version = new_version
|
68
|
+
|
69
|
+
gemfile.update_gem(gem)
|
70
|
+
|
71
|
+
if run_test_suite
|
72
|
+
Logger.log_indent "Test suite ran successfully. Committing changes."
|
73
|
+
commit_new_version
|
74
|
+
else
|
75
|
+
Logger.log_indent "Test suite failed to run. Reverting changes."
|
76
|
+
revert_to_previous_version
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def updatable?
|
81
|
+
gem.version =~ /^\d+\.\d+\.\d+$/ && gem.options.nil?
|
82
|
+
end
|
83
|
+
|
84
|
+
def commit_new_version
|
85
|
+
run_cmd "git commit Gemfile Gemfile.lock -m 'Auto update #{gem.name} to version #{gem.version}'"
|
86
|
+
end
|
87
|
+
|
88
|
+
def revert_to_previous_version
|
89
|
+
run_cmd "git checkout Gemfile Gemfile.lock"
|
90
|
+
end
|
91
|
+
|
92
|
+
def run_test_suite
|
93
|
+
run_cmd test_command
|
94
|
+
end
|
95
|
+
|
96
|
+
def run_cmd(cmd)
|
97
|
+
Logger.log cmd
|
98
|
+
|
99
|
+
CommandRunner.system(cmd)
|
100
|
+
end
|
101
|
+
end # class Updater
|
102
|
+
|
103
|
+
class Gemfile
|
104
|
+
|
105
|
+
def gem_line_regex(gem_name = '(\w+)')
|
106
|
+
/^\s*gem\s*['"]#{gem_name}['"]\s*(,\s*['"](.+)['"])?\s*(,\s*(.*))?\n?$/
|
107
|
+
end
|
108
|
+
|
109
|
+
# @note This funky code parser could be replaced by a funky dsl re-implementation
|
110
|
+
def gems
|
111
|
+
gems = []
|
112
|
+
|
113
|
+
content.dup.each_line do |l|
|
114
|
+
if match = l.match(gem_line_regex)
|
115
|
+
_, name, _, version, _, options = match.to_a
|
116
|
+
gems << Dependency.new(name, version, options)
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
gems
|
121
|
+
end
|
122
|
+
|
123
|
+
# @todo spec
|
124
|
+
def update_gem(gem)
|
125
|
+
update_content(gem) and write and run_bundle_update(gem)
|
126
|
+
end
|
127
|
+
|
128
|
+
def content
|
129
|
+
@content ||= read
|
130
|
+
end
|
131
|
+
|
132
|
+
private
|
133
|
+
|
134
|
+
def update_content(gem)
|
135
|
+
new_content = ""
|
136
|
+
content.each_line do |l|
|
137
|
+
if l =~ gem_line_regex(gem.name)
|
138
|
+
l.gsub!(/\d+\.\d+\.\d+/, gem.version)
|
139
|
+
end
|
140
|
+
|
141
|
+
new_content += l
|
142
|
+
end
|
143
|
+
|
144
|
+
@content = new_content
|
145
|
+
end
|
146
|
+
|
147
|
+
def read
|
148
|
+
File.read('Gemfile')
|
149
|
+
end
|
150
|
+
|
151
|
+
def write
|
152
|
+
File.open('Gemfile', 'w') do |f|
|
153
|
+
f.write(content)
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
def run_bundle_update(gem)
|
158
|
+
CommandRunner.system("bundle install")
|
159
|
+
end
|
160
|
+
end # class Gemfile
|
161
|
+
|
162
|
+
class Logger
|
163
|
+
def self.log(msg, prefix = "")
|
164
|
+
puts prefix + msg
|
165
|
+
end
|
166
|
+
|
167
|
+
def self.log_indent(msg)
|
168
|
+
log(msg, " - ")
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
class Dependency
|
173
|
+
attr_reader :name, :options, :major, :minor, :patch
|
174
|
+
attr_accessor :version
|
175
|
+
|
176
|
+
def initialize(name, version = nil, options = nil)
|
177
|
+
@name, @version, @options = name, version, options
|
178
|
+
|
179
|
+
@major, @minor, @patch = version.split('.') if version
|
180
|
+
end
|
181
|
+
|
182
|
+
def last_version(version_type)
|
183
|
+
case version_type
|
184
|
+
when :patch
|
185
|
+
available_versions.select { |v| v =~ /^#{major}\.#{minor}\D/ }.first
|
186
|
+
when :minor
|
187
|
+
available_versions.select { |v| v =~ /^#{major}\./ }.first
|
188
|
+
when :major
|
189
|
+
available_versions.first
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
def available_versions
|
194
|
+
the_gem_line = gem_remote_list_output.scan(/^#{name}\s.*$/).first
|
195
|
+
the_gem_line.scan /\d+\.\d+\.\d+/
|
196
|
+
end
|
197
|
+
|
198
|
+
def gem_remote_list_output
|
199
|
+
CommandRunner.run "gem list #{name} -r"
|
200
|
+
end
|
201
|
+
end # class Dependency
|
202
|
+
|
203
|
+
class CommandRunner
|
204
|
+
def self.system(cmd)
|
205
|
+
Kernel.system cmd
|
206
|
+
end
|
207
|
+
|
208
|
+
def self.run(cmd)
|
209
|
+
`#{cmd}`
|
210
|
+
end
|
211
|
+
end
|
212
|
+
end # module AutoUpdate
|
213
|
+
end # module Bundler
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require File.expand_path('../lib/bundler_auto_update.rb', File.dirname(__FILE__))
|
2
|
+
|
3
|
+
include Bundler::AutoUpdate
|
4
|
+
|
5
|
+
# Stub out system commands
|
6
|
+
class Bundler::AutoUpdate::CommandRunner
|
7
|
+
def self.system(cmd)
|
8
|
+
puts "Stub! #{cmd}"
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.run(cmd)
|
12
|
+
puts "Stub! #{cmd}"
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe CLI do
|
4
|
+
describe "#test_command" do
|
5
|
+
context "when -c option is passed" do
|
6
|
+
it "should extract the test command from arguments" do
|
7
|
+
CLI.new(%w(-c rake test)).test_command.should == 'rake test'
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
context "when no -c option" do
|
12
|
+
it "should return nil" do
|
13
|
+
CLI.new(%w(--help meh)).test_command.should be_nil
|
14
|
+
CLI.new([]).test_command.should be_nil
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Dependency do
|
4
|
+
let(:dependency) { Dependency.new 'rails', '2.1.1' }
|
5
|
+
|
6
|
+
before do
|
7
|
+
dependency.stub!(:gem_remote_list_output) { <<-EOS
|
8
|
+
|
9
|
+
## REMOTE GEMS
|
10
|
+
|
11
|
+
rails (3.1.0 ruby, 3.0.10 ruby, 3.0.9 ruby, 3.0.8 ruby, 3.0.7 ruby, 3.0.6 ruby, 3.0.5 ruby, 3.0.4 ruby, 3.0.3 ruby, 3.0.2 ruby, 3.0.1 ruby, 3.0.0 ruby, 2.3.14 ruby, 2.3.12 ruby, 2.3.11 ruby, 2.3.10 ruby, 2.3.9 ruby, 2.3.8 ruby, 2.3.7 ruby, 2.3.6 ruby, 2.3.5 ruby, 2.3.4 ruby, 2.3.3 ruby, 2.3.2 ruby, 2.2.3 ruby, 2.2.2 ruby, 2.1.2 ruby, 2.1.1 ruby, 2.1.0 ruby, 2.0.5 ruby, 2.0.4 ruby, 2.0.2 ruby, 2.0.1 ruby, 2.0.0 ruby, 1.2.6 ruby, 1.2.5 ruby, 1.2.4 ruby, 1.2.3 ruby, 1.2.2 ruby, 1.2.1 ruby, 1.2.0 ruby, 1.1.6 ruby, 1.1.5 ruby, 1.1.4 ruby, 1.1.3 ruby, 1.1.2 ruby, 1.1.1 ruby, 1.1.0 ruby, 1.0.0 ruby, 0.14.4 ruby, 0.14.3 ruby, 0.14.2 ruby, 0.14.1 ruby, 0.13.1 ruby, 0.13.0 ruby, 0.12.1 ruby, 0.12.0 ruby, 0.11.1 ruby, 0.11.0 ruby, 0.10.1 ruby, 0.10.0 ruby, 0.9.5 ruby, 0.9.4.1 ruby, 0.9.4 ruby, 0.9.3 ruby, 0.9.2 ruby, 0.9.1 ruby, 0.9.0 ruby, 0.8.5 ruby, 0.8.0 ruby)
|
12
|
+
railsbros-thrift4rails (0.3.1, 0.2.0)
|
13
|
+
EOS
|
14
|
+
}
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "#last_version" do
|
18
|
+
it "should be 2.1.2 with :patch" do
|
19
|
+
dependency.last_version(:patch).should == '2.1.2'
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should be 2.3.14 with :minor" do
|
23
|
+
dependency.last_version(:minor).should == '2.3.14'
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should be 3.1.0 with :major" do
|
27
|
+
dependency.last_version(:major).should == '3.1.0'
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
describe "#available_versions" do
|
33
|
+
it "should return an array of available versions" do
|
34
|
+
dependency.available_versions.should == %w(3.1.0 3.0.10 3.0.9 3.0.8 3.0.7 3.0.6 3.0.5 3.0.4 3.0.3 3.0.2 3.0.1 3.0.0 2.3.14 2.3.12 2.3.11 2.3.10 2.3.9 2.3.8 2.3.7 2.3.6 2.3.5 2.3.4 2.3.3 2.3.2 2.2.3 2.2.2 2.1.2 2.1.1 2.1.0 2.0.5 2.0.4 2.0.2 2.0.1 2.0.0 1.2.6 1.2.5 1.2.4 1.2.3 1.2.2 1.2.1 1.2.0 1.1.6 1.1.5 1.1.4 1.1.3 1.1.2 1.1.1 1.1.0 1.0.0 0.14.4 0.14.3 0.14.2 0.14.1 0.13.1 0.13.0 0.12.1 0.12.0 0.11.1 0.11.0 0.10.1 0.10.0 0.9.5 0.9.4 0.9.4 0.9.3 0.9.2 0.9.1 0.9.0 0.8.5 0.8.0)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GemUpdater do
|
4
|
+
let(:gemfile) { Gemfile.new }
|
5
|
+
let(:test_command) { '' }
|
6
|
+
|
7
|
+
describe "auto_update" do
|
8
|
+
|
9
|
+
context "when gem is updatable" do
|
10
|
+
let(:gem_updater) { GemUpdater.new(Dependency.new('rails', '3.0.0', nil), gemfile, test_command) }
|
11
|
+
|
12
|
+
it "should attempt to update to patch, minor and major" do
|
13
|
+
gem_updater.should_receive(:update).with(:patch).and_return(true)
|
14
|
+
gem_updater.should_receive(:update).with(:minor).and_return(false)
|
15
|
+
gem_updater.should_not_receive(:update).with(:major)
|
16
|
+
|
17
|
+
gem_updater.auto_update
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
context "when gem is not" do
|
22
|
+
let(:gem_updater) { GemUpdater.new(Dependency.new('rake', '<0.9'), gemfile, test_command) }
|
23
|
+
|
24
|
+
it "should not attempt to update it" do
|
25
|
+
gem_updater.should_not_receive(:update)
|
26
|
+
|
27
|
+
gem_updater.auto_update
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end # describe "auto_update"
|
31
|
+
|
32
|
+
describe "#update" do
|
33
|
+
let(:gem) { Dependency.new('rails', '3.0.0', nil) }
|
34
|
+
let(:gem_updater) { GemUpdater.new(gem, gemfile, test_command) }
|
35
|
+
|
36
|
+
context "when no new version" do
|
37
|
+
it "should return" do
|
38
|
+
gem.should_receive(:last_version).with(:patch) { gem.version }
|
39
|
+
gem_updater.gemfile.should_not_receive :update_gem
|
40
|
+
gem_updater.should_not_receive :run_test_suite
|
41
|
+
|
42
|
+
gem_updater.update(:patch)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
context "when new version" do
|
47
|
+
context "when tests pass" do
|
48
|
+
it "should commit new version" do
|
49
|
+
gem.should_receive(:last_version).with(:patch) { gem.version.next }
|
50
|
+
gem_updater.gemfile.should_receive :update_gem
|
51
|
+
gem_updater.should_receive(:run_test_suite).and_return true
|
52
|
+
gem_updater.should_receive(:commit_new_version)
|
53
|
+
|
54
|
+
gem_updater.update(:patch)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
context "when tests do not pass" do
|
59
|
+
it "should revert to previous version" do
|
60
|
+
gem.should_receive(:last_version).with(:patch) { gem.version.next }
|
61
|
+
gem_updater.gemfile.should_receive :update_gem
|
62
|
+
gem_updater.should_receive(:run_test_suite).and_return false
|
63
|
+
gem_updater.should_not_receive(:commit_new_version)
|
64
|
+
|
65
|
+
gem_updater.update(:patch)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
@@ -0,0 +1,76 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Gemfile do
|
4
|
+
let(:content) { <<-EOF
|
5
|
+
source :rubygems
|
6
|
+
|
7
|
+
gem 'rails', "3.0.0"
|
8
|
+
gem 'rake' , '< 0.9'
|
9
|
+
gem 'mysql', :git => "git://...."
|
10
|
+
EOF
|
11
|
+
}
|
12
|
+
|
13
|
+
let(:gemfile) do
|
14
|
+
Gemfile.new.tap { |gemfile|
|
15
|
+
gemfile.stub!(:read) { content }
|
16
|
+
gemfile.stub!(:write) { true }
|
17
|
+
}
|
18
|
+
end
|
19
|
+
|
20
|
+
describe "#gems" do
|
21
|
+
subject { gemfile.gems }
|
22
|
+
|
23
|
+
context "when emtpy Gemfile" do
|
24
|
+
let(:content) { "" }
|
25
|
+
|
26
|
+
it { should == [] }
|
27
|
+
end
|
28
|
+
|
29
|
+
context "when Gemfile contains 3 gems" do
|
30
|
+
its(:size) { should == 3 }
|
31
|
+
|
32
|
+
describe "first gem" do
|
33
|
+
subject { gemfile.gems.first }
|
34
|
+
|
35
|
+
its(:name) { should == 'rails' }
|
36
|
+
its(:version) { should == '3.0.0' }
|
37
|
+
its(:options) { should be_nil }
|
38
|
+
end
|
39
|
+
|
40
|
+
describe "second gem" do
|
41
|
+
subject { gemfile.gems[1] }
|
42
|
+
|
43
|
+
its(:name) { should == 'rake' }
|
44
|
+
its(:version) { should == '< 0.9' }
|
45
|
+
its(:options) { should be_nil }
|
46
|
+
end
|
47
|
+
|
48
|
+
describe "last gem" do
|
49
|
+
subject { gemfile.gems[2] }
|
50
|
+
|
51
|
+
its(:name) { should == 'mysql' }
|
52
|
+
its(:version) { should be_nil }
|
53
|
+
its(:options) { should == ':git => "git://...."' }
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end # describe "#gems"
|
57
|
+
|
58
|
+
describe "#update_gem" do
|
59
|
+
it "should update the gem version in the Gemfile" do
|
60
|
+
gemfile.update_gem(Dependency.new('rails', '3.1.0'))
|
61
|
+
gemfile.content.should include(%{gem 'rails', "3.1.0"})
|
62
|
+
end
|
63
|
+
|
64
|
+
it "should write the new Gemfile" do
|
65
|
+
gemfile.should_receive(:write)
|
66
|
+
|
67
|
+
gemfile.update_gem(Dependency.new('rails', '3.1.0'))
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should run 'bundle update' against the gem" do
|
71
|
+
CommandRunner.should_receive(:system).with("bundle update rails")
|
72
|
+
|
73
|
+
gemfile.update_gem(Dependency.new('rails', '3.1.0'))
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
metadata
ADDED
@@ -0,0 +1,124 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bundler-auto-update
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Philippe Creux
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-10-05 00:00:00 +02:00
|
19
|
+
default_executable: bundle-auto-update
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: rspec
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
version: "0"
|
33
|
+
type: :development
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: cucumber
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
hash: 3
|
44
|
+
segments:
|
45
|
+
- 0
|
46
|
+
version: "0"
|
47
|
+
type: :development
|
48
|
+
version_requirements: *id002
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: aruba
|
51
|
+
prerelease: false
|
52
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - "="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
hash: 3
|
58
|
+
segments:
|
59
|
+
- 0
|
60
|
+
- 4
|
61
|
+
- 6
|
62
|
+
version: 0.4.6
|
63
|
+
type: :development
|
64
|
+
version_requirements: *id003
|
65
|
+
description: Attempt to update every single gem of your Gemfile to its latest patch, minor then major release. Runs a test command to ensure the update succeeded
|
66
|
+
email:
|
67
|
+
- pcreux@gmail.com
|
68
|
+
executables:
|
69
|
+
- bundle-auto-update
|
70
|
+
extensions: []
|
71
|
+
|
72
|
+
extra_rdoc_files: []
|
73
|
+
|
74
|
+
files:
|
75
|
+
- .gitignore
|
76
|
+
- Gemfile
|
77
|
+
- Rakefile
|
78
|
+
- bin/bundle-auto-update
|
79
|
+
- bundler-auto-update.gemspec
|
80
|
+
- features/bundler_auto_update.feature
|
81
|
+
- features/support/env.rb
|
82
|
+
- lib/bundler_auto_update.rb
|
83
|
+
- lib/bundler_auto_update/version.rb
|
84
|
+
- spec/spec_helper.rb
|
85
|
+
- spec/unit/cli_spec.rb
|
86
|
+
- spec/unit/dependency_spec.rb
|
87
|
+
- spec/unit/gem_updater_spec.rb
|
88
|
+
- spec/unit/gemfile_spec.rb
|
89
|
+
has_rdoc: true
|
90
|
+
homepage: ""
|
91
|
+
licenses: []
|
92
|
+
|
93
|
+
post_install_message:
|
94
|
+
rdoc_options: []
|
95
|
+
|
96
|
+
require_paths:
|
97
|
+
- lib
|
98
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
99
|
+
none: false
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
hash: 3
|
104
|
+
segments:
|
105
|
+
- 0
|
106
|
+
version: "0"
|
107
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
|
+
none: false
|
109
|
+
requirements:
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
hash: 3
|
113
|
+
segments:
|
114
|
+
- 0
|
115
|
+
version: "0"
|
116
|
+
requirements: []
|
117
|
+
|
118
|
+
rubyforge_project:
|
119
|
+
rubygems_version: 1.3.7
|
120
|
+
signing_key:
|
121
|
+
specification_version: 3
|
122
|
+
summary: Auto update your Gemfile
|
123
|
+
test_files: []
|
124
|
+
|