bundler-auto-update 0.0.4 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -3,3 +3,5 @@ source "http://rubygems.org"
3
3
  # Specify your gem's dependencies in bundler-auto-update.gemspec
4
4
  gemspec
5
5
 
6
+ gem 'rake'
7
+
@@ -84,6 +84,11 @@ module Bundler
84
84
  end
85
85
  end
86
86
 
87
+ # @return true when the gem has a fixed version.
88
+ def updatable?
89
+ !!(gem.version =~ /^~?>? ?\d+\.\d+(\.\d+)?$/)
90
+ end
91
+
87
92
  private
88
93
 
89
94
  # Update gem version in Gemfile.
@@ -111,14 +116,15 @@ module Bundler
111
116
  end
112
117
  end
113
118
 
114
- # @return true when the gem has a fixed version.
115
- def updatable?
116
- gem.version =~ /^\d+\.\d+\.\d+$/
117
- end
118
-
119
119
  def commit_new_version
120
120
  Logger.log_indent "Committing changes"
121
- CommandRunner.system "git commit Gemfile Gemfile.lock -m 'Auto update #{gem.name} to version #{gem.version}'"
121
+
122
+ files_to_commit = if CommandRunner.system "git status | grep 'Gemfile.lock'"
123
+ "Gemfile Gemfile.lock"
124
+ else
125
+ "Gemfile"
126
+ end
127
+ CommandRunner.system "git commit #{files_to_commit} -m 'Auto update #{gem.name} to version #{gem.version}'"
122
128
  end
123
129
 
124
130
  def revert_to_previous_version
@@ -133,7 +139,7 @@ module Bundler
133
139
  # Regex that matches a gem definition line.
134
140
  #
135
141
  # @return [RegEx] matching [_, name, _, version, _, options]
136
- def gem_line_regex(gem_name = '(\w+)')
142
+ def gem_line_regex(gem_name = '([\w-]+)')
137
143
  /^\s*gem\s*['"]#{gem_name}['"]\s*(,\s*['"](.+)['"])?\s*(,\s*(.*))?\n?$/
138
144
  end
139
145
 
@@ -230,7 +236,8 @@ module Bundler
230
236
  def initialize(name, version = nil, options = nil)
231
237
  @name, @version, @options = name, version, options
232
238
 
233
- @major, @minor, @patch = version.split('.') if version
239
+ # TODO: enhance support of > and ~> in versions
240
+ @major, @minor, @patch = version[/\d+\.\d+(\.\d+)?/].split('.') if version
234
241
  end
235
242
 
236
243
  # Return last version scoped at :version_type:.
@@ -1,5 +1,5 @@
1
1
  module Bundler
2
2
  module AutoUpdate
3
- VERSION = "0.0.4"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
@@ -82,5 +82,20 @@ describe GemUpdater do
82
82
  end
83
83
  end # describe "#update"
84
84
 
85
+ describe "updatable?" do
86
+ [ "1.0.0", "> 1.0.0", "~> 1.0.0", "1.0", ].each do |version|
87
+ it "should be updatable when version is #{version}" do
88
+ dependency = Dependency.new('rails', version)
89
+ GemUpdater.new(dependency, nil, nil).should be_updatable
90
+ end
91
+ end
92
+
93
+ it "should be updatable when version is < 1.0.0" do
94
+ dependency = Dependency.new('rails', '< 1.0.0')
95
+ GemUpdater.new(dependency, nil, nil).should_not be_updatable
96
+ end
97
+ end
98
+
99
+
85
100
  end
86
101
 
@@ -5,7 +5,9 @@ describe Gemfile do
5
5
  source :rubygems
6
6
 
7
7
  gem 'rails', "3.0.0"
8
- gem 'rake' , '< 0.9'
8
+ group :test do
9
+ gem 'shoulda-matchers' , '~> 0.9'
10
+ end
9
11
  gem 'mysql', :git => "git://...."
10
12
  EOF
11
13
  }
@@ -40,8 +42,8 @@ EOF
40
42
  describe "second gem" do
41
43
  subject { gemfile.gems[1] }
42
44
 
43
- its(:name) { should == 'rake' }
44
- its(:version) { should == '< 0.9' }
45
+ its(:name) { should == 'shoulda-matchers' }
46
+ its(:version) { should == '~> 0.9' }
45
47
  its(:options) { should be_nil }
