xcbump 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0c4c4c5577d94a1323ac3d04ac6141bac9c1a750
4
+ data.tar.gz: ee1f6689d7d115aff680b2714f5ed6202b2d0fa4
5
+ SHA512:
6
+ metadata.gz: 8216c6dfd3f2a2a35d67b9c78f428f90f1f6637c0d6619ab10c20482f2b2231ef5d6715706caffa0a4e9fb924606501aeba45cb9f00539e092053d5db8799c61
7
+ data.tar.gz: a35aebf805431cc632cd59057eaec51fb3165d2f5fb6cc4531be99b7c135948410f36d91b4651f39eb77e0d2b0697b9034d97732c4376c448304c3115d6743e3
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/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in xcbump.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Andrew Katz
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,66 @@
1
+ # Xcbump
2
+
3
+ Increments the version and build numbers for an Xcode project. Uses semantic versioning for both
4
+ numbers. This is also based on a versioning scheme we use in the build version number, where the
5
+ fourth digit signifies the build number.
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'xcbump'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install xcbump
22
+
23
+ ## Usage
24
+
25
+ Configure the gem:
26
+
27
+ $ xcb --configure
28
+
29
+ Project Name? MyProject
30
+ Config file written to 'xcbump.yml'.
31
+
32
+ Bump major version:
33
+
34
+ $ xcb --major
35
+
36
+ Current version: 1.2.4 (1.2.4.1)
37
+ New version: 2.0.0 (2.0.0.0)
38
+
39
+ Bump minor version:
40
+
41
+ $ xcb --minor
42
+
43
+ Current version: 1.2.4 (1.2.4.1)
44
+ New version: 1.3.0 (1.3.0.0)
45
+
46
+ Bump patch version:
47
+
48
+ $ xcb --patch
49
+
50
+ Current version: 1.2.4 (1.2.4.1)
51
+ New version: 1.2.5 (1.2.5.0)
52
+
53
+ Bump build version:
54
+
55
+ $ xcb --build
56
+
57
+ Current version: 1.2.4 (1.2.4.1)
58
+ New version: 1.2.4 (1.2.4.2)
59
+
60
+ ## Contributing
61
+
62
+ 1. Fork it ( https://github.com/greenbits/xcbump/fork )
63
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
64
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
65
+ 4. Push to the branch (`git push origin my-new-feature`)
66
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
data/bin/xcb ADDED
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'slop'
4
+ require 'xcbump'
5
+
6
+ xcbump = Xcbump::Bump.new
7
+
8
+ Slop.parse do |o|
9
+ o.on '-c', '--configure' do
10
+ xcbump.configure
11
+ end
12
+
13
+ o.on '-m', '--major' do
14
+ xcbump.bump_version(:major)
15
+ end
16
+
17
+ o.on '-n', '--minor' do
18
+ xcbump.bump_version(:minor)
19
+ end
20
+
21
+ o.on '-p', '--patch' do
22
+ xcbump.bump_version(:patch)
23
+ end
24
+
25
+ o.on '-b', '--build' do
26
+ xcbump.bump_version(:build)
27
+ end
28
+ end
@@ -0,0 +1,3 @@
1
+ module Xcbump
2
+ VERSION = "0.0.2"
3
+ end
data/lib/xcbump.rb ADDED
@@ -0,0 +1,70 @@
1
+ require "xcbump/version"
2
+ require 'plist'
3
+ require 'highline/import'
4
+ require 'yaml'
5
+
6
+ module Xcbump
7
+ class Bump
8
+ def configure
9
+ File.write(config_file_path, { project: ask('Project name? ') }.to_yaml)
10
+ puts "Config file written to '#{config_file_path}'."
11
+ end
12
+
13
+ def config_file_path
14
+ File.join(Dir.pwd, 'xcbump.yml')
15
+ end
16
+
17
+ def project_name
18
+ @project_name ||= project_name_from_config
19
+ end
20
+
21
+ def project_name_from_config
22
+ config = YAML.load(File.read(config_file_path))
23
+ config[:project]
24
+ end
25
+
26
+ def bump_version(version_type)
27
+ file_path = File.join(Dir.pwd, project_name, "#{project_name}-Info.plist")
28
+ info_plist = Plist::parse_xml(file_path)
29
+ current_version_string = info_plist['CFBundleShortVersionString']
30
+ current_build_string = info_plist['CFBundleVersion']
31
+ puts "Current version: #{current_version_string} (#{current_build_string})"
32
+
33
+ case version_type
34
+ when :major
35
+ version_index = 0
36
+ when :minor
37
+ version_index = 1
38
+ when :patch
39
+ version_index = 2
40
+ else
41
+ version_index = 3
42
+ end
43
+
44
+ current_build = current_build_string.split('.').map(&:to_i)
45
+ new_build = []
46
+ current_build.each_index do |index|
47
+ current_number = current_build[index]
48
+
49
+ if index < version_index
50
+ new_number = current_number
51
+ elsif index > version_index
52
+ new_number = 0
53
+ else
54
+ new_number = current_number + 1
55
+ end
56
+
57
+ new_build[index] = new_number
58
+ end
59
+
60
+ new_version_string = new_build[0..-2].join('.')
61
+ new_build_string = new_build.join('.')
62
+ info_plist['CFBundleShortVersionString'] = new_version_string
63
+ info_plist['CFBundleVersion'] = new_build_string
64
+
65
+ puts "New version: #{new_version_string} (#{new_build_string})"
66
+
67
+ File.write(file_path, info_plist.to_plist)
68
+ end
69
+ end
70
+ end
data/xcbump.gemspec ADDED
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'xcbump/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'xcbump'
8
+ spec.version = Xcbump::VERSION
9
+ spec.authors = ['Andrew Katz']
10
+ spec.email = ['andrew@greenbits.com']
11
+ spec.summary = %q{Xcbump}
12
+ spec.description = %q{Increments the version and build numbers for an Xcode project.}
13
+ spec.homepage = 'https://github.com/greenbits/xcbump'
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_dependency 'slop', '~> 4.0.0'
22
+ spec.add_dependency 'plist', '~> 3.1.0'
23
+ spec.add_dependency 'highline', '~> 1.6.21'
24
+
25
+ spec.add_development_dependency 'bundler', '~> 1.7'
26
+ spec.add_development_dependency 'rake', '~> 10.0'
27
+ end
metadata ADDED
@@ -0,0 +1,124 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: xcbump
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Andrew Katz
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-02-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: slop
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 4.0.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 4.0.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: plist
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 3.1.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 3.1.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: highline
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 1.6.21
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 1.6.21
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.7'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.7'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '10.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '10.0'
83
+ description: Increments the version and build numbers for an Xcode project.
84
+ email:
85
+ - andrew@greenbits.com
86
+ executables:
87
+ - xcb
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - ".gitignore"
92
+ - Gemfile
93
+ - LICENSE.txt
94
+ - README.md
95
+ - Rakefile
96
+ - bin/xcb
97
+ - lib/xcbump.rb
98
+ - lib/xcbump/version.rb
99
+ - xcbump.gemspec
100
+ homepage: https://github.com/greenbits/xcbump
101
+ licenses:
102
+ - MIT
103
+ metadata: {}
104
+ post_install_message:
105
+ rdoc_options: []
106
+ require_paths:
107
+ - lib
108
+ required_ruby_version: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ required_rubygems_version: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ requirements: []
119
+ rubyforge_project:
120
+ rubygems_version: 2.2.2
121
+ signing_key:
122
+ specification_version: 4
123
+ summary: Xcbump
124
+ test_files: []