juretta-ipt 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -18,7 +18,7 @@ Installation
18
18
  require 'rubygems'
19
19
  gem 'juretta-ipt'
20
20
  load 'iphone_tools.rake'
21
-
21
+
22
22
  Rake tasks
23
23
  ==========
24
24
 
@@ -107,7 +107,27 @@ to list TODO|FIXME|IMPROVE markers in the source code.
107
107
  Easily create AdHoc distribution builds.
108
108
  ---------------------------------------
109
109
 
110
- **More documentation needed.**
110
+ The ipt:adhoc:* tasks make it very easy to create proper adhoc builds that can be distributed as tar.gz archive files. The archive contains the iPhone Application, the AdHoc provisioning profile and a changelog .txt file that contains the latest changes.
111
+
112
+ The archive file can be easily distributed and allows beta tester/clients/developers to install a snapshot or development release.
113
+
114
+ I usually use the following directory laout when working on iPhone projects:
115
+
116
+ Main project directory:
117
+ ./releases This is where the AdHoc releases end up
118
+ 1.0.1.tgz
119
+ 1.0.2.tgz
120
+ ./xcode-project The Xcode project.
121
+ Classes
122
+ build
123
+ Rakefile
124
+ ...
125
+
126
+ The AdHoc builds are based on git tags representing the current version of the software.
127
+
128
+ rake ipt:adhoc:release
129
+
130
+ rake ipt:adhoc:snapshot
111
131
 
112
132
  Xcode and git
113
133
  =============
@@ -198,7 +218,7 @@ executable.
198
218
  raise "Must be run from Xcode" unless ENV['XCODE_VERSION_ACTUAL']
199
219
 
200
220
  GIT="/opt/local/bin/git"
201
- PLIST_FILE = File.join(ENV['BUILT_PRODUCTS_DIR'], ENV['WRAPPER_NAME'], 'Info.plist')
221
+ PLIST_FILE = File.join(ENV['BUILT_PRODUCTS_DIR'], ENV['INFOPLIST_PATH'])
202
222
 
203
223
  if File.file?(PLIST_FILE)
204
224
  pl = Plist::parse_xml(PLIST_FILE)
data/lib/ipt/plist.rb CHANGED
@@ -1,6 +1,8 @@
1
+ require 'Plist'
2
+
1
3
  module IPT
2
4
 
3
- module Plist
5
+ module Propertylist
4
6
  class Parser
5
7
  def initialize(path)
6
8
  if File.file?(path)
@@ -10,7 +12,7 @@ module IPT
10
12
  end
11
13
 
12
14
  def parse
13
- Plist::parse_xml(@xml) if @xml
15
+ ::Plist::parse_xml(@xml) if @xml
14
16
  end
15
17
  end
16
18
  end
@@ -23,7 +23,7 @@ module IPT
23
23
  match = false
24
24
  end
25
25
  end
26
- output.join("\n")
26
+ output.empty? ? "#{pattern} not found" : output.join("\n")
27
27
  end
28
28
 
29
29
  def traverse
@@ -127,7 +127,7 @@ namespace :ipt do
127
127
  end # end with
128
128
  Dir["#{BUILD_DIR}/**/Info.plist"].each do |path|
129
129
  if File.file?(path)
130
- pl = IPT::Plist::Parser.new(path).parse
130
+ pl = IPT::Propertylist::Parser.new(path).parse
131
131
  if pl
132
132
  puts "File: #{path}"
133
133
  puts "CFBundleVersion: #{pl['CFBundleVersion']}".strip
