juretta-ipt 1.0.5 → 1.0.6
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.
- data/README.md +5 -26
- data/ipt.gemspec +2 -2
- data/tasks/iphone_tools.rake +100 -69
- metadata +2 -2
data/README.md
CHANGED
@@ -19,16 +19,6 @@ Installation
|
|
19
19
|
gem 'ipt'
|
20
20
|
load 'iphone_tools.rake'
|
21
21
|
|
22
|
-
PNGCRUSH
|
23
|
-
--------
|
24
|
-
If you want to use the image optimization task the "pngcrush" binary needs to be available. Check with:
|
25
|
-
stefan@macbook-pro-2:~$ which pngcrush
|
26
|
-
/opt/local/bin/pngcrush
|
27
|
-
|
28
|
-
You can install pngcrush using [Macports](http://www.macports.org/):
|
29
|
-
|
30
|
-
sudo port install pngcrush
|
31
|
-
|
32
22
|
CLANG
|
33
23
|
-----
|
34
24
|
If you want to use the static code analysis task (highly recommended). You have to download the checker binary.
|
@@ -47,14 +37,12 @@ Rake tasks
|
|
47
37
|
The Rakefile contains tasks that are valueable for iPhone development.
|
48
38
|
It defines tasks to:
|
49
39
|
|
50
|
-
*
|
51
|
-
* Do static code analysis using the [LLVM/Clang Static Analyzer][2]
|
40
|
+
* Do static code analysis using the [LLVM/Clang Static Analyzer][1]
|
52
41
|
* Create a XML/HTML changelog using the git commit log.
|
53
42
|
* Generate an HTML README file using an existing markdown, textile or RDoc formatted README.* file
|
54
43
|
* List TODO|FIXME|IMPROVE marker.
|
55
44
|
|
56
|
-
[1]: http://
|
57
|
-
[2]: http://clang.llvm.org/StaticAnalysis.html
|
45
|
+
[1]: http://clang.llvm.org/StaticAnalysis.html
|
58
46
|
|
59
47
|
In your Xcode project directory run:
|
60
48
|
rake -T
|
@@ -62,23 +50,14 @@ to show the available tasks:
|
|
62
50
|
|
63
51
|
rake ipt:analyze # Analyze code
|
64
52
|
rake ipt:clean # Clean build artifacts
|
53
|
+
rake ipt:dist:info # Info
|
65
54
|
rake ipt:dist:show # Show all bundle identifier
|
66
|
-
rake ipt:git:changelog # Create a changelog (doc/changelog.html and doc
|
55
|
+
rake ipt:git:changelog # Create a changelog (doc/changelog.html and doc/changelog.xml) based on your git commits.
|
67
56
|
rake ipt:optimize_images # Reduce image filesize using pngcrush
|
68
|
-
rake ipt:readme # Create README.html from existing README.* text
|
57
|
+
rake ipt:readme # Create README.html from existing README.* text file (markdown, textile, rdoc support).
|
69
58
|
rake ipt:todo # List TODO|FIXME|IMPROVE tags
|
70
59
|
|
71
60
|
|
72
|
-
Image size optimization
|
73
|
-
-----------------------
|
74
|
-
pngcrush is an open source, free command line computer program that reduces the size of PNG files.
|
75
|
-
The compression is lossless, meaning that the resulting image will have the same quality as the source image.
|
76
|
-
|
77
|
-
The original files will be saved in a _backup folder inside the project directory.
|
78
|
-
|
79
|
-
To optimize the png images in your Xcode project directory run:
|
80
|
-
rake ipt:optimize_images
|
81
|
-
|
82
61
|
Static code analysis
|
83
62
|
--------------------
|
84
63
|
|
data/ipt.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "ipt"
|
3
|
-
s.version = "1.0.
|
4
|
-
s.date = "2008-11-
|
3
|
+
s.version = "1.0.6"
|
4
|
+
s.date = "2008-11-21"
|
5
5
|
s.summary = "iPhone Project Tools"
|
6
6
|
s.email = "s@juretta.com"
|
7
7
|
s.homepage = "http://github.com/juretta/iphone-project-tools"
|
data/tasks/iphone_tools.rake
CHANGED
@@ -5,8 +5,46 @@ include FileUtils
|
|
5
5
|
|
6
6
|
BUILD_DIR = "./build"
|
7
7
|
|
8
|
+
|
9
|
+
# Tries to determine the absolute path to the given binary.
|
10
|
+
def find_binary(name)
|
11
|
+
ENV["PATH"].split(":").each do |dir| # we are on a mac anyway
|
12
|
+
path = File.join(dir, name)
|
13
|
+
if File.executable?(path)
|
14
|
+
puts "Found '#{name}' in #{dir}" if $DEBUG
|
15
|
+
return File.expand_path(path)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
raise "Unable to find #{name} in the system PATH. Add /path/to/#{name} to your $PATH"
|
19
|
+
end
|
20
|
+
|
21
|
+
module Kernel
|
22
|
+
def with(binary)
|
23
|
+
raise "Need a block" unless block_given?
|
24
|
+
path = find_binary(binary)
|
25
|
+
yield path
|
26
|
+
rescue StandardError => e
|
27
|
+
# swallow
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
8
31
|
module IPT
|
9
32
|
|
33
|
+
module Plist
|
34
|
+
class Parser
|
35
|
+
def initialize(path)
|
36
|
+
if File.file?(path)
|
37
|
+
type = `file #{path}`
|
38
|
+
@xml = type =~ /Apple binary property list/ ? `plutil -convert xml1 -o - #{path}` : path
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def parse
|
43
|
+
Plist::parse_xml(@xml) if @xml
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
10
48
|
module README
|
11
49
|
|
12
50
|
class AbstractFormatter
|
@@ -171,31 +209,20 @@ module IPT
|
|
171
209
|
|
172
210
|
end
|
173
211
|
|
174
|
-
# Tries to determine the absolute path to the given binary.
|
175
|
-
def find_binary(name)
|
176
|
-
ENV["PATH"].split(":").each do |dir| # we are on a mac anyway
|
177
|
-
path = File.join(dir, name)
|
178
|
-
if File.executable?(path)
|
179
|
-
puts "Found '#{name}' in #{dir}" if $DEBUG
|
180
|
-
return File.expand_path(path)
|
181
|
-
end
|
182
|
-
end
|
183
|
-
raise "Unable to find #{name} in the system PATH. Add /path/to/#{name} to your $PATH"
|
184
|
-
end
|
185
|
-
|
186
212
|
namespace :ipt do
|
187
213
|
|
188
214
|
namespace :dist do
|
215
|
+
|
189
216
|
desc "Show all bundle identifier"
|
190
217
|
task :show do
|
191
218
|
puts "No build artifacts" unless File.directory?(BUILD_DIR)
|
192
|
-
|
193
|
-
|
219
|
+
with('git') do
|
220
|
+
tag = `#{find_binary('git')} describe --tags`.to_s
|
221
|
+
puts "\nCurrent git tag: #{tag}"
|
222
|
+
end # end with
|
194
223
|
Dir["#{BUILD_DIR}/**/Info.plist"].each do |path|
|
195
224
|
if File.file?(path)
|
196
|
-
|
197
|
-
xml = type =~ /Apple binary property list/ ? `plutil -convert xml1 -o - #{path}` : path
|
198
|
-
pl = Plist::parse_xml(xml)
|
225
|
+
pl = IPT::Plist::Parser.new(path).parse
|
199
226
|
if pl
|
200
227
|
puts "File: #{path}"
|
201
228
|
puts "CFBundleVersion: #{pl['CFBundleVersion']}".strip
|
@@ -203,20 +230,22 @@ namespace :ipt do
|
|
203
230
|
end
|
204
231
|
end
|
205
232
|
end
|
233
|
+
end # task :show
|
234
|
+
|
235
|
+
desc "Info"
|
236
|
+
task :info do
|
237
|
+
%w(Debug Release).map{|prefix| File.join(Dir.pwd, 'build', "#{prefix}-iphoneos")}.each do |path|
|
238
|
+
Dir["#{path}/*.app"].each do |app|
|
239
|
+
puts "app: #{app}"
|
240
|
+
puts `codesign -dvvvv #{app}`
|
241
|
+
end
|
242
|
+
end
|
206
243
|
end
|
244
|
+
end # end namespace dist
|
207
245
|
|
208
|
-
end
|
209
|
-
|
210
|
-
|
211
246
|
desc "Reduce image filesize using pngcrush"
|
212
247
|
task :optimize_images do
|
213
|
-
|
214
|
-
backup = "#{Dir.pwd}/_backup"
|
215
|
-
mkdir backup unless File.directory?(backup)
|
216
|
-
mv Dir['*.png'], backup
|
217
|
-
Dir["#{backup}/*.png"].each do |png|
|
218
|
-
sh "#{binary} -d ./ -l 9 -brute -rem gAMA -rem cHRM -rem iCCP -rem sRGB #{png}"
|
219
|
-
end
|
248
|
+
puts "PNG image optimization is not necessary as Xcode will optimize PNG files during the build phase.\nThis target is deprecated and will be released in future releases."
|
220
249
|
end
|
221
250
|
|
222
251
|
desc "List TODO|FIXME|IMPROVE tags"
|
@@ -226,8 +255,7 @@ namespace :ipt do
|
|
226
255
|
|
227
256
|
desc "Create README.html from existing README.* text file (markdown, textile, rdoc support)."
|
228
257
|
task :readme do
|
229
|
-
|
230
|
-
f.to_html
|
258
|
+
IPT::README::Formatter.new(".").to_html
|
231
259
|
end
|
232
260
|
|
233
261
|
desc "Analyze code"
|
@@ -250,55 +278,58 @@ namespace :ipt do
|
|
250
278
|
rm_rf "readme.html"
|
251
279
|
end
|
252
280
|
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
281
|
+
with('git') do
|
282
|
+
namespace :git do
|
283
|
+
desc "Create a changelog (doc/changelog.html and doc/changelog.xml) based on your git commits."
|
284
|
+
task :changelog do
|
285
|
+
require 'time'
|
286
|
+
require 'rexml/document'
|
258
287
|
|
259
|
-
|
288
|
+
DOC_DIR = "#{Dir.pwd}/doc"
|
260
289
|
|
261
|
-
|
262
|
-
|
263
|
-
|
290
|
+
# Create commit messages xml as part of the documentation in doc/
|
291
|
+
xml_body=`git log --pretty=format:'<commit id="%H">%n<date>%aD</date>%n<author><![CDATA[%an]]></author><author-email><![CDATA[%ae]]></author-email>%n<subject><![CDATA[%s]]></subject><msg>%n<![CDATA[%n%b%n]]>%n</msg>%n</commit>'`
|
292
|
+
xml = "<?xml version=\"1.0\"?>\n<commits created=\"#{Time.now.iso8601}\">\n#{xml_body}\n</commits>"
|
264
293
|
|
265
|
-
|
294
|
+
mkdir(DOC_DIR) unless File.directory?(DOC_DIR)
|
266
295
|
|
267
|
-
|
268
|
-
|
269
|
-
|
296
|
+
File.open(File.join(DOC_DIR, "changelog.xml"), 'w') do |f|
|
297
|
+
f << xml
|
298
|
+
end
|
270
299
|
|
271
|
-
|
300
|
+
HTML_ESCAPE = { '&' => '&', '"' => '"', '>' => '>', '<' => '<' }
|
272
301
|
|
273
|
-
|
274
|
-
|
275
|
-
|
302
|
+
def html_escape(s)
|
303
|
+
s.to_s.gsub(/[&"><]/) { |special| HTML_ESCAPE[special] }
|
304
|
+
end
|
276
305
|
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
306
|
+
# Create a changelog html in public/
|
307
|
+
doc = REXML::Document.new(xml)
|
308
|
+
html = "<h1>Changelog - #{doc.root.attributes['created']}</h1>\n\n"
|
309
|
+
doc.elements.each('commits/commit') do |ci|
|
310
|
+
date = ci.elements["date"].text
|
311
|
+
author = ci.elements["author"].text
|
312
|
+
subject = ci.elements["subject"].text
|
313
|
+
msg = ci.elements["msg"].cdatas
|
314
|
+
html << "<div class=\"commit\" id=\"#{ci.attributes['id']}\">\n"
|
315
|
+
html << "<span class=\"date\">Date: #{date}</span>\n"
|
316
|
+
html << "<span class=\"author\">Author: #{html_escape(author)}</span>\n"
|
317
|
+
html << "<h2>#{html_escape(subject)}</h2>\n"
|
318
|
+
html << "<pre class=\"msg\">#{html_escape(msg)}</pre>\n"
|
319
|
+
html << "</div>\n"
|
320
|
+
end
|
292
321
|
|
293
|
-
|
294
|
-
|
295
|
-
|
322
|
+
File.open(File.join(DOC_DIR, "changelog.html"), 'w') do |f|
|
323
|
+
f << File.open(File.join(File.dirname(__FILE__), "changelog.tmpl")).read.gsub(/@html@/, html)
|
324
|
+
end
|
296
325
|
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
326
|
+
# Changelog commiten
|
327
|
+
`git add #{DOC_DIR}/changelog.html #{DOC_DIR}/changelog.xml`
|
328
|
+
`git commit -m "Update changelog"`
|
329
|
+
end
|
301
330
|
|
302
|
-
|
331
|
+
end # end namespace git
|
332
|
+
|
333
|
+
end # end with('git')
|
303
334
|
|
304
335
|
end # end namespace
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: juretta-ipt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefan Saasen
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-11-
|
12
|
+
date: 2008-11-21 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|