xcodebump 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +19 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +2 -0
- data/bin/xcodebump +23 -0
- data/lib/xcodebump/colors.rb +23 -0
- data/lib/xcodebump/commands/bump.rb +32 -0
- data/lib/xcodebump/commands/install.rb +54 -0
- data/lib/xcodebump/commands.rb +3 -0
- data/lib/xcodebump/plist.rb +71 -0
- data/lib/xcodebump/version.rb +3 -0
- data/lib/xcodebump.rb +8 -0
- metadata +101 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: df99e2870d76ca54ad758987d40008ebafb60086
|
4
|
+
data.tar.gz: e09b09be204428cbbddfcea492975d0d4e903240
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ed0e19e0afabc7a5a370edbb019908d9bd7cb90d2a4ba23201af182fdc09db2abb0066c143011a260348f254cb1735dc60d2964c0f52338f1ab71124333d7972
|
7
|
+
data.tar.gz: 28a30d654b51ca9c38035c9dbc6f2f08c6882c88524e9fe7aa4e67c1513696072697317a7b29bb3a98efe649c85916cfc989bfcbf31cbbb78342e24c08b093a7
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 bennyguitar
|
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,29 @@
|
|
1
|
+
# Xcodebump
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'xcodebump'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install xcodebump
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it ( https://github.com/[my-github-username]/xcodebump/fork )
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/bin/xcodebump
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'dotenv'
|
4
|
+
Dotenv.load
|
5
|
+
require 'commander/import'
|
6
|
+
|
7
|
+
$:.push File.expand_path("../../lib", __FILE__)
|
8
|
+
require 'xcodebump'
|
9
|
+
|
10
|
+
HighLine.track_eof = false # Fix for built-in Ruby
|
11
|
+
|
12
|
+
program :version, Xcodebump::VERSION
|
13
|
+
program :description, 'Semantic versioning for Xcode made easy.'
|
14
|
+
|
15
|
+
program :help, 'Author', 'Benjamin Gordon (@bennyguitar) for Intermark Group <interactive@intermarkgroup.com>'
|
16
|
+
program :help, 'Website', 'https://github.com/intermark'
|
17
|
+
program :help_formatter, :compact
|
18
|
+
|
19
|
+
global_option('--dontlog') { $nolog = true }
|
20
|
+
|
21
|
+
default_command :help
|
22
|
+
|
23
|
+
require 'xcodebump'
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Xcodebump
|
2
|
+
# Main Colorize Functions
|
3
|
+
def self.colorize(text, color_code)
|
4
|
+
puts "\e[#{color_code}m#{text}\e[0m"
|
5
|
+
end
|
6
|
+
|
7
|
+
# Specific Colors
|
8
|
+
def self.red(text)
|
9
|
+
colorize(text, 31)
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.green(text)
|
13
|
+
colorize(text, 32)
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.blue(text)
|
17
|
+
colorize(text, 36)
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.purple(text)
|
21
|
+
colorize(text, 35)
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
$:.push File.expand_path('../../', __FILE__)
|
2
|
+
require 'fileutils'
|
3
|
+
require 'xcodebump'
|
4
|
+
|
5
|
+
command :bump do |c|
|
6
|
+
c.syntax = 'xcodebump bump [options]'
|
7
|
+
c.summary = 'Creates the required files in your directory.'
|
8
|
+
c.description = ''
|
9
|
+
c.option '-r', '--release', 'Bumps the release version number, or 1 in 1.2.3'
|
10
|
+
c.option '-m', '--minor', 'Bumps the minor version number, or 2 in 1.2.3'
|
11
|
+
c.option '-p', '--patch', 'Bumps the patch version number, or 3 in 1.2.3'
|
12
|
+
|
13
|
+
c.action do |args, options|
|
14
|
+
r = options.release
|
15
|
+
m = options.minor
|
16
|
+
p = options.patch
|
17
|
+
|
18
|
+
if r
|
19
|
+
m = nil
|
20
|
+
p = nil
|
21
|
+
elsif m
|
22
|
+
r = nil
|
23
|
+
p = nil
|
24
|
+
elsif p
|
25
|
+
r = nil
|
26
|
+
m = nil
|
27
|
+
else
|
28
|
+
return
|
29
|
+
end
|
30
|
+
Xcodebump::update_version_number r, m, p
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
$:.push File.expand_path('../../', __FILE__)
|
2
|
+
require 'fileutils'
|
3
|
+
require 'longbow'
|
4
|
+
|
5
|
+
command :install do |c|
|
6
|
+
c.syntax = 'longbow install [options]'
|
7
|
+
c.summary = 'Creates the required files in your directory.'
|
8
|
+
c.description = ''
|
9
|
+
c.option '-d', '--directory DIRECTORY', 'Path where the .xcproj or .xcworkspace file && the longbow.json file live.'
|
10
|
+
|
11
|
+
c.action do |args, options|
|
12
|
+
# Check for newer version
|
13
|
+
Longbow::check_for_newer_version unless $nolog
|
14
|
+
|
15
|
+
# Set Up
|
16
|
+
@directory = options.directory ? options.directory : Dir.pwd
|
17
|
+
@json_path = @directory + '/longbow.json'
|
18
|
+
|
19
|
+
# Install
|
20
|
+
if File.exist?(@json_path)
|
21
|
+
Longbow::red ' longbow.json already exists at ' + @json_path
|
22
|
+
else
|
23
|
+
File.open(@json_path, 'w') do |f|
|
24
|
+
f.write('{
|
25
|
+
"targets":[
|
26
|
+
{
|
27
|
+
"name":"TargetName",
|
28
|
+
"icon_url":"https://somewhere.net/img.png",
|
29
|
+
"launch_phone_p_url":"https://somewhere.net/img2.png",
|
30
|
+
"info_plist": {
|
31
|
+
"CFBundleIdentifier":"com.company.target1",
|
32
|
+
"ProprietaryKey":"Value"
|
33
|
+
}
|
34
|
+
},
|
35
|
+
{
|
36
|
+
"name":"TargetName2",
|
37
|
+
"icon_path":"/relative/path/to/file.png",
|
38
|
+
"launch_phone_p_path":"/relative/path/to/file2.png",
|
39
|
+
"info_plist": {
|
40
|
+
"CFBundleIdentifier":"com.company.target2",
|
41
|
+
"ProprietaryKey":"Value2"
|
42
|
+
}
|
43
|
+
}
|
44
|
+
],
|
45
|
+
"global_info_keys":{
|
46
|
+
"somekey":"somevalue"
|
47
|
+
},
|
48
|
+
"devices":["iPhone","iPad"]
|
49
|
+
}')
|
50
|
+
end
|
51
|
+
Longbow::green ' longbow.json created' unless $nolog
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'highline/import'
|
2
|
+
require 'colors'
|
3
|
+
|
4
|
+
module Xcodebump
|
5
|
+
def self.update_version_number release, minor, patch
|
6
|
+
# Find Plist Paths
|
7
|
+
plist_paths = []
|
8
|
+
Dir.glob(Dir.pwd + '/**/*.plist').each do |d|
|
9
|
+
plist_paths << d if d.include? '-Info.plist'
|
10
|
+
end
|
11
|
+
Xcodebump::red "\n No Plist files found.\n\n Please run this from a directory where an Xcode Project/Workspace lives.\n" unless plist_paths.size > 0
|
12
|
+
return unless plist_paths.size > 0
|
13
|
+
|
14
|
+
# Ask User which one to Bump
|
15
|
+
Xcodebump::blue "\n Please choose one of the follwing to bump the version number:"
|
16
|
+
plist_paths.each_with_index do |p, i|
|
17
|
+
components = p.split('/')
|
18
|
+
puts " [#{i.to_s}] #{components[components.size - 1]}"
|
19
|
+
end
|
20
|
+
puts
|
21
|
+
|
22
|
+
index = ask(" Plist to Modify? ")
|
23
|
+
path = nil
|
24
|
+
if plist_paths.size > index.to_i
|
25
|
+
path = plist_paths[index.to_i]
|
26
|
+
end
|
27
|
+
return unless path
|
28
|
+
|
29
|
+
# Edit Version Number
|
30
|
+
plist_text = File.read path
|
31
|
+
# Find Keys, bump them
|
32
|
+
keys = ['CFBundleVersion','CFBundleShortVersionString']
|
33
|
+
new_version = ''
|
34
|
+
keys.each do |k|
|
35
|
+
matches = plist_text.match /<key>#{k}<\/key>\s*<(.*?)>.*<\/(.*?)>/
|
36
|
+
if matches
|
37
|
+
key_start = "<string>"
|
38
|
+
key_end = "</string>"
|
39
|
+
v = matches[0][/#{key_start}(.*?)#{key_end}/m, 1]
|
40
|
+
v_new = new_version_string v, release, minor, patch
|
41
|
+
new_version = v_new
|
42
|
+
replace_string = matches[0].sub(/<string>.*<\/string>/, "<string>#{v_new}</string>")
|
43
|
+
plist_text = plist_text.gsub(matches[0], replace_string)
|
44
|
+
else
|
45
|
+
v = '0.0.0'
|
46
|
+
v = new_version_string v, release, minor, patch
|
47
|
+
plist_text = plist_text.sub(/<\/dict>\s*<\/plist>/, "<key>#{k}</key>\n<string>#{v}</string>\n</dict></plist>")
|
48
|
+
end
|
49
|
+
|
50
|
+
# Save File
|
51
|
+
File.open(path, 'w') do |f|
|
52
|
+
f.write plist_text
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
# Write to Console
|
57
|
+
components = path.split('/')
|
58
|
+
plist = components[components.size - 1]
|
59
|
+
Xcodebump::green "\n #{plist} updated to #{new_version}\n"
|
60
|
+
end
|
61
|
+
|
62
|
+
|
63
|
+
def self.new_version_string v, release, minor, patch
|
64
|
+
v_components = v.split('.')
|
65
|
+
v_components << '0' if v_components.size < 3
|
66
|
+
v_components[0] = (v_components[0].to_i + 1).to_s if release
|
67
|
+
v_components[1] = (v_components[1].to_i + 1).to_s if minor
|
68
|
+
v_components[2] = (v_components[2].to_i + 1).to_s if patch
|
69
|
+
return v_components.join('.')
|
70
|
+
end
|
71
|
+
end
|
data/lib/xcodebump.rb
ADDED
metadata
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: xcodebump
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- bennyguitar
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-07-18 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.6'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '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: '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
|
+
description: Quickly and easily bump your build and version numbers for an Xcode project
|
56
|
+
or workspace.
|
57
|
+
email:
|
58
|
+
- brgordon@ua.edu
|
59
|
+
executables:
|
60
|
+
- xcodebump
|
61
|
+
extensions: []
|
62
|
+
extra_rdoc_files: []
|
63
|
+
files:
|
64
|
+
- ./Gemfile
|
65
|
+
- ./Gemfile.lock
|
66
|
+
- ./lib/xcodebump/colors.rb
|
67
|
+
- ./lib/xcodebump/commands/bump.rb
|
68
|
+
- ./lib/xcodebump/commands/install.rb
|
69
|
+
- ./lib/xcodebump/commands.rb
|
70
|
+
- ./lib/xcodebump/plist.rb
|
71
|
+
- ./lib/xcodebump/version.rb
|
72
|
+
- ./lib/xcodebump.rb
|
73
|
+
- ./LICENSE.txt
|
74
|
+
- ./Rakefile
|
75
|
+
- ./README.md
|
76
|
+
- bin/xcodebump
|
77
|
+
homepage: https://github.com/intermark/xcodebump
|
78
|
+
licenses:
|
79
|
+
- MIT
|
80
|
+
metadata: {}
|
81
|
+
post_install_message:
|
82
|
+
rdoc_options: []
|
83
|
+
require_paths:
|
84
|
+
- lib
|
85
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - '>='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
requirements: []
|
96
|
+
rubyforge_project:
|
97
|
+
rubygems_version: 2.1.11
|
98
|
+
signing_key:
|
99
|
+
specification_version: 4
|
100
|
+
summary: Semantic versioning for Xcode made simple.
|
101
|
+
test_files: []
|