harukaze 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ harukaze.tmproj
2
+ pkg
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Andrey Subbotin
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,17 @@
1
+ = harukaze
2
+
3
+ A tool to simplify building of your iPhone app for ad hoc distribution or submitting to the App Store.
4
+
5
+ == Note on Patches/Pull Requests
6
+
7
+ * Fork the project.
8
+ * Make your feature addition or bug fix.
9
+ * Add tests for it. This is important so I don't break it in a
10
+ future version unintentionally.
11
+ * Commit, do not mess with rakefile, version, or history.
12
+ (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
13
+ * Send me a pull request. Bonus points for topic branches.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2010 Andrey Subbotin. See LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1,21 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "harukaze"
8
+ gem.summary = %Q{iPhone Ad Hoc / App Store builds made easy.}
9
+ gem.description = %Q{A tool to simplify building of your iPhone app for ad hoc distribution or submitting to the App Store.}
10
+ gem.email = "andrey@subbotin.me"
11
+ gem.homepage = "http://github.com/eploko/harukaze"
12
+ gem.authors = ["Andrey Subbotin"]
13
+ gem.executables = ['harukaze']
14
+ gem.default_executable = ['harukaze']
15
+ gem.add_dependency "term-ansicolor"
16
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
17
+ end
18
+ Jeweler::GemcutterTasks.new
19
+ rescue LoadError
20
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
21
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.2.0
data/bin/harukaze ADDED
@@ -0,0 +1,175 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'fileutils'
5
+ require 'term/ansicolor'
6
+ require 'tmpdir'
7
+ require 'yaml'
8
+
9
+ include Term::ANSIColor
10
+
11
+ def main
12
+ banner
13
+ check_args
14
+ config = setup
15
+ print_config config
16
+ Dir.mkdir config['tmp_dir']
17
+ bump_versions(config)
18
+ xcodebuild(config['src_dir'], config['project'], config['sdk'], config['target'], config['configuration'])
19
+ commit_build(config)
20
+ zip_build(config)
21
+ copy_build(config)
22
+ FileUtils.rm_rf config['tmp_dir'], :verbose => true
23
+ success "All done!"
24
+ end
25
+
26
+ def banner
27
+ puts "Harukaze v1.2.0"
28
+ puts "© 2010 Andrey Subbotin <andrey@subbotin.me>"
29
+ end
30
+
31
+ def usage
32
+ puts ""
33
+ puts "Usage: harukaze <model> [<rules.harukaze>]"
34
+ puts ""
35
+ puts "<model> = adhoc | appstore"
36
+ puts "<rules.harukaze> = harukaze config file, default is rules.harukaze"
37
+ end
38
+
39
+ def check_args
40
+ if (ARGV.length == 0)
41
+ usage
42
+ exit 1
43
+ elsif (ARGV.length == 1)
44
+ unless (ARGV[0] == 'adhoc' || ARGV[0] == 'appstore')
45
+ usage
46
+ exit 1
47
+ end
48
+ end
49
+ end
50
+
51
+ def setup
52
+ result = Hash.new
53
+ global_config_filename = File.expand_path('~/.harukaze')
54
+ if (File.exist?(global_config_filename))
55
+ result.merge!(YAML.load_file(global_config_filename))
56
+ end
57
+ config = YAML.load_file(ARGV[1].nil? ? 'rules.harukaze' : ARGV[1])
58
+ config = config['common'].merge(config[ARGV[0]])
59
+ config['tmp_dir'] = File.join Dir.tmpdir, "epl.builder.#{$$}"
60
+ config['startwd'] = Dir.getwd
61
+ config['src_dir'] = config['startwd']
62
+ config['build_results_dir'] = File.join config['src_dir'], 'build',
63
+ "#{config['configuration']}-#{config['build_dir_suffix']}"
64
+ config['payload_target'] = File.join config['tmp_dir'], 'payload'
65
+ config['mode'] = ARGV[0]
66
+ result.merge!(config)
67
+ result['builds_folder'] = File.expand_path(result['builds_folder'])
68
+ result['products_folder'] = File.expand_path(result['products_folder'])
69
+ result
70
+ end
71
+
72
+ def print_config(config)
73
+ # Print out settings
74
+ status "CONFIG"
75
+ y config
76
+ end
77
+
78
+ def exe(cmd)
79
+ print magenta, "CMD: '#{cmd}'", reset, "\n"
80
+ system cmd
81
+ end
82
+
83
+ def status(msg)
84
+ print blue, "--- #{msg} ---", reset, "\n"
85
+ end
86
+
87
+ def error(msg)
88
+ print red, bold, 'ERROR: ', msg, reset, "\n"
89
+ exit 1
90
+ end
91
+
92
+ def success(msg)
93
+ print green, bold, 'SUCCESS: ', msg, reset, "\n"
94
+ end
95
+
96
+ def xcodebuild(src_dir, project, sdk, target, configuration)
97
+ Dir.chdir src_dir
98
+ status "BUILDING"
99
+ rc = exe "xcodebuild -project '#{project}' -sdk '#{sdk}' -target '#{target}' -configuration '#{configuration}'"
100
+ error "Failed to build the project!" unless rc
101
+ Dir.chdir src_dir
102
+ end
103
+
104
+ def bump_versions(config)
105
+ status "BUMPING VERSIONS"
106
+ rc = exe 'agvtool bump -all'
107
+
108
+ error "Failed to bump the build number!" unless rc
109
+ rc = exe "agvtool new-marketing-version #{config['marketing_version']}"
110
+ error "Failed to set the marketing version!" unless rc
111
+ config['current_version'] = `agvtool what-version -terse`.chomp!
112
+ config['current_marketing_version'] = `agvtool what-marketing-version -terse1`.chomp!
113
+ end
114
+
115
+ def commit_build(config)
116
+ # commit
117
+ status "COMMITING BUILD"
118
+ rc = exe "git commit -a -m 'Successful build #{config['current_version']} for v#{config['current_marketing_version']}'"
119
+ error "Failed to commit the build!" unless rc
120
+
121
+ # remember the SHA1 for the build
122
+ config['git_sha'] = `git rev-parse --short HEAD`.chomp!
123
+
124
+ # tag the build
125
+ status "TAGGING BUILD"
126
+ config['git_tag'] = "v#{config['current_marketing_version']}-b#{config['current_version']}";
127
+ rc = exe "git tag -s -m 'Tagging version #{config['current_marketing_version']}, build #{config['current_version']}' " +
128
+ "'#{config['git_tag']}'"
129
+ error "Failed to tag the build!" unless rc
130
+
131
+ # # pull whatever is there
132
+ # status "PULLING ORIGIN MASTER"
133
+ # rc = exe "git pull origin master"
134
+ # error "Failed to pull origin master!" unless rc
135
+ #
136
+ # # push whatever is here
137
+ # status "PUSHING ORIGIN MASTER"
138
+ # rc = exe "git push origin master"
139
+ # error "Failed to push origin master!" unless rc
140
+
141
+ # push the tag
142
+ status "PUSHING THE NEW TAG"
143
+ rc = exe "git push origin tag '#{config['git_tag']}'"
144
+ error "Failed to push the tag!" unless rc
145
+ end
146
+
147
+ def zip_build(config)
148
+ status "ZIPPING THE BUILD"
149
+ Dir.chdir config['build_results_dir']
150
+ config['buildbase'] = ("#{config['zip_prefix']}_#{config['current_marketing_version']}_" +
151
+ "#{config['configuration']}_b#{config['current_version']}_#{config['git_sha']}_" +
152
+ Time.now.strftime('%Y%m%d')).gsub('.', '_').gsub('-', '_')
153
+ config['zipname'] = config['buildbase'] + '.zip'
154
+ config['zipname_absolute'] = File.join config['tmp_dir'], config['zipname']
155
+ exe "zip -r -9 -y '#{config['zipname_absolute']}' *.app"
156
+ unless config['mode'] == 'appstore'
157
+ exe "zip -r -9 -y '#{config['zipname_absolute']}' *.app.dSYM"
158
+ end
159
+ unless config['payload'].nil?
160
+ Dir.chdir File.join(config['src_dir'], config['payload'])
161
+ exe "zip -r -9 -y '#{config['zipname_absolute']}' ."
162
+ end
163
+ FileUtils.mv config['zipname_absolute'], config['products_folder'], :verbose => true
164
+ end
165
+
166
+ def copy_build(config)
167
+ status "POPULATING BUILDS FOLDER"
168
+ build_folder = File.join(config['builds_folder'], config['buildbase'])
169
+ exe "mkdir -p \"#{build_folder}\""
170
+ FileUtils.cp_r Dir.glob(File.join(config['build_results_dir'], '*')),
171
+ build_folder, :verbose => true
172
+ end
173
+
174
+ main
175
+ exit 0
data/harukaze.gemspec ADDED
@@ -0,0 +1,50 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{harukaze}
8
+ s.version = "1.2.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Andrey Subbotin"]
12
+ s.date = %q{2010-04-20}
13
+ s.default_executable = ["harukaze"]
14
+ s.description = %q{A tool to simplify building of your iPhone app for ad hoc distribution or submitting to the App Store.}
15
+ s.email = %q{andrey@subbotin.me}
16
+ s.executables = ["harukaze"]
17
+ s.extra_rdoc_files = [
18
+ "LICENSE",
19
+ "README.rdoc"
20
+ ]
21
+ s.files = [
22
+ ".gitignore",
23
+ "LICENSE",
24
+ "README.rdoc",
25
+ "Rakefile",
26
+ "VERSION",
27
+ "bin/harukaze",
28
+ "harukaze.gemspec",
29
+ "lib/harukaze.rb"
30
+ ]
31
+ s.homepage = %q{http://github.com/eploko/harukaze}
32
+ s.rdoc_options = ["--charset=UTF-8"]
33
+ s.require_paths = ["lib"]
34
+ s.rubygems_version = %q{1.3.6}
35
+ s.summary = %q{iPhone Ad Hoc / App Store builds made easy.}
36
+
37
+ if s.respond_to? :specification_version then
38
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
39
+ s.specification_version = 3
40
+
41
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
42
+ s.add_runtime_dependency(%q<term-ansicolor>, [">= 0"])
43
+ else
44
+ s.add_dependency(%q<term-ansicolor>, [">= 0"])
45
+ end
46
+ else
47
+ s.add_dependency(%q<term-ansicolor>, [">= 0"])
48
+ end
49
+ end
50
+
data/lib/harukaze.rb ADDED
File without changes
metadata ADDED
@@ -0,0 +1,82 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: harukaze
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 1
7
+ - 2
8
+ - 0
9
+ version: 1.2.0
10
+ platform: ruby
11
+ authors:
12
+ - Andrey Subbotin
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-04-20 00:00:00 +04:00
18
+ default_executable:
19
+ - harukaze
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: term-ansicolor
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 0
30
+ version: "0"
31
+ type: :runtime
32
+ version_requirements: *id001
33
+ description: A tool to simplify building of your iPhone app for ad hoc distribution or submitting to the App Store.
34
+ email: andrey@subbotin.me
35
+ executables:
36
+ - harukaze
37
+ extensions: []
38
+
39
+ extra_rdoc_files:
40
+ - LICENSE
41
+ - README.rdoc
42
+ files:
43
+ - .gitignore
44
+ - LICENSE
45
+ - README.rdoc
46
+ - Rakefile
47
+ - VERSION
48
+ - bin/harukaze
49
+ - harukaze.gemspec
50
+ - lib/harukaze.rb
51
+ has_rdoc: true
52
+ homepage: http://github.com/eploko/harukaze
53
+ licenses: []
54
+
55
+ post_install_message:
56
+ rdoc_options:
57
+ - --charset=UTF-8
58
+ require_paths:
59
+ - lib
60
+ required_ruby_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ segments:
65
+ - 0
66
+ version: "0"
67
+ required_rubygems_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ segments:
72
+ - 0
73
+ version: "0"
74
+ requirements: []
75
+
76
+ rubyforge_project:
77
+ rubygems_version: 1.3.6
78
+ signing_key:
79
+ specification_version: 3
80
+ summary: iPhone Ad Hoc / App Store builds made easy.
81
+ test_files: []
82
+