@@ -0,0 +1,3 @@
1
+ class Junk
2
+ # TODO implement the Junk class
3
+ end
@@ -0,0 +1,39 @@
1
+ require File.dirname(__FILE__) + '/test_helper'
2
+
3
+ module RakeHelper
4
+ public :resolve_previous_version
5
+ end
6
+
7
+ class VersionTest < Test::Unit::TestCase
8
+
9
+ include RakeHelper
10
+ include IPT
11
+
12
+ context "A valid list of version" do
13
+ should "result in a valid previous version" do
14
+ tags = ["0.2.0", "0.2.10", "0.2.11", "0.2.12", "0.2.13", "0.2.3",
15
+ "0.2.4", "0.2.5", "0.2.6", "0.2.7", "0.2.8", "0.2.9", "0.9.0",
16
+ "0.9.1", "0.9.2", "0.9.3", "0.9.4", "1.1.0", "1.1.1", "1.1.2",
17
+ "2.0.0", "stefan-RC1"]
18
+
19
+ current = Version.new(0, 2, 10)
20
+
21
+ prev = resolve_previous_version(tags, current)
22
+ assert_equal prev, Version.new(0, 2, 9)
23
+
24
+ current = Version.new(1, 1, 1)
25
+ prev = resolve_previous_version(tags, current)
26
+ assert_equal prev, Version.new(1, 1, 0)
27
+
28
+ current = Version.new(0, 2, 0)
29
+ prev = resolve_previous_version(tags, current)
30
+ assert_nil prev
31
+
32
+ current = Version.new(2, 0, 0)
33
+ prev = resolve_previous_version(tags, current)
34
+ assert_equal prev, Version.new(1, 1, 2)
35
+ end
36
+ end
37
+
38
+ end
39
+
@@ -0,0 +1,30 @@
1
+ require File.dirname(__FILE__) + '/test_helper'
2
+
3
+
4
+ module IPT
5
+ class TagExtraction
6
+ def traverse
7
+ Dir["#{FIXTURES_DIR}/tag_*"].each do |f|
8
+ yield f
9
+ end
10
+ end
11
+ end
12
+ end
13
+
14
+ class TagExtractionTest < Test::Unit::TestCase
15
+
16
+ include IPT
17
+
18
+ context "Marker tags" do
19
+ setup do
20
+ @te = TagExtraction.new
21
+ end
22
+
23
+ should "be recognized" do
24
+ out = @te.grep(/TODO|FIXME|IMPROVE/i)
25
+ assert_match "TODO implement the Junk class", out
26
+ assert_match "IMPROVE: Needs more text.", out
27
+ end
28
+ end
29
+ end
30
+
@@ -0,0 +1,13 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'shoulda'
4
+ require 'mocha'
5
+
6
+ FIXTURES_DIR = File.join(File.dirname(__FILE__), 'fixtures')
7
+
8
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
9
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
10
+ require 'ipt'
11
+
12
+ class Test::Unit::TestCase
13
+ end
@@ -0,0 +1,223 @@
1
+ require File.dirname(__FILE__) + '/test_helper'
2
+
3
+ class VersionTest < Test::Unit::TestCase
4
+
5
+ include IPT
6
+
7
+ context "A valid version string" do
8
+ should "be parsed into a version instance" do
9
+
10
+ version = Version.parse("1")
11
+ assert_not_nil version
12
+ assert_equal 1, version.major
13
+ assert_nil version.minor
14
+ assert_nil version.patch
15
+ assert_nil version.build
16
+
17
+ version = Version.parse("1.0")
18
+ assert_not_nil version
19
+ assert_equal 1, version.major
20
+ assert_equal 0, version.minor
21
+ assert_nil version.patch
22
+ assert_nil version.build
23
+
24
+ version = Version.parse("1.0.6")
25
+ assert_not_nil version
26
+ assert_equal 1, version.major
27
+ assert_equal 0, version.minor
28
+ assert_equal 6, version.patch
29
+ assert_nil version.build
30
+
31
+ version = Version.parse("1.0.6.300")
32
+ assert_not_nil version
33
+ assert_equal 1, version.major
34
+ assert_equal 0, version.minor
35
+ assert_equal 6, version.patch
36
+ assert_equal 300, version.build
37
+
38
+ assert_equal "1.0.6.300", "#{version}"
39
+ assert_equal "1.0.6.300", version.to_s
40
+ end
41
+ end
42
+
43
+ context "An invalid version string" do
44
+ should "be reported as InvalidArgument" do
45
+ assert_raise(ArgumentError) do
46
+ Version.parse("A")
47
+ end
48
+ assert_raise(ArgumentError) do
49
+ Version.parse("")
50
+ end
51
+ assert_raise(ArgumentError) do
52
+ Version.parse(nil)
53
+ end
54
+ assert_raise(ArgumentError) do
55
+ Version.parse("stefan-RC1")
56
+ end
57
+ end
58
+ end
59
+
60
+ context "A valid version instance" do
61
+
62
+ setup do
63
+ @version = Version.new(1, 2, 3, 100)
64
+ assert_equal 1, @version.major
65
+ assert_equal 2, @version.minor
66
+ assert_equal 3, @version.patch
67
+ assert_equal 100, @version.build
68
+ end
69
+
70
+ should "provide a proper to_s method" do
71
+ assert_equal "1.2.3.100", @version.to_s
72
+ assert_equal "1.2.3", Version.new(1, 2, 3).to_s
73
+ assert_equal "1.2.0", Version.new(1, 2, 0).to_s
74
+ end
75
+
76
+ should "increase the least significant part properly" do
77
+ # Default :major
78
+ v = @version.increase!
79
+ assert_not_nil v
80
+ assert_equal 101, v.build
81
+ end
82
+
83
+ should "increase the major part properly" do
84
+ # Default :major
85
+ v = @version.increase!(:major)
86
+ assert_not_nil v
87
+ assert_equal 2, @version.major
88
+ assert_equal 2, v.major
89
+ end
90
+
91
+ should "increase the minor part properly" do
92
+ # Default :major
93
+ v = @version.increase!(:minor)
94
+ assert_not_nil v
95
+ assert_equal 3, @version.minor
96
+ assert_equal 3, v.minor
97
+ end
98
+
99
+ should "increase the patch part properly" do
100
+ # Default :major
101
+ v = @version.increase!(:patch)
102
+ assert_not_nil v
103
+ assert_equal 4, @version.patch
104
+ assert_equal 4, v.patch
105
+ end
106
+
107
+ should "increase the build part properly" do
108
+ # Default :major
109
+ v = @version.increase!(:build)
110
+ assert_not_nil v
111
+ assert_equal 101, @version.build
112
+ assert_equal 101, v.build
113
+ end
114
+
115
+ should "decrease the least significant part properly" do
116
+ # Default :major
117
+ v = @version.decrease!
118
+ assert_not_nil v
119
+ assert_equal 99, v.build
120
+ end
121
+
122
+ should "decrease the major part properly" do
123
+ # Default :major
124
+ v = @version.decrease!(:major)
125
+ assert_not_nil v
126
+ assert_equal 0, @version.major
127
+ assert_equal 0, v.major
128
+ end
129
+
130
+ should "decrease the minor part properly" do
131
+ # Default :major
132
+ v = @version.decrease!(:minor)
133
+ assert_not_nil v
134
+ assert_equal 1, @version.minor
135
+ assert_equal 1, v.minor
136
+ end
137
+
138
+ should "decrease the patch part properly" do
139
+ # Default :major
140
+ v = @version.decrease!(:patch)
141
+ assert_not_nil v
142
+ assert_equal 2, @version.patch
143
+ assert_equal 2, v.patch
144
+ end
145
+
146
+ should "decrease the build part properly" do
147
+ # Default :major
148
+ v = @version.decrease!(:build)
149
+ assert_not_nil v
150
+ assert_equal 99, @version.build
151
+ assert_equal 99, v.build
152
+ end
153
+
154
+ should "return valid values for <=>" do
155
+ v1 = Version.new(1, 0, 0)
156
+ assert_nil v1 <=> nil
157
+ assert_nil v1 <=> 1
158
+ end
159
+
160
+ should "return valid values for eql?" do
161
+ v1 = Version.new(1, 0, 0)
162
+ v1b = Version.new(1, 0, 0)
163
+ v2 = Version.new(1, 0, 1)
164
+ assert_equal false, v1.eql?(v2)
165
+
166
+ assert_equal false, v1.eql?(nil)
167
+ assert_equal false, v1.eql?("1.0.0")
168
+
169
+ assert v1.eql?(v1b)
170
+ end
171
+
172
+ should "be comparable to another version" do
173
+ assert_equal 0, @version <=> @version
174
+ assert_equal false, @version > @version
175
+ assert_equal false, @version < @version
176
+
177
+ v1 = Version.new(1, 0, 0)
178
+ v2 = Version.new(2, 0, 0)
179
+ assert v1 < v2
180
+ assert v2 > v1
181
+ assert v1 != v2
182
+
183
+ v1 = Version.new(1, 0, 0)
184
+ v2 = Version.new(1, 0, 1)
185
+ assert v1 < v2
186
+ assert v2 > v1
187
+ assert v1 != v2
188
+
189
+ v1 = Version.new(1, 0, 99)
190
+ v2 = Version.new(2, 0, 0)
191
+ assert v1 < v2
192
+ assert v2 > v1
193
+ assert v1 != v2
194
+
195
+ v1 = Version.new(1, 0, 99)
196
+ v2 = Version.new(1, 0, 101)
197
+ assert v1 < v2
198
+ assert v2 > v1
199
+ assert v1 != v2
200
+
201
+ v1 = Version.new(0, 0, 99)
202
+ v2 = Version.new(0, 0, 101)
203
+ assert v1 < v2
204
+ assert v2 > v1
205
+ assert v1 != v2
206
+
207
+ v1 = Version.new(0, 0, 99)
208
+ v2 = Version.new(0, 1, 98)
209
+ assert v1 < v2
210
+ assert v2 > v1
211
+ assert v1 != v2
212
+
213
+ v1 = Version.new(0, 0, 99)
214
+ v2 = Version.new(0, 0, 99, 2)
215
+ assert v1 < v2
216
+ assert v2 > v1
217
+ assert v1 != v2
218
+ end
219
+
220
+
221
+ end
222
+ end
223
+
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.3.0
4
+ version: 1.3.1
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: 2009-03-04 00:00:00 -08:00
12
+ date: 2009-06-13 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -22,13 +22,12 @@ extensions: []
22
22
  extra_rdoc_files:
