nanping 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +3 -0
- data/Gemfile.lock +22 -0
- data/LICENSE +20 -0
- data/README.md +52 -0
- data/Rakefile +9 -0
- data/bin/iosbuild +24 -0
- data/lib/nanping/commands/plist.rb +90 -0
- data/lib/nanping/commands.rb +4 -0
- data/lib/nanping/version.rb +3 -0
- data/lib/nanping.rb +1 -0
- data/nanping.gemspec +25 -0
- metadata +111 -0
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
nanping (0.0.1)
|
5
|
+
commander (~> 4.1)
|
6
|
+
json (~> 1.8)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
commander (4.1.6)
|
12
|
+
highline (~> 1.6.11)
|
13
|
+
highline (1.6.20)
|
14
|
+
json (1.8.1)
|
15
|
+
rake (10.1.1)
|
16
|
+
|
17
|
+
PLATFORMS
|
18
|
+
ruby
|
19
|
+
|
20
|
+
DEPENDENCIES
|
21
|
+
nanping!
|
22
|
+
rake
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 udaypandey
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
Nanping
|
2
|
+
=======
|
3
|
+
|
4
|
+
plist tweaks for ios builds
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
$ gem install nanping
|
9
|
+
|
10
|
+
## Usage
|
11
|
+
|
12
|
+
Provides few extra commands for ios build related to plist changes. Inspired from [Shenzhen](https://github.com/nomad/shenzhen)
|
13
|
+
|
14
|
+
nanping adds the `iosbuild` command to your PATH:
|
15
|
+
|
16
|
+
$ iosbuild
|
17
|
+
|
18
|
+
Build and distribute iOS apps (.ipa files)
|
19
|
+
|
20
|
+
Commands:
|
21
|
+
help Display global or [command] help documentation.
|
22
|
+
plist:buildnumber Update build number properties in application plist file
|
23
|
+
plist:configure Update properties in application plist file
|
24
|
+
plist:read Read properties in application plist file
|
25
|
+
|
26
|
+
Aliases:
|
27
|
+
|
28
|
+
Global Options:
|
29
|
+
-h, --help Display help documentation
|
30
|
+
-v, --version Display version information
|
31
|
+
-t, --trace Display backtrace when an error occurs
|
32
|
+
|
33
|
+
### Example Usage
|
34
|
+
|
35
|
+
$ cd /path/to/iOS Project/
|
36
|
+
$ iosbuild plist:buildnumber --file "$PLIST_FILE" \
|
37
|
+
--infix Trial
|
38
|
+
--buildnumber $JENKINS_BUILD_NUMBER
|
39
|
+
$ iosbuild plist:configure --file "$PLIST_FILE" \
|
40
|
+
CFBundleDisplayName='Hours Trial' \
|
41
|
+
CFBundleIdentifier=com.thirstysea.trial.hours
|
42
|
+
|
43
|
+
## Contact
|
44
|
+
|
45
|
+
Uday Pandey
|
46
|
+
|
47
|
+
- http://github.com/udaypandey
|
48
|
+
- uday.pandey@gmail.com
|
49
|
+
|
50
|
+
## License
|
51
|
+
|
52
|
+
Nanping is available under the MIT license. See the LICENSE file for more info.
|
data/Rakefile
ADDED
data/bin/iosbuild
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'dotenv'
|
4
|
+
Dotenv.load
|
5
|
+
|
6
|
+
require 'commander/import'
|
7
|
+
|
8
|
+
$:.push File.expand_path("../../lib", __FILE__)
|
9
|
+
require 'iosbuild'
|
10
|
+
|
11
|
+
HighLine.track_eof = false # Fix for built-in Ruby
|
12
|
+
|
13
|
+
program :version, Iosbuild::VERSION
|
14
|
+
program :description, 'Tweak plist file for iOS apps'
|
15
|
+
|
16
|
+
program :help, 'Author', 'Uday Pandey <uday.pandey@gmail.com>'
|
17
|
+
program :help, 'Website', 'http://www.thirstysea.com'
|
18
|
+
program :help_formatter, :compact
|
19
|
+
|
20
|
+
global_option('--verbose') { $verbose = true }
|
21
|
+
|
22
|
+
default_command :help
|
23
|
+
|
24
|
+
require 'iosbuild/commands'
|
@@ -0,0 +1,90 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
command :'plist:configure' do |c|
|
4
|
+
c.syntax = "ipa plist:configure [options] [key=value]"
|
5
|
+
c.summary = "Update properties in application plist file"
|
6
|
+
c.description = ""
|
7
|
+
c.option '-f', '--file FILE', "project plist file for the build"
|
8
|
+
|
9
|
+
c.action do |args, options|
|
10
|
+
@file = options.file
|
11
|
+
say_error "Missing or unspecified plist file" and abort unless @file and File.exist?(@file)
|
12
|
+
@file = File.absolute_path(@file)
|
13
|
+
|
14
|
+
args.each do |arg|
|
15
|
+
(plist_key, plist_value) = arg.split("=")
|
16
|
+
if plist_key.nil? or plist_key.empty? or plist_value.nil? or plist_value.empty? then
|
17
|
+
say_warning "invalid k/v pair #{@arg}" if $verbose
|
18
|
+
next
|
19
|
+
end
|
20
|
+
|
21
|
+
plist_orig_value = `defaults read #{@file} #{plist_key} #{'2> /dev/null' unless $verbose}`
|
22
|
+
plist_orig_value.strip!
|
23
|
+
|
24
|
+
log "configure:plist", "key:#{plist_key}", "orig:#{(plist_orig_value || "not present")}", "new:#{plist_value}"
|
25
|
+
|
26
|
+
say_error "configure:plist error updating k/v" and abort unless system %{defaults write #{@file} #{plist_key} '#{plist_value}' #{'1> /dev/null' unless $verbose}}
|
27
|
+
say_error "configure:plist error converting back to xml" and abort unless system %{plutil -convert xml1 #{@file} #{'1> /dev/null' unless $verbose}}
|
28
|
+
end
|
29
|
+
|
30
|
+
say_ok "plist successfully updated"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
command :'plist:buildnumber' do |c|
|
35
|
+
c.syntax = "ipa plist:buildnumber [options]"
|
36
|
+
c.summary = "Update build number properties in application plist file"
|
37
|
+
c.description = ""
|
38
|
+
c.option '-f', '--file FILE', "project plist file for the build"
|
39
|
+
c.option '-i', '--infix INFIX', "Infix if any for build identifier (Trial.Daily in 18.Trial.Daily.593)"
|
40
|
+
c.option '-n', '--buildnumber NUMBER', "Running build number if any for build identifier (593 in 18.Trial.Daily.593)"
|
41
|
+
|
42
|
+
c.action do |args, options|
|
43
|
+
@file = options.file
|
44
|
+
say_error "configure:buildnumber Missing or unspecified plist file" and abort unless @file and File.exist?(@file)
|
45
|
+
@file = File.absolute_path(@file)
|
46
|
+
|
47
|
+
@infix = options.infix
|
48
|
+
say_error "configure:buildnumber Missing or unspecified build infix" and abort unless @infix
|
49
|
+
@infix.strip!
|
50
|
+
say_error "configure:buildnumber Missing or unspecified build infix" and abort unless @infix and not (@infix.nil? or @infix.empty?)
|
51
|
+
|
52
|
+
@buildnumber = options.buildnumber
|
53
|
+
say_error "configure:buildnumber Missing or unspecified build number" and abort unless @buildnumber
|
54
|
+
@buildnumber.strip!
|
55
|
+
say_error "configure:buildnumber Missing or unspecified build number" and abort unless @buildnumber and not (@buildnumber.nil? or @buildnumber.empty?)
|
56
|
+
|
57
|
+
plist_key = 'CFBundleVersion'
|
58
|
+
plist_orig_value = `defaults read #{@file} #{plist_key} #{'2> /dev/null' unless $verbose}`
|
59
|
+
plist_orig_value.strip!
|
60
|
+
say_error "plist:buildnumber error reading #{plist_key}" and abort unless plist_orig_value
|
61
|
+
|
62
|
+
plist_value = plist_orig_value + ".#{@infix}.#{@buildnumber}"
|
63
|
+
|
64
|
+
log "configure:plist:buildnumber", "key:#{plist_key}", "orig:#{(plist_orig_value || "not present")}", "new:#{plist_value}"
|
65
|
+
|
66
|
+
say_error "plist:buildnumber error updating #{plist_key}" and abort unless system %{defaults write #{@file} #{plist_key} '#{plist_value}' #{'1> /dev/null' unless $verbose}}
|
67
|
+
say_error "configure:plist error converting back to xml" and abort unless system %{plutil -convert xml1 #{@file} #{'1> /dev/null' unless $verbose}}
|
68
|
+
|
69
|
+
say_ok "plist:buildnumber successfully updated"
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
command :'plist:read' do |c|
|
74
|
+
c.syntax = "ipa configure:plist [options]"
|
75
|
+
c.summary = "Read properties in application plist file"
|
76
|
+
c.description = ""
|
77
|
+
c.option '-f', '--file FILE', "project plist file for the build"
|
78
|
+
|
79
|
+
c.action do |args, options|
|
80
|
+
@file = options.file
|
81
|
+
say_error "Missing or unspecified plist file" and abort unless @file and File.exist?(@file)
|
82
|
+
@file = File.absolute_path(@file)
|
83
|
+
|
84
|
+
args.each do |arg|
|
85
|
+
plist_orig_value = `defaults read #{@file} #{arg} #{'2> /dev/null' unless $verbose}`
|
86
|
+
plist_orig_value.strip!
|
87
|
+
say_ok plist_orig_value
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
data/lib/nanping.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'nanping/version'
|
data/nanping.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
|
4
|
+
require "nanping/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "nanping"
|
8
|
+
s.authors = ["Uday Pandey"]
|
9
|
+
s.email = "uday.pandey@gmail.com"
|
10
|
+
s.homepage = "http://www.thirstysea.com"
|
11
|
+
s.version = Nanping::VERSION
|
12
|
+
s.platform = Gem::Platform::RUBY
|
13
|
+
s.summary = "nanping"
|
14
|
+
s.description = "CLI for tweaking plist files for Building & Distributing iOS Apps (.ipa Files)"
|
15
|
+
|
16
|
+
s.add_dependency "commander", "~> 4.1"
|
17
|
+
s.add_dependency "json", "~> 1.8"
|
18
|
+
|
19
|
+
s.add_development_dependency "rake"
|
20
|
+
|
21
|
+
s.files = Dir["./**/*"].reject { |file| file =~ /\.\/(bin|log|pkg|script|spec|test|vendor)/ }
|
22
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
23
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
24
|
+
s.require_paths = ["lib"]
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: nanping
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Uday Pandey
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2014-02-17 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: commander
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '4.1'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '4.1'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: json
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '1.8'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '1.8'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rake
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
description: CLI for tweaking plist files for Building & Distributing iOS Apps (.ipa
|
63
|
+
Files)
|
64
|
+
email: uday.pandey@gmail.com
|
65
|
+
executables:
|
66
|
+
- iosbuild
|
67
|
+
extensions: []
|
68
|
+
extra_rdoc_files: []
|
69
|
+
files:
|
70
|
+
- ./Gemfile
|
71
|
+
- ./Gemfile.lock
|
72
|
+
- ./lib/nanping/commands/plist.rb
|
73
|
+
- ./lib/nanping/commands.rb
|
74
|
+
- ./lib/nanping/version.rb
|
75
|
+
- ./lib/nanping.rb
|
76
|
+
- ./LICENSE
|
77
|
+
- ./nanping.gemspec
|
78
|
+
- ./Rakefile
|
79
|
+
- ./README.md
|
80
|
+
- bin/iosbuild
|
81
|
+
homepage: http://www.thirstysea.com
|
82
|
+
licenses: []
|
83
|
+
post_install_message:
|
84
|
+
rdoc_options: []
|
85
|
+
require_paths:
|
86
|
+
- lib
|
87
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
88
|
+
none: false
|
89
|
+
requirements:
|
90
|
+
- - ! '>='
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
segments:
|
94
|
+
- 0
|
95
|
+
hash: 4570282699060700252
|
96
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
segments:
|
103
|
+
- 0
|
104
|
+
hash: 4570282699060700252
|
105
|
+
requirements: []
|
106
|
+
rubyforge_project:
|
107
|
+
rubygems_version: 1.8.23
|
108
|
+
signing_key:
|
109
|
+
specification_version: 3
|
110
|
+
summary: nanping
|
111
|
+
test_files: []
|