podspec_bump 0.0.1

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4a2b78e030776eda796e40f8904191661c0df5ce
4
+ data.tar.gz: 1d97f767a828c20608c2d5e2839cc19e4b829e59
5
+ SHA512:
6
+ metadata.gz: 63352c201a40d8cfd1f532978f22aeee649981688923c307e1083c8349b1746af0e3394a645c4d7e31395d6e328a109e653d8c6d662a9d9fc662986f840d0641
7
+ data.tar.gz: 7c419bcb4936220007867690092c63ad4ef1771027904422bffcdd5e6e446404a7cb718f63b0919e7b2fe09234e1fa2615c1bc70760f9452af187726d4f5ee9f
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.5
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in podspec_bump.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 nakajijapan
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,44 @@
1
+ [![Gem Version](https://github.com/nakajijapan/podspec_bump.png)](http://badge.fury.io/rb/podspec_bump)
2
+
3
+ # PodspecBump
4
+
5
+ A command line tools to bump podspec version for CocoaPods.
6
+ Inspired [Bump](https://github.com/gregorym/bump)
7
+
8
+ ## Installation
9
+
10
+ Add this line to your application's Gemfile:
11
+
12
+ ```ruby
13
+ gem 'podspec_bump'
14
+ ```
15
+
16
+ And then execute:
17
+
18
+ $ bundle
19
+
20
+ Or install it yourself as:
21
+
22
+ $ gem install podspec_bump
23
+
24
+ ## Usage
25
+
26
+ Curent version
27
+
28
+ ```
29
+ bump current
30
+ ```
31
+
32
+ Bump (major, minor, patch, pre)
33
+
34
+ ```
35
+ bump patch
36
+ ```
37
+
38
+ ## Contributing
39
+
40
+ 1. Fork it ( https://github.com/[my-github-username]/podspec_bump/fork )
41
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
42
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
43
+ 4. Push to the branch (`git push origin my-new-feature`)
44
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
7
+
data/bin/podspec_bump ADDED
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env ruby
2
+ require 'optparse'
3
+ require 'podspec_bump'
4
+
5
+ options = {}
6
+ OptionParser.new do |opts|
7
+ opts.banner = <<BANNER
8
+ Bump your podspec version.
9
+ Usage:
10
+ podspec_bump current # show current version
11
+ podspec_bump patch # increase patch version of your podspec (1.0.X)
12
+ podspec_bump minor # increase minor version of your podspec (1.X.0)
13
+ podspec_bump major # increase major version of your podspec (X.0.0)
14
+ podspec_bump set 1.2.3 # set the version number to the given value
15
+ BANNER
16
+ opts.on("-h", "--help","Show this.") { puts opts; exit }
17
+ end.parse!
18
+
19
+ PodspecBump::Bump.run(ARGV.first, options)
@@ -0,0 +1,3 @@
1
+ module PodspecBump
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,86 @@
1
+ require "podspec_bump/version"
2
+ require 'colorize'
3
+
4
+ module PodspecBump
5
+ class InvalidOptionError < StandardError; end
6
+ class NotfoundSpecFileError < StandardError; end
7
+
8
+ class Bump
9
+ BUMPS = %w(major minor patch)
10
+ OPTIONS = BUMPS | ["set", "current"]
11
+ VERSION_REGEX = /(\d+\.\d+\.\d+)/
12
+
13
+ def self.run(bump, options={})
14
+ case bump
15
+ when *BUMPS
16
+ bump_part(bump, options)
17
+ when "current"
18
+ puts "Current version: #{version_from_file()}".colorize(:green)
19
+ else
20
+ raise InvalidOptionError
21
+ end
22
+ rescue InvalidOptionError
23
+ puts "Invalid option. Choose between #{OPTIONS.join(',')}.".colorize(:yellow)
24
+ rescue NotfoundSpecFileError
25
+ puts "Not found your spec file".colorize(:yellow)
26
+ rescue Exception => e
27
+ puts "Something wrong happened: #{e.message}\n#{e.backtrace.join("\n")}".colorize(:yellow)
28
+ end
29
+
30
+ def self.bump(current, next_version, options)
31
+ replace(current, next_version)
32
+ commit(next_version, options)
33
+ ["Bump version #{current} to #{next_version}", 0]
34
+ end
35
+
36
+ def self.replace(old, new)
37
+ content = File.read(spec_file)
38
+ File.open(spec_file, "w"){|f| f.write(content.sub(old, new)) }
39
+ end
40
+
41
+ def self.commit(version, options)
42
+ return unless File.directory?(".git")
43
+ system_cmd("git add --update #{spec_file()} && git commit -m 'v#{version}'")
44
+ system_cmd("git tag -a -m 'Bump to v#{version}' #{version}")
45
+ end
46
+
47
+ def self.system_cmd(command)
48
+ puts command.colorize(:green)
49
+ system command
50
+ end
51
+
52
+ def self.spec_file
53
+ Dir.glob('*.podspec')[0]
54
+ end
55
+
56
+ def self.version_from_file
57
+ raise NotfoundSpecFileError if Dir.glob('*.podspec').empty?
58
+ File.read(spec_file)[VERSION_REGEX]
59
+ end
60
+
61
+ def self.bump_part(part, options)
62
+ current = version_from_file
63
+ next_version = next_version(current, part)
64
+ bump(current, next_version, options)
65
+ end
66
+
67
+ def self.next_version(current, part)
68
+ major, minor, patch = current.split('.')
69
+
70
+ case part
71
+ when "major"
72
+ major, minor, patch = major.succ, 0, 0, nil
73
+ when "minor"
74
+ minor, patch = minor.succ, 0
75
+ when "patch"
76
+ patch = patch.succ
77
+ else
78
+ raise "unknown part #{part.inspect}"
79
+ end
80
+
81
+ [major, minor, patch].compact.join('.')
82
+ end
83
+
84
+ end
85
+
86
+ end
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'podspec_bump/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "podspec_bump"
8
+ spec.version = PodspecBump::VERSION
9
+ spec.authors = ["nakajijapan"]
10
+ spec.email = ["pp.kupepo.gattyanmo@gmail.com"]
11
+ spec.summary = %q{A command line tools to bump podspec version for CocoaPods.}
12
+ spec.description = %q{A command line tools to bump podspec version for CocoaPods. Inspired [Bump](https://github.com/gregorym/bump)}
13
+ spec.homepage = "http://www.nakajijapan.net"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.7"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "rspec", '~> 0'
24
+ spec.add_development_dependency "colorize", '~> 0'
25
+ end
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ describe PodspecBump do
4
+ it 'has a version number' do
5
+ expect(PodspecBump::VERSION).not_to be nil
6
+ end
7
+
8
+ it 'does something useful' do
9
+ expect(false).to eq(true)
10
+ end
11
+ end
@@ -0,0 +1,2 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+ require 'podspec_bump'
metadata ADDED
@@ -0,0 +1,117 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: podspec_bump
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - nakajijapan
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-07-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: colorize
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: A command line tools to bump podspec version for CocoaPods. Inspired
70
+ [Bump](https://github.com/gregorym/bump)
71
+ email:
72
+ - pp.kupepo.gattyanmo@gmail.com
73
+ executables:
74
+ - podspec_bump
75
+ extensions: []
76
+ extra_rdoc_files: []
77
+ files:
78
+ - ".gitignore"
79
+ - ".rspec"
80
+ - ".travis.yml"
81
+ - Gemfile
82
+ - LICENSE.txt
83
+ - README.md
84
+ - Rakefile
85
+ - bin/podspec_bump
86
+ - lib/podspec_bump.rb
87
+ - lib/podspec_bump/version.rb
88
+ - podspec_bump.gemspec
89
+ - spec/podspec_bump_spec.rb
90
+ - spec/spec_helper.rb
91
+ homepage: http://www.nakajijapan.net
92
+ licenses:
93
+ - MIT
94
+ metadata: {}
95
+ post_install_message:
96
+ rdoc_options: []
97
+ require_paths:
98
+ - lib
99
+ required_ruby_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ required_rubygems_version: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ requirements: []
110
+ rubyforge_project:
111
+ rubygems_version: 2.2.2
112
+ signing_key:
113
+ specification_version: 4
114
+ summary: A command line tools to bump podspec version for CocoaPods.
115
+ test_files:
116
+ - spec/podspec_bump_spec.rb
117
+ - spec/spec_helper.rb