bumpy 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format=documentation
data/.watchr ADDED
@@ -0,0 +1,16 @@
1
+ def run(cmd, msg = nil)
2
+ puts "=== %s" % msg if msg
3
+ puts "=== %s" % cmd
4
+ system cmd
5
+ puts "\n"
6
+ end
7
+
8
+ watch("spec/.*_spec\.rb") { |m| run("rspec %s" % m[0]) }
9
+ watch("lib/bumpy.rb") { |m| run("rspec spec/bumpy_spec.rb") }
10
+ watch("lib/bumpy/(.*)\.rb") { |m| run("rspec spec/%s_spec.rb" % m[1]) }
11
+ watch('^spec/(spec_helper|factories)\.rb') { |f| run "rake spec", "%s.rb has been modified" % f }
12
+
13
+ # Ctrl-\
14
+ Signal.trap('QUIT') { run("bundle exec rake spec") }
15
+ # Ctrl-C
16
+ Signal.trap('INT') { abort("\nQuitting.") }
data/Rakefile CHANGED
@@ -1,2 +1,7 @@
1
1
  #!/usr/bin/env rake
2
2
  require "bundler/gem_tasks"
3
+
4
+ # integrate rspec
5
+ require 'rspec/core/rake_task'
6
+ RSpec::Core::RakeTask.new('spec')
7
+ task :default => :spec
data/bin/bumpy CHANGED
@@ -15,6 +15,7 @@ EOS
15
15
 
16
16
  opt :dryrun, "Dry run (no writing or committing)"
17
17
  opt :no_git, "Don't automatically create git commit"
18
+ opt :message, "Supply a git commit message (%s is replaced with bumped version number)", :type => :string
18
19
  end
19
20
 
20
21
  EXPR = %r{VERSION = ['"](.+)['"]}
@@ -23,9 +24,7 @@ opts[:new_version] = ARGV.shift
23
24
  Dir['./lib/**/version.rb'].each do |name|
24
25
  contents = File.read(name)
25
26
  if contents =~ EXPR
26
- opts[:new_version] ||= begin
27
- $1.next
28
- end
27
+ opts[:new_version] ||= Bumpy.bump_version($1)
29
28
 
30
29
  puts "Bumping version number found in #{name} to #{opts[:new_version]}"
31
30
  contents.sub!(EXPR, "VERSION = \"#{opts[:new_version]}\"")
@@ -37,8 +36,8 @@ Dir['./lib/**/version.rb'].each do |name|
37
36
 
38
37
  # create git commit
39
38
  if File.exists?('./.git') && !opts[:no_git]
40
- puts "Creating git commit"
41
- system "git add #{name} && git commit -m 'Bump version to #{opts[:new_version]}'"
39
+ opts[:message] ||= "Bump version to #{opts[:new_version]}"
40
+ system "git add #{name} && git commit -m '#{opts[:message] % opts[:new_version]}'"
42
41
  end
43
42
  end
44
43
 
data/bumpy.gemspec CHANGED
@@ -16,4 +16,8 @@ Gem::Specification.new do |gem|
16
16
  gem.version = Bumpy::VERSION
17
17
 
18
18
  gem.add_dependency 'trollop'
19
+
20
+ gem.add_development_dependency 'rake'
21
+ gem.add_development_dependency 'rspec'
22
+ gem.add_development_dependency 'watchr'
19
23
  end
data/lib/bumpy.rb CHANGED
@@ -1,4 +1,7 @@
1
1
  require "bumpy/version"
2
2
 
3
3
  module Bumpy
4
+ def self.bump_version(v)
5
+ v.gsub(/(\d+)$/) { $1.next }
6
+ end
4
7
  end
data/lib/bumpy/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Bumpy
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ describe Bumpy do
4
+ describe ".bump_version" do
5
+ def bump(v)
6
+ subject.bump_version(v)
7
+ end
8
+
9
+ TEST_DATA = [
10
+ ['1.0.0', '1.0.1'],
11
+ ['1.0.9', '1.0.10'],
12
+ ['1.0.5.pre9', '1.0.5.pre10'],
13
+ ['12.0', '12.1'],
14
+ ['1.2.3.dev.9', '1.2.3.dev.10']
15
+ ]
16
+
17
+ TEST_DATA.each do |from, to|
18
+ it "correctly bumps #{from} to #{to}" do
19
+ bump(from).should == to
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,15 @@
1
+ SPEC_DIR = File.dirname(__FILE__)
2
+ lib_path = File.expand_path("#{SPEC_DIR}/../lib")
3
+ $LOAD_PATH.unshift lib_path unless $LOAD_PATH.include?(lib_path)
4
+
5
+ require 'rubygems'
6
+ require 'bundler/setup'
7
+
8
+ require 'bumpy'
9
+
10
+ module SpecHelpers
11
+ end
12
+
13
+ RSpec.configure do |conf|
14
+ conf.include SpecHelpers
15
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bumpy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-31 00:00:00.000000000 Z
12
+ date: 2012-06-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: trollop
16
- requirement: &70280387192280 !ruby/object:Gem::Requirement
16
+ requirement: &70321730919060 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,40 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70280387192280
24
+ version_requirements: *70321730919060
25
+ - !ruby/object:Gem::Dependency
26
+ name: rake
27
+ requirement: &70321730911280 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *70321730911280
36
+ - !ruby/object:Gem::Dependency
37
+ name: rspec
38
+ requirement: &70321730903860 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *70321730903860
47
+ - !ruby/object:Gem::Dependency
48
+ name: watchr
49
+ requirement: &70321730902820 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *70321730902820
25
58
  description: Bumpy bumps your gem's version number.
26
59
  email:
27
60
  - hendrik@mans.de
@@ -31,6 +64,8 @@ extensions: []
31
64
  extra_rdoc_files: []
32
65
  files:
33
66
  - .gitignore
67
+ - .rspec
68
+ - .watchr
34
69
  - Gemfile
35
70
  - LICENSE
36
71
  - README.md
@@ -39,6 +74,8 @@ files:
39
74
  - bumpy.gemspec
40
75
  - lib/bumpy.rb
41
76
  - lib/bumpy/version.rb
77
+ - spec/bumpy_spec.rb
78
+ - spec/spec_helper.rb
42
79
  homepage: ''
43
80
  licenses: []
44
81
  post_install_message:
@@ -63,5 +100,7 @@ rubygems_version: 1.8.11
63
100
  signing_key:
64
101
  specification_version: 3
65
102
  summary: Bumpy bumps your gem's version number.
66
- test_files: []
103
+ test_files:
104
+ - spec/bumpy_spec.rb
105
+ - spec/spec_helper.rb
67
106
  has_rdoc: