cocoaout 0.0.2
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 +7 -0
- data/.gitignore +1 -0
- data/CHANGES.md +10 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +26 -0
- data/LICENSE +191 -0
- data/README.md +46 -0
- data/bin/cocoaout +4 -0
- data/cocoaout.gemspec +18 -0
- data/lib/cocoaout/command.rb +161 -0
- data/lib/cocoaout/config.rb +33 -0
- data/lib/cocoaout/templates/Cocoaoutfile.erb +15 -0
- data/lib/cocoaout.rb +3 -0
- metadata +71 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: f5490dffeae56a37e5f11569f2a4c9ccb62fa161
|
|
4
|
+
data.tar.gz: 0bd8cb7e64deca52e163e565106bba6389b5c781
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: b579fc0aa7ca334097ba28835b59a7e917ad8ada4f5e9bc6d9acf402220d1cfdb0cea8bacb3304aefaeace132fba7d5ffd1268a6470868b57673705d786bc675
|
|
7
|
+
data.tar.gz: 71079cf5d4c7e2b90514515436a6d4b14259fba9398da1086254d518f4cb194492c7904aed0eed3fc5999d87152867834770cb8ba79463851b0f581d8e473e7b
|
data/.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
*.gem
|
data/CHANGES.md
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
cocoaout (0.0.2)
|
|
5
|
+
thor (>= 0.18)
|
|
6
|
+
|
|
7
|
+
GEM
|
|
8
|
+
remote: https://rubygems.org/
|
|
9
|
+
specs:
|
|
10
|
+
diff-lcs (1.2.4)
|
|
11
|
+
rspec (2.14.1)
|
|
12
|
+
rspec-core (~> 2.14.0)
|
|
13
|
+
rspec-expectations (~> 2.14.0)
|
|
14
|
+
rspec-mocks (~> 2.14.0)
|
|
15
|
+
rspec-core (2.14.5)
|
|
16
|
+
rspec-expectations (2.14.2)
|
|
17
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
|
18
|
+
rspec-mocks (2.14.3)
|
|
19
|
+
thor (0.18.1)
|
|
20
|
+
|
|
21
|
+
PLATFORMS
|
|
22
|
+
ruby
|
|
23
|
+
|
|
24
|
+
DEPENDENCIES
|
|
25
|
+
cocoaout!
|
|
26
|
+
rspec
|
data/LICENSE
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction, and
|
|
10
|
+
distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by the copyright
|
|
13
|
+
owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all other entities
|
|
16
|
+
that control, are controlled by, or are under common control with that entity.
|
|
17
|
+
For the purposes of this definition, "control" means (i) the power, direct or
|
|
18
|
+
indirect, to cause the direction or management of such entity, whether by
|
|
19
|
+
contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
20
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
21
|
+
|
|
22
|
+
"You" (or "Your") shall mean an individual or Legal Entity exercising
|
|
23
|
+
permissions granted by this License.
|
|
24
|
+
|
|
25
|
+
"Source" form shall mean the preferred form for making modifications, including
|
|
26
|
+
but not limited to software source code, documentation source, and configuration
|
|
27
|
+
files.
|
|
28
|
+
|
|
29
|
+
"Object" form shall mean any form resulting from mechanical transformation or
|
|
30
|
+
translation of a Source form, including but not limited to compiled object code,
|
|
31
|
+
generated documentation, and conversions to other media types.
|
|
32
|
+
|
|
33
|
+
"Work" shall mean the work of authorship, whether in Source or Object form, made
|
|
34
|
+
available under the License, as indicated by a copyright notice that is included
|
|
35
|
+
in or attached to the work (an example is provided in the Appendix below).
|
|
36
|
+
|
|
37
|
+
"Derivative Works" shall mean any work, whether in Source or Object form, that
|
|
38
|
+
is based on (or derived from) the Work and for which the editorial revisions,
|
|
39
|
+
annotations, elaborations, or other modifications represent, as a whole, an
|
|
40
|
+
original work of authorship. For the purposes of this License, Derivative Works
|
|
41
|
+
shall not include works that remain separable from, or merely link (or bind by
|
|
42
|
+
name) to the interfaces of, the Work and Derivative Works thereof.
|
|
43
|
+
|
|
44
|
+
"Contribution" shall mean any work of authorship, including the original version
|
|
45
|
+
of the Work and any modifications or additions to that Work or Derivative Works
|
|
46
|
+
thereof, that is intentionally submitted to Licensor for inclusion in the Work
|
|
47
|
+
by the copyright owner or by an individual or Legal Entity authorized to submit
|
|
48
|
+
on behalf of the copyright owner. For the purposes of this definition,
|
|
49
|
+
"submitted" means any form of electronic, verbal, or written communication sent
|
|
50
|
+
to the Licensor or its representatives, including but not limited to
|
|
51
|
+
communication on electronic mailing lists, source code control systems, and
|
|
52
|
+
issue tracking systems that are managed by, or on behalf of, the Licensor for
|
|
53
|
+
the purpose of discussing and improving the Work, but excluding communication
|
|
54
|
+
that is conspicuously marked or otherwise designated in writing by the copyright
|
|
55
|
+
owner as "Not a Contribution."
|
|
56
|
+
|
|
57
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
|
|
58
|
+
of whom a Contribution has been received by Licensor and subsequently
|
|
59
|
+
incorporated within the Work.
|
|
60
|
+
|
|
61
|
+
2. Grant of Copyright License.
|
|
62
|
+
|
|
63
|
+
Subject to the terms and conditions of this License, each Contributor hereby
|
|
64
|
+
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
|
65
|
+
irrevocable copyright license to reproduce, prepare Derivative Works of,
|
|
66
|
+
publicly display, publicly perform, sublicense, and distribute the Work and such
|
|
67
|
+
Derivative Works in Source or Object form.
|
|
68
|
+
|
|
69
|
+
3. Grant of Patent License.
|
|
70
|
+
|
|
71
|
+
Subject to the terms and conditions of this License, each Contributor hereby
|
|
72
|
+
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
|
73
|
+
irrevocable (except as stated in this section) patent license to make, have
|
|
74
|
+
made, use, offer to sell, sell, import, and otherwise transfer the Work, where
|
|
75
|
+
such license applies only to those patent claims licensable by such Contributor
|
|
76
|
+
that are necessarily infringed by their Contribution(s) alone or by combination
|
|
77
|
+
of their Contribution(s) with the Work to which such Contribution(s) was
|
|
78
|
+
submitted. If You institute patent litigation against any entity (including a
|
|
79
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work or a
|
|
80
|
+
Contribution incorporated within the Work constitutes direct or contributory
|
|
81
|
+
patent infringement, then any patent licenses granted to You under this License
|
|
82
|
+
for that Work shall terminate as of the date such litigation is filed.
|
|
83
|
+
|
|
84
|
+
4. Redistribution.
|
|
85
|
+
|
|
86
|
+
You may reproduce and distribute copies of the Work or Derivative Works thereof
|
|
87
|
+
in any medium, with or without modifications, and in Source or Object form,
|
|
88
|
+
provided that You meet the following conditions:
|
|
89
|
+
|
|
90
|
+
You must give any other recipients of the Work or Derivative Works a copy of
|
|
91
|
+
this License; and
|
|
92
|
+
You must cause any modified files to carry prominent notices stating that You
|
|
93
|
+
changed the files; and
|
|
94
|
+
You must retain, in the Source form of any Derivative Works that You distribute,
|
|
95
|
+
all copyright, patent, trademark, and attribution notices from the Source form
|
|
96
|
+
of the Work, excluding those notices that do not pertain to any part of the
|
|
97
|
+
Derivative Works; and
|
|
98
|
+
If the Work includes a "NOTICE" text file as part of its distribution, then any
|
|
99
|
+
Derivative Works that You distribute must include a readable copy of the
|
|
100
|
+
attribution notices contained within such NOTICE file, excluding those notices
|
|
101
|
+
that do not pertain to any part of the Derivative Works, in at least one of the
|
|
102
|
+
following places: within a NOTICE text file distributed as part of the
|
|
103
|
+
Derivative Works; within the Source form or documentation, if provided along
|
|
104
|
+
with the Derivative Works; or, within a display generated by the Derivative
|
|
105
|
+
Works, if and wherever such third-party notices normally appear. The contents of
|
|
106
|
+
the NOTICE file are for informational purposes only and do not modify the
|
|
107
|
+
License. You may add Your own attribution notices within Derivative Works that
|
|
108
|
+
You distribute, alongside or as an addendum to the NOTICE text from the Work,
|
|
109
|
+
provided that such additional attribution notices cannot be construed as
|
|
110
|
+
modifying the License.
|
|
111
|
+
You may add Your own copyright statement to Your modifications and may provide
|
|
112
|
+
additional or different license terms and conditions for use, reproduction, or
|
|
113
|
+
distribution of Your modifications, or for any such Derivative Works as a whole,
|
|
114
|
+
provided Your use, reproduction, and distribution of the Work otherwise complies
|
|
115
|
+
with the conditions stated in this License.
|
|
116
|
+
|
|
117
|
+
5. Submission of Contributions.
|
|
118
|
+
|
|
119
|
+
Unless You explicitly state otherwise, any Contribution intentionally submitted
|
|
120
|
+
for inclusion in the Work by You to the Licensor shall be under the terms and
|
|
121
|
+
conditions of this License, without any additional terms or conditions.
|
|
122
|
+
Notwithstanding the above, nothing herein shall supersede or modify the terms of
|
|
123
|
+
any separate license agreement you may have executed with Licensor regarding
|
|
124
|
+
such Contributions.
|
|
125
|
+
|
|
126
|
+
6. Trademarks.
|
|
127
|
+
|
|
128
|
+
This License does not grant permission to use the trade names, trademarks,
|
|
129
|
+
service marks, or product names of the Licensor, except as required for
|
|
130
|
+
reasonable and customary use in describing the origin of the Work and
|
|
131
|
+
reproducing the content of the NOTICE file.
|
|
132
|
+
|
|
133
|
+
7. Disclaimer of Warranty.
|
|
134
|
+
|
|
135
|
+
Unless required by applicable law or agreed to in writing, Licensor provides the
|
|
136
|
+
Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
137
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
|
|
138
|
+
including, without limitation, any warranties or conditions of TITLE,
|
|
139
|
+
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
|
|
140
|
+
solely responsible for determining the appropriateness of using or
|
|
141
|
+
redistributing the Work and assume any risks associated with Your exercise of
|
|
142
|
+
permissions under this License.
|
|
143
|
+
|
|
144
|
+
8. Limitation of Liability.
|
|
145
|
+
|
|
146
|
+
In no event and under no legal theory, whether in tort (including negligence),
|
|
147
|
+
contract, or otherwise, unless required by applicable law (such as deliberate
|
|
148
|
+
and grossly negligent acts) or agreed to in writing, shall any Contributor be
|
|
149
|
+
liable to You for damages, including any direct, indirect, special, incidental,
|
|
150
|
+
or consequential damages of any character arising as a result of this License or
|
|
151
|
+
out of the use or inability to use the Work (including but not limited to
|
|
152
|
+
damages for loss of goodwill, work stoppage, computer failure or malfunction, or
|
|
153
|
+
any and all other commercial damages or losses), even if such Contributor has
|
|
154
|
+
been advised of the possibility of such damages.
|
|
155
|
+
|
|
156
|
+
9. Accepting Warranty or Additional Liability.
|
|
157
|
+
|
|
158
|
+
While redistributing the Work or Derivative Works thereof, You may choose to
|
|
159
|
+
offer, and charge a fee for, acceptance of support, warranty, indemnity, or
|
|
160
|
+
other liability obligations and/or rights consistent with this License. However,
|
|
161
|
+
in accepting such obligations, You may act only on Your own behalf and on Your
|
|
162
|
+
sole responsibility, not on behalf of any other Contributor, and only if You
|
|
163
|
+
agree to indemnify, defend, and hold each Contributor harmless for any liability
|
|
164
|
+
incurred by, or claims asserted against, such Contributor by reason of your
|
|
165
|
+
accepting any such warranty or additional liability.
|
|
166
|
+
|
|
167
|
+
END OF TERMS AND CONDITIONS
|
|
168
|
+
|
|
169
|
+
APPENDIX: How to apply the Apache License to your work
|
|
170
|
+
|
|
171
|
+
To apply the Apache License to your work, attach the following boilerplate
|
|
172
|
+
notice, with the fields enclosed by brackets "[]" replaced with your own
|
|
173
|
+
identifying information. (Don't include the brackets!) The text should be
|
|
174
|
+
enclosed in the appropriate comment syntax for the file format. We also
|
|
175
|
+
recommend that a file or class name and description of purpose be included on
|
|
176
|
+
the same "printed page" as the copyright notice for easier identification within
|
|
177
|
+
third-party archives.
|
|
178
|
+
|
|
179
|
+
Copyright [yyyy] [name of copyright owner]
|
|
180
|
+
|
|
181
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
182
|
+
you may not use this file except in compliance with the License.
|
|
183
|
+
You may obtain a copy of the License at
|
|
184
|
+
|
|
185
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
186
|
+
|
|
187
|
+
Unless required by applicable law or agreed to in writing, software
|
|
188
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
189
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
190
|
+
See the License for the specific language governing permissions and
|
|
191
|
+
limitations under the License.
|
data/README.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
Cocoaout
|
|
2
|
+
========
|
|
3
|
+
|
|
4
|
+
本工具用于代替 Xcode 编译发布应用,简化来回图形界面点击步骤,同时直接打包 DMG。
|
|
5
|
+
|
|
6
|
+
## 功能
|
|
7
|
+
|
|
8
|
+
* 代替 Xcode 图形界面编译,省去来回点击许多的配置;
|
|
9
|
+
* 固定配置,保证编译环境准确;
|
|
10
|
+
* DMG 自动打包,DMG 支持背景图片;
|
|
11
|
+
|
|
12
|
+
## 环境需求
|
|
13
|
+
|
|
14
|
+
* Xcode 4+
|
|
15
|
+
* Mac OS X
|
|
16
|
+
* Ruby 2.0 (OS X 10.9 自带)
|
|
17
|
+
* RubyGems
|
|
18
|
+
|
|
19
|
+
## 安装
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
gem install cocoaout
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
cocoaout help
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## 创建 Cocoaout 配置文件
|
|
30
|
+
|
|
31
|
+
在你的项目根目录 (.xcworkspace 所在的目录) 执行
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
cocoaout init
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
将会创建 `Cocoaoutfile` 这个文件,请打开根据需要修改配置
|
|
38
|
+
|
|
39
|
+
## 发布 App
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# 自动用 Archive 的方式编译项目,同时打包 DMG 文件
|
|
43
|
+
cocoaout deploy
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
|
data/bin/cocoaout
ADDED
data/cocoaout.gemspec
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Gem::Specification.new do |s|
|
|
2
|
+
s.name = "cocoaout"
|
|
3
|
+
s.version = "0.0.2"
|
|
4
|
+
s.author = "Jason Lee"
|
|
5
|
+
s.email = "huacnlee@gmail.com"
|
|
6
|
+
s.homepage = "https://github.com/huacnlee/cocoaout"
|
|
7
|
+
s.platform = Gem::Platform::RUBY
|
|
8
|
+
s.summary = "Auto build and release tool for Cocoa projects."
|
|
9
|
+
s.description = "Auto build and release tool for Cocoa projects."
|
|
10
|
+
s.required_ruby_version = ">=2.0.0"
|
|
11
|
+
s.licenses = ['Apache V2']
|
|
12
|
+
|
|
13
|
+
s.files = `git ls-files`.split("\n")
|
|
14
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
15
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
|
16
|
+
s.require_paths = ["lib"]
|
|
17
|
+
s.add_runtime_dependency 'thor', '>= 0.18'
|
|
18
|
+
end
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
require "thor"
|
|
2
|
+
|
|
3
|
+
module Cocoaout
|
|
4
|
+
class Command < Thor
|
|
5
|
+
include Thor::Actions
|
|
6
|
+
|
|
7
|
+
attr_accessor :config
|
|
8
|
+
|
|
9
|
+
desc "init [APP_NAME]", "Init Cocoaout for current path"
|
|
10
|
+
method_option :sdk, aliases: %W(-s), type: :string, default: 'macosx10.9',
|
|
11
|
+
desc: "SDK of current project for build (macosx10.8 macosx10.9 iphoneos7.0 iphoneos6.0)"
|
|
12
|
+
method_option :bg_file_name, aliases: %W(-b), type: :string, default: 'dmg_background.tiff',
|
|
13
|
+
desc: "Background image file name with DMG"
|
|
14
|
+
def init(app_name = nil)
|
|
15
|
+
puts "Generate Cocoaoutfile."
|
|
16
|
+
|
|
17
|
+
@sdk = options[:sdk]
|
|
18
|
+
@app_name = app_name || Dir.pwd.split("/").last
|
|
19
|
+
@bg_file_name = options[:bg_file_name]
|
|
20
|
+
|
|
21
|
+
create_file "Cocoaoutfile" do
|
|
22
|
+
src = "#{__dir__}/templates/Cocoaoutfile.erb"
|
|
23
|
+
ERB.new(File.read src).result binding
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
desc "build", "Build project"
|
|
28
|
+
method_option :configration_name, aliases: %W(-c), type: :string, default: 'Release',
|
|
29
|
+
desc: "use which \"Build Configuration\" to building. (Debug, Release or you custom name)"
|
|
30
|
+
def build
|
|
31
|
+
load_cocoaout_file
|
|
32
|
+
config_name = options[:configration_name] || "Release"
|
|
33
|
+
self.build_project(config_name)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
desc "deploy", "Build and release"
|
|
37
|
+
method_option :configration_name, aliases: %W(-c), type: :string, default: 'Release',
|
|
38
|
+
desc: "use which \"Build Configuration\" to building. (Debug, Release or you custom name)"
|
|
39
|
+
method_option :output, aliases: %W(-o), type: :string,
|
|
40
|
+
desc: "DMG file output filename", required: true
|
|
41
|
+
def deploy
|
|
42
|
+
load_cocoaout_file
|
|
43
|
+
config_name = options[:configration_name] || "Release"
|
|
44
|
+
self.build_project(config_name)
|
|
45
|
+
self.create_dmg_with_release(options[:output])
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
desc "package", "Create dmg with builded app"
|
|
49
|
+
method_option :output, aliases: %W(-o), type: :string,
|
|
50
|
+
desc: "DMG file output filename", required: true
|
|
51
|
+
def package
|
|
52
|
+
load_cocoaout_file
|
|
53
|
+
output = options[:output] || "~/Downloads/#{Cocoaout::config.app_name}.dmg"
|
|
54
|
+
self.create_dmg_with_release(output)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
desc "clean", "Clean old builds"
|
|
58
|
+
def clean
|
|
59
|
+
load_cocoaout_file
|
|
60
|
+
output = `#{Cocoaout::xcode_build} clean -scheme #{Cocoaout::config.app_name}`
|
|
61
|
+
if not $?.success?
|
|
62
|
+
puts output and exit 0
|
|
63
|
+
else
|
|
64
|
+
puts "Clean successed."
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
protected
|
|
69
|
+
def load_cocoaout_file
|
|
70
|
+
load File.expand_path("Cocoaoutfile", Dir.pwd)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def build_project(config_name)
|
|
74
|
+
command = %(#{Cocoaout::xcode_build} build -scheme #{Cocoaout::config.app_name} archive \
|
|
75
|
+
CONFIGURATION_BUILD_DIR='#{Cocoaout::build_dir}' \
|
|
76
|
+
-configuration #{config_name} -sdk #{Cocoaout::config.sdk})
|
|
77
|
+
exit 0 if not system command
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def create_dmg_with_release(out_filename)
|
|
81
|
+
app_name = Cocoaout::config.app_name
|
|
82
|
+
src_dir = Dir.pwd
|
|
83
|
+
dist_dir = Cocoaout::dist_dir
|
|
84
|
+
temp_dir = Cocoaout::temp_dir
|
|
85
|
+
dmg_background_file_name = Cocoaout::config.dmg_background_file_name
|
|
86
|
+
build_dir = Cocoaout::build_dir
|
|
87
|
+
|
|
88
|
+
print "Clean tmp."
|
|
89
|
+
`rm -rf #{temp_dir}`
|
|
90
|
+
`mkdir -p #{temp_dir}`
|
|
91
|
+
puts "."
|
|
92
|
+
|
|
93
|
+
print "Archive dSYM."
|
|
94
|
+
`cp -r #{build_dir}/#{app_name}.app.dSYM #{temp_dir}/`
|
|
95
|
+
print "."
|
|
96
|
+
`cd #{temp_dir} && zip #{app_name}.dSYM.zip #{app_name}.app.dSYM/`
|
|
97
|
+
puts "."
|
|
98
|
+
`mv #{temp_dir}/#{app_name}.dSYM.zip ~/Downloads/#{app_name}.dSYM.zip`
|
|
99
|
+
|
|
100
|
+
print "Building dmg."
|
|
101
|
+
`mkdir -p #{dist_dir}/`
|
|
102
|
+
`mkdir #{dist_dir}/.background`
|
|
103
|
+
`ln -s /Applications #{dist_dir}/Applications`
|
|
104
|
+
`cp -r #{src_dir}/#{dmg_background_file_name} #{dist_dir}/.background/`
|
|
105
|
+
`cp -r #{build_dir}/#{app_name}.app #{dist_dir}/`
|
|
106
|
+
print "."
|
|
107
|
+
|
|
108
|
+
exit 0 unless system %(hdiutil create #{temp_dir}/#{app_name}-tmp.dmg -ov -volname "#{app_name}" \
|
|
109
|
+
-fs HFS+ -srcfolder "#{dist_dir}" -fsargs "-c c=64,a=16,e=16" -format UDRW)
|
|
110
|
+
attach_info = `hdiutil attach -readwrite -noverify "#{temp_dir}/#{app_name}-tmp.dmg"`
|
|
111
|
+
device_id = attach_info.match(/\/dev\/[\w\d]+/i)[0]
|
|
112
|
+
disk_temp_name = attach_info.match(/\/Volumes\/([\w\d\s]+)/i)[1]
|
|
113
|
+
|
|
114
|
+
print "Mounting dmg file for edit theme, please wait."
|
|
115
|
+
3.times {
|
|
116
|
+
sleep 1
|
|
117
|
+
print "."
|
|
118
|
+
}
|
|
119
|
+
puts ""
|
|
120
|
+
|
|
121
|
+
config_dmg(disk_temp_name)
|
|
122
|
+
|
|
123
|
+
exit 0 unless system %(hdiutil detach "#{device_id}")
|
|
124
|
+
puts "Temp disk detached."
|
|
125
|
+
exit 0 unless system %(hdiutil convert #{temp_dir}/#{app_name}-tmp.dmg -format UDZO -imagekey zlib-level=9 -ov -o #{out_filename})
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
def config_dmg(disk_name)
|
|
129
|
+
dmg_size = Cocoaout::config.dmg_size
|
|
130
|
+
dmg_app_pos = Cocoaout::config.dmg_app_pos
|
|
131
|
+
dmg_applications_pos = Cocoaout::config.dmg_applications_pos
|
|
132
|
+
dmg_background_file_name = Cocoaout::config.dmg_background_file_name
|
|
133
|
+
script = %(
|
|
134
|
+
tell application "Finder"
|
|
135
|
+
tell disk "#{disk_name.strip}"
|
|
136
|
+
open
|
|
137
|
+
set current view of container window to icon view
|
|
138
|
+
set toolbar visible of container window to false
|
|
139
|
+
set statusbar visible of container window to false
|
|
140
|
+
set the bounds of container window to {#{dmg_size[:width]}, #{dmg_size[:height]}, 220, 200}
|
|
141
|
+
set viewOptions to the icon view options of container window
|
|
142
|
+
set arrangement of viewOptions to not arranged
|
|
143
|
+
set icon size of viewOptions to 72
|
|
144
|
+
set background picture of viewOptions to file ".background:#{dmg_background_file_name}"
|
|
145
|
+
set position of item "#{Cocoaout::config.app_name}.app" of container window to {#{dmg_app_pos[:left]}, #{dmg_app_pos[:top]}}
|
|
146
|
+
set position of item "Applications" of container window to {#{dmg_applications_pos[:left]}, #{dmg_applications_pos[:top]}}
|
|
147
|
+
close
|
|
148
|
+
open
|
|
149
|
+
update without registering applications
|
|
150
|
+
delay 2
|
|
151
|
+
close
|
|
152
|
+
end tell
|
|
153
|
+
end tell
|
|
154
|
+
)
|
|
155
|
+
script.strip!
|
|
156
|
+
|
|
157
|
+
exit 0 unless system %(osascript -e '#{script}')
|
|
158
|
+
puts "DMG style changed."
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
module Cocoaout
|
|
2
|
+
class << self
|
|
3
|
+
attr_accessor :config
|
|
4
|
+
attr_accessor :xcode_build
|
|
5
|
+
attr_accessor :temp_dir
|
|
6
|
+
attr_accessor :dist_dir
|
|
7
|
+
attr_accessor :build_dir
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
class Configuration
|
|
11
|
+
attr_accessor :app_name,
|
|
12
|
+
:sdk,
|
|
13
|
+
:project,
|
|
14
|
+
:dmg_background_file_name,
|
|
15
|
+
:dmg_size,
|
|
16
|
+
:dmg_app_pos,
|
|
17
|
+
:dmg_applications_pos
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def self.configure(&block)
|
|
21
|
+
self.config ||= Configuration.new
|
|
22
|
+
yield(config)
|
|
23
|
+
|
|
24
|
+
if self.config.project.match(/\.xcworkspace/)
|
|
25
|
+
self.xcode_build = "xcodebuild -workspace #{self.config.project}"
|
|
26
|
+
else
|
|
27
|
+
self.xcode_build = "xcodebuild -project #{self.config.project}"
|
|
28
|
+
end
|
|
29
|
+
self.temp_dir = "/tmp/xcodebuild-make/#{self.config.app_name}"
|
|
30
|
+
self.dist_dir = [self.temp_dir,"dist"].join("/")
|
|
31
|
+
self.build_dir = [Dir.pwd,"build"].join("/")
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
Cocoaout.configure do |config|
|
|
2
|
+
# 设置项目的名称,Scheme 的名字也要相同
|
|
3
|
+
config.app_name = "<%= @app_name %>"
|
|
4
|
+
config.project = "<%= @app_name %>.xcworkspace" # 或者 <%= @app_name %>.xcodeproj
|
|
5
|
+
# 项目用于编译的 SDK
|
|
6
|
+
config.sdk = "<%= @sdk %>"
|
|
7
|
+
# DMG 背景图片文件名(放在项目更目录)
|
|
8
|
+
config.dmg_background_file_name = "<%= @bg_file_name %>"
|
|
9
|
+
# DMG 窗口尺寸
|
|
10
|
+
config.dmg_size = { width: 400, height: 100 }
|
|
11
|
+
# DMG App 图标的坐标
|
|
12
|
+
config.dmg_app_pos = { left: 150, top: 157 }
|
|
13
|
+
# DMG Application 文件夹快捷方式的坐标
|
|
14
|
+
config.dmg_applications_pos = { left: 370, top: 157 }
|
|
15
|
+
end
|
data/lib/cocoaout.rb
ADDED
metadata
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: cocoaout
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.2
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Jason Lee
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2013-10-17 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: thor
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - '>='
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '0.18'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - '>='
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '0.18'
|
|
27
|
+
description: Auto build and release tool for Cocoa projects.
|
|
28
|
+
email: huacnlee@gmail.com
|
|
29
|
+
executables:
|
|
30
|
+
- cocoaout
|
|
31
|
+
extensions: []
|
|
32
|
+
extra_rdoc_files: []
|
|
33
|
+
files:
|
|
34
|
+
- .gitignore
|
|
35
|
+
- CHANGES.md
|
|
36
|
+
- Gemfile
|
|
37
|
+
- Gemfile.lock
|
|
38
|
+
- LICENSE
|
|
39
|
+
- README.md
|
|
40
|
+
- bin/cocoaout
|
|
41
|
+
- cocoaout.gemspec
|
|
42
|
+
- lib/cocoaout.rb
|
|
43
|
+
- lib/cocoaout/command.rb
|
|
44
|
+
- lib/cocoaout/config.rb
|
|
45
|
+
- lib/cocoaout/templates/Cocoaoutfile.erb
|
|
46
|
+
homepage: https://github.com/huacnlee/cocoaout
|
|
47
|
+
licenses:
|
|
48
|
+
- Apache V2
|
|
49
|
+
metadata: {}
|
|
50
|
+
post_install_message:
|
|
51
|
+
rdoc_options: []
|
|
52
|
+
require_paths:
|
|
53
|
+
- lib
|
|
54
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
55
|
+
requirements:
|
|
56
|
+
- - '>='
|
|
57
|
+
- !ruby/object:Gem::Version
|
|
58
|
+
version: 2.0.0
|
|
59
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
60
|
+
requirements:
|
|
61
|
+
- - '>='
|
|
62
|
+
- !ruby/object:Gem::Version
|
|
63
|
+
version: '0'
|
|
64
|
+
requirements: []
|
|
65
|
+
rubyforge_project:
|
|
66
|
+
rubygems_version: 2.0.3
|
|
67
|
+
signing_key:
|
|
68
|
+
specification_version: 4
|
|
69
|
+
summary: Auto build and release tool for Cocoa projects.
|
|
70
|
+
test_files: []
|
|
71
|
+
has_rdoc:
|