46
48
  end
47
49
 
metadata CHANGED
@@ -1,77 +1,58 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: bundler-auto-update
3
- version: !ruby/object:Gem::Version
4
- hash: 23
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 0
9
- - 4
10
- version: 0.0.4
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Philippe Creux
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-10-13 00:00:00 +02:00
19
- default_executable: bundle-auto-update
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
12
+ date: 2012-10-03 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
22
15
  name: rspec
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &70213822217080 !ruby/object:Gem::Requirement
25
17
  none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
33
22
  type: :development
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: cucumber
37
23
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *70213822217080
25
+ - !ruby/object:Gem::Dependency
26
+ name: cucumber
27
+ requirement: &70213822216080 !ruby/object:Gem::Requirement
39
28
  none: false
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- hash: 3
44
- segments:
45
- - 0
46
- version: "0"
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
47
33
  type: :development
48
- version_requirements: *id002
49
- - !ruby/object:Gem::Dependency
50
- name: aruba
51
34
  prerelease: false
52
- requirement: &id003 !ruby/object:Gem::Requirement
35
+ version_requirements: *70213822216080
36
+ - !ruby/object:Gem::Dependency
37
+ name: aruba
38
+ requirement: &70213822214920 !ruby/object:Gem::Requirement
53
39
  none: false
54
- requirements:
55
- - - "="
56
- - !ruby/object:Gem::Version
57
- hash: 3
58
- segments:
59
- - 0
60
- - 4
61
- - 6
40
+ requirements:
41
+ - - =
42
+ - !ruby/object:Gem::Version
62
43
  version: 0.4.6
63
44
  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:
45
+ prerelease: false
46
+ version_requirements: *70213822214920
47
+ description: Attempt to update every single gem of your Gemfile to its latest patch,
48
+ minor then major release. Runs a test command to ensure the update succeeded
49
+ email:
67
50
  - pcreux@gmail.com
68
- executables:
51
+ executables:
69
52
  - bundle-auto-update
70
53
  extensions: []
71
-
72
54
  extra_rdoc_files: []
73
-
74
- files:
55
+ files:
75
56
  - .gitignore
76
57
  - Gemfile
77
58
  - README.md
@@ -87,39 +68,41 @@ files:
87
68
  - spec/unit/dependency_spec.rb
88
69
  - spec/unit/gem_updater_spec.rb
89
70
  - spec/unit/gemfile_spec.rb
90
- has_rdoc: true
91
- homepage: ""
71
+ homepage: ''
92
72
  licenses: []
93
-
94
73
  post_install_message:
95
74
  rdoc_options: []
96
-
97
- require_paths:
75
+ require_paths:
98
76
  - lib
99
- required_ruby_version: !ruby/object:Gem::Requirement
77
+ required_ruby_version: !ruby/object:Gem::Requirement
100
78
  none: false
101
- requirements:
102
- - - ">="
103
- - !ruby/object:Gem::Version
104
- hash: 3
105
- segments:
79
+ requirements:
80
+ - - ! '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ segments:
106
84
  - 0
107
- version: "0"
108
- required_rubygems_version: !ruby/object:Gem::Requirement
85
+ hash: -4045362081807773718
86
+ required_rubygems_version: !ruby/object:Gem::Requirement
109
87
  none: false
110
- requirements:
111
- - - ">="
112
- - !ruby/object:Gem::Version
113
- hash: 3
114
- segments:
88
+ requirements:
89
+ - - ! '>='
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ segments:
115
93
  - 0
116
- version: "0"
94
+ hash: -4045362081807773718
117
95
  requirements: []
118
-
119
96
  rubyforge_project:
120
- rubygems_version: 1.3.7
97
+ rubygems_version: 1.8.11
121
98
  signing_key:
122
99
  specification_version: 3
123
100
  summary: Auto update your Gemfile
124
- test_files: []
125
-
101
+ test_files:
102
+ - features/bundler_auto_update.feature
103
+ - features/support/env.rb
104
+ - spec/spec_helper.rb
105
+ - spec/unit/cli_spec.rb
106
+ - spec/unit/dependency_spec.rb
107
+ - spec/unit/gem_updater_spec.rb
108
+ - spec/unit/gemfile_spec.rb