23
23
  - README.md
24
24
  files:
25
- - lib/ipt
25
+ - lib/ipt.rb
26
26
  - lib/ipt/plist.rb
27
27
  - lib/ipt/rake_helper.rb
28
28
  - lib/ipt/readme.rb
29
29
  - lib/ipt/tag_extraction.rb
30
30
  - lib/ipt/version.rb
31
- - lib/ipt.rb
32
31
  - tasks/changelog.tmpl
33
32
  - tasks/gitignore.tmpl
34
33
  - tasks/iphone_tools.rake
@@ -38,7 +37,6 @@ has_rdoc: true
38
37
  homepage: http://github.com/juretta/iphone-project-tools
39
38
  post_install_message:
40
39
  rdoc_options:
41
- - --inline-source
42
40
  - --charset=UTF-8
43
41
  require_paths:
44
42
  - lib
@@ -62,5 +60,9 @@ rubygems_version: 1.2.0
62
60
  signing_key:
63
61
  specification_version: 2
64
62
  summary: Useful rake tasks and scripts for iPhone development using Xcode.
65
- test_files: []
66
-
63
+ test_files:
64
+ - test/fixtures/tag_1.rb
65
+ - test/rake_helper_test.rb
66
+ - test/tag_extraction_test.rb
67
+ - test/test_helper.rb
68
+ - test/version_test.rb