andparcel 0.1.0 → 0.2.0

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.rdoc CHANGED
@@ -1,6 +1,8 @@
1
1
  = andparcel
2
2
 
3
- Description goes here.
3
+ This is the source code to the default client for the Android Parcel Project. Full
4
+ documentation regarding the Project can be found on the
5
+ Project's Web site: http://andparcel.com
4
6
 
5
7
  == Copyright
6
8
 
data/TODO CHANGED
@@ -1,37 +1,19 @@
1
- Sunday
2
- ------
3
- test on clean Linux, Windows, OS X
4
- home directory OK?
5
- wrap AdvAndroid chapters, gen as PDFs w/ "excerpt" footer
6
- need to get appendix generation going
7
- RDoc comments
8
- git repo & publish gem
9
- VERSION NUMBER
10
- .gitignore ignores TODO!
11
- get git.andparcel.org redir to github
12
- pour rest of this TODO into RTM and GitHub Issues
1
+ Wednesday
2
+ ---------
3
+ developer guide (appendix of AdvAndroid)
4
+ ABJ work
5
+
6
+ Thursday
7
+ --------
8
+ wrap developer guide
9
+ deploy
10
+ point cwac-colormixer README to this
11
+ ABJ work
13
12
 
14
- May 10
13
+ Friday
15
14
  ------
16
- parcelhelper
17
- README
18
- put CW logo/links on CWAC README's, add links to CWAC blog posts, other updates
19
- adapterwrapper
20
- put CW logo/links on CWAC README's, add links to CWAC blog posts, other updates
21
- sackofviewsadapter
22
- put CW logo/links on CWAC README's, add links to CWAC blog posts, other updates
23
- colormixer
24
- put CW logo/links on CWAC README's, add links to CWAC blog posts, other updates
25
- commit all
26
- parcel
27
- CWAC mods (need .gitignore fixes)
28
- Web site w/ pointers to documentation, committed
29
- announce parcel system
30
- CW newsletter
31
- cw-android
32
- twitter
33
- my blog
34
- AG blog -> Tuesday
15
+ standards: parcel.json / catalog.json
16
+ ABJ work
35
17
 
36
18
  Over Next Few Weeks
37
19
  -------------------
@@ -62,31 +44,3 @@ get other key cwac- components parcel'd up
62
44
  parcel.json
63
45
  parcel & add to catalog
64
46
  put CW logo/links on CWAC README's, add links to CWAC blog posts, other updates
65
-
66
-
67
- Future
68
- ------
69
- deal with upgrade (if newer available, do...something)
70
- support merging non-component manifest entries
71
- deal with manifest collisions (e.g., sdk levels different)
72
- input validation
73
- regex on name, etc.
74
- SemVer.org validation
75
- support packaging assets/
76
- multiple version support (a la gem versions)
77
- mirror support
78
- catalogs
79
- parcels
80
- fail remove if listed as a dependency of something else
81
- catalog caching w/ If-Modified-Since/ETag support
82
- 100% rcov coverage
83
- rfc5261 support for manifest merges?
84
- optional signed ZIPs?
85
- battle plan for new components (see list in sketchpad)
86
- smart --replace: doesn't download/replace if version same
87
- dependency tests
88
- dependency version checking
89
- version pinning (don't auto-upgrade)
90
- remove --full gets rid of dependencies
91
- lint tests
92
- 100% comments
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
data/andparcel.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{andparcel}
8
- s.version = "0.1.0"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Mark Murphy"]
12
- s.date = %q{2010-05-09}
12
+ s.date = %q{2010-05-24}
13
13
  s.default_executable = %q{parcel}
14
14
  s.description = %q{Supplies the parcel command for packaging, installing, and removing parcels from an Android project}
15
15
  s.email = %q{mmurphy@commonsware.com}
@@ -63,9 +63,17 @@ module AndParcel
63
63
  package=packages['parcels'][name]
64
64
 
65
65
  if package
66
- uri=URI.parse cat['url']
67
-
68
- return(uri+package['path'])
66
+ if (urls=package['url'])
67
+ if urls.kind_of?(Enumerable)
68
+ return(urls.first)
69
+ end
70
+
71
+ return(urls)
72
+ elsif (path=package['path'])
73
+ uri=URI.parse cat['url']
74
+
75
+ return(uri+path)
76
+ end
69
77
  end
70
78
  end
71
79
 
@@ -108,11 +108,11 @@ module AndParcel
108
108
 
109
109
  begin
110
110
  Zip::ZipFile.open(target, Zip::ZipFile::CREATE) do |zf|
111
- manifest(zf) if
112
- resources(zf) if
113
- docs(zf) if
114
- libs(zf) if
115
- save_config(zf)
111
+ save_config(zf) if
112
+ manifest(zf) if
113
+ resources(zf) if
114
+ docs(zf) if
115
+ libs(zf)
116
116
  end
117
117
 
118
118
  target
@@ -178,6 +178,12 @@ module AndParcel
178
178
  doc=Nokogiri::XML(open(File.join(opts[:project], opts[:manifest])))
179
179
  out=Nokogiri::XML('<manifest-merge/>')
180
180
 
181
+ sdk=doc.search('uses-sdk').first
182
+
183
+ if sdk
184
+ config['minSdkVersion']=sdk['minSdkVersion']
185
+ end
186
+
181
187
  doc.search('application').children.each do |node|
182
188
  if node.element?
183
189
  out.root.add_child(node)
@@ -12,4 +12,5 @@
12
12
  </intent-filter>
13
13
  </activity>
14
14
  </application>
15
+ <uses-sdk android:minSdkVersion="4" />
15
16
  </manifest>
data/test/test_install.rb CHANGED
@@ -3,7 +3,7 @@ require 'rubygems'
3
3
  require "protest"
4
4
  require "lib/andparcel"
5
5
 
6
- Protest.context("The parcel engine") do
6
+ Protest.context("when installing a parcel into a project") do
7
7
  def clone_receiver
8
8
  FileUtils.cp_r 'test/ParcelReceiver', 'tmp2'
9
9
  end
@@ -41,130 +41,128 @@ Protest.context("The parcel engine") do
41
41
  end
42
42
  end
43
43
 
44
- context("when installing a parcel into a project") do
45
- test "should support a parcel with no meaningful content" do
46
- install_test
47
- end
44
+ test "should support a parcel with no meaningful content" do
45
+ install_test
46
+ end
48
47
 
49
- test "should support a parcel with JARs" do
50
- install_test(['tmp2/libs/one.jar',
51
- 'tmp2/libs/two.jar'],
52
- :jars=>'libs')
53
- end
48
+ test "should support a parcel with JARs" do
49
+ install_test(['tmp2/libs/one.jar',
50
+ 'tmp2/libs/two.jar'],
51
+ :jars=>'libs')
52
+ end
54
53
 
55
- test "should support a parcel with documentation" do
56
- install_test(['tmp2/parcels/andParcel-test/docs/README'],
57
- :docs=>'docs')
58
- end
54
+ test "should support a parcel with documentation" do
55
+ install_test(['tmp2/parcels/andParcel-test/docs/README'],
56
+ :docs=>'docs')
57
+ end
59
58
 
60
- test "should support a parcel with resources" do
61
- install_test(['tmp2/res/layout/andParcel_test_row.xml',
62
- 'tmp2/res/values/strings.xml'],
63
- :res=>'res')
64
- end
59
+ test "should support a parcel with resources" do
60
+ install_test(['tmp2/res/layout/andParcel_test_row.xml',
61
+ 'tmp2/res/values/strings.xml'],
62
+ :res=>'res')
63
+ end
65
64
 
66
- test "should support a parcel with all sorts of stuff" do
67
- install_test(['tmp2/res/layout/andParcel_test_row.xml',
68
- 'tmp2/res/values/strings.xml',
69
- 'tmp2/libs/one.jar',
70
- 'tmp2/libs/two.jar',
71
- 'tmp2/parcels/andParcel-test/docs/README'],
72
- :res=>'res',
73
- :jars=>'libs',
74
- :docs=>['docs/README', 'docs/SomeOtherFile'])
75
- end
76
-
77
- test "should install a parcel off the network" do
78
- begin
79
- clone_receiver
80
- FileUtils.mkdir 'tmp'
81
- target=AndParcel::Parcel.package('test/ParcelToPackage/parcel.json',
82
- :dir=>'tmp')
83
- assert target=='tmp/andParcel-test_0.1.0.zip'
84
- AndParcel::Parcel.install('cwac-parcel',
85
- :dir=>'tmp2')
86
- assert_exists('tmp2/parcels/cwac-parcel')
87
- ensure
88
- FileUtils.rm_rf 'tmp'
89
- FileUtils.rm_rf 'tmp2'
90
- end
65
+ test "should support a parcel with all sorts of stuff" do
66
+ install_test(['tmp2/res/layout/andParcel_test_row.xml',
67
+ 'tmp2/res/values/strings.xml',
68
+ 'tmp2/libs/one.jar',
69
+ 'tmp2/libs/two.jar',
70
+ 'tmp2/parcels/andParcel-test/docs/README'],
71
+ :res=>'res',
72
+ :jars=>'libs',
73
+ :docs=>['docs/README', 'docs/SomeOtherFile'])
74
+ end
75
+
76
+ test "should install a parcel off the network" do
77
+ begin
78
+ clone_receiver
79
+ FileUtils.mkdir 'tmp'
80
+ target=AndParcel::Parcel.package('test/ParcelToPackage/parcel.json',
81
+ :dir=>'tmp')
82
+ assert target=='tmp/andParcel-test_0.1.0.zip'
83
+ AndParcel::Parcel.install('cwac-parcel',
84
+ :dir=>'tmp2')
85
+ assert_exists('tmp2/parcels/cwac-parcel')
86
+ ensure
87
+ FileUtils.rm_rf 'tmp'
88
+ FileUtils.rm_rf 'tmp2'
91
89
  end
92
-
93
- test "should replace a parcel with all sorts of stuff" do
94
- begin
95
- opts={:res=>'res',
96
- :jars=>'libs',
97
- :docs=>'docs'}
98
- opts[:dir]='tmp'
99
- opts[:manifest]='AndroidManifest.xml'
100
- clone_receiver
101
- FileUtils.mkdir 'tmp'
102
- target=AndParcel::Parcel.package('test/ParcelToPackage/parcel.json',
103
- opts)
104
- assert target=='tmp/andParcel-test_0.1.0.zip'
105
- AndParcel::Parcel.install('tmp/andParcel-test_0.1.0.zip',
106
- :dir=>'tmp2')
107
- assert_exists('tmp2/res/layout/andParcel_test_row.xml',
90
+ end
91
+
92
+ test "should replace a parcel with all sorts of stuff" do
93
+ begin
94
+ opts={:res=>'res',
95
+ :jars=>'libs',
96
+ :docs=>'docs'}
97
+ opts[:dir]='tmp'
98
+ opts[:manifest]='AndroidManifest.xml'
99
+ clone_receiver
100
+ FileUtils.mkdir 'tmp'
101
+ target=AndParcel::Parcel.package('test/ParcelToPackage/parcel.json',
102
+ opts)
103
+ assert target=='tmp/andParcel-test_0.1.0.zip'
104
+ AndParcel::Parcel.install('tmp/andParcel-test_0.1.0.zip',
105
+ :dir=>'tmp2')
106
+ assert_exists('tmp2/res/layout/andParcel_test_row.xml',
107
+ 'tmp2/res/values/strings.xml',
108
+ 'tmp2/libs/one.jar',
109
+ 'tmp2/libs/two.jar',
110
+ 'tmp2/parcels/andParcel-test/docs/README')
111
+ assert_exists('tmp2/parcels',
112
+ 'tmp2/parcels/andParcel-test/andParcel-test_0.1.0.zip')
113
+
114
+ doc=Nokogiri::XML(open('tmp2/AndroidManifest.xml'))
115
+ app=doc.search('application')[0]
116
+ existing=app.xpath("*[@android:name='ParcelToPackage']",
117
+ 'android'=>"http://schemas.android.com/apk/res/android")
118
+
119
+ assert existing[0].name=='activity'
120
+ AndParcel::Parcel.install('tmp/andParcel-test_0.1.0.zip',
121
+ :dir=>'tmp2', :replace=>true)
122
+ assert_exists('tmp2/res/layout/andParcel_test_row.xml',
108
123
  'tmp2/res/values/strings.xml',
109
124
  'tmp2/libs/one.jar',
110
125
  'tmp2/libs/two.jar',
111
126
  'tmp2/parcels/andParcel-test/docs/README')
112
- assert_exists('tmp2/parcels',
113
- 'tmp2/parcels/andParcel-test/andParcel-test_0.1.0.zip')
114
-
115
- doc=Nokogiri::XML(open('tmp2/AndroidManifest.xml'))
116
- app=doc.search('application')[0]
117
- existing=app.xpath("*[@android:name='ParcelToPackage']",
118
- 'android'=>"http://schemas.android.com/apk/res/android")
119
-
120
- assert existing[0].name=='activity'
121
- AndParcel::Parcel.install('tmp/andParcel-test_0.1.0.zip',
122
- :dir=>'tmp2', :replace=>true)
123
- assert_exists('tmp2/res/layout/andParcel_test_row.xml',
124
- 'tmp2/res/values/strings.xml',
125
- 'tmp2/libs/one.jar',
126
- 'tmp2/libs/two.jar',
127
- 'tmp2/parcels/andParcel-test/docs/README')
128
- ensure
129
- FileUtils.rm_rf 'tmp'
130
- FileUtils.rm_rf 'tmp2'
131
- end
132
- end
133
-
134
- test "should fail to install a parcel that is already installed" do
135
- begin
136
- clone_receiver
137
- FileUtils.mkdir 'tmp'
138
- target=AndParcel::Parcel.package('test/ParcelToPackage/parcel.json',
139
- :dir=>'tmp')
140
- assert target=='tmp/andParcel-test_0.1.0.zip'
141
- AndParcel::Parcel.install('tmp/andParcel-test_0.1.0.zip',
142
- :dir=>'tmp2')
143
-
144
- begin
145
- AndParcel::Parcel.install('tmp/andParcel-test_0.1.0.zip',
146
- :dir=>'tmp2')
147
- assert false
148
- rescue
149
- # OK, life is good
150
- end
151
- ensure
152
- FileUtils.rm_rf 'tmp'
153
- FileUtils.rm_rf 'tmp2'
154
- end
127
+ ensure
128
+ FileUtils.rm_rf 'tmp'
129
+ FileUtils.rm_rf 'tmp2'
155
130
  end
156
-
157
- test "should fail to install a parcel that does not exist" do
131
+ end
132
+
133
+ test "should fail to install a parcel that is already installed" do
134
+ begin
135
+ clone_receiver
136
+ FileUtils.mkdir 'tmp'
137
+ target=AndParcel::Parcel.package('test/ParcelToPackage/parcel.json',
138
+ :dir=>'tmp')
139
+ assert target=='tmp/andParcel-test_0.1.0.zip'
140
+ AndParcel::Parcel.install('tmp/andParcel-test_0.1.0.zip',
141
+ :dir=>'tmp2')
142
+
158
143
  begin
159
- clone_receiver
160
144
  AndParcel::Parcel.install('tmp/andParcel-test_0.1.0.zip',
161
- :dir=>'tmp2')
145
+ :dir=>'tmp2')
162
146
  assert false
163
147
  rescue
164
148
  # OK, life is good
165
- ensure
166
- FileUtils.rm_rf 'tmp2'
167
149
  end
150
+ ensure
151
+ FileUtils.rm_rf 'tmp'
152
+ FileUtils.rm_rf 'tmp2'
153
+ end
154
+ end
155
+
156
+ test "should fail to install a parcel that does not exist" do
157
+ begin
158
+ clone_receiver
159
+ AndParcel::Parcel.install('tmp/andParcel-test_0.1.0.zip',
160
+ :dir=>'tmp2')
161
+ assert false
162
+ rescue
163
+ # OK, life is good
164
+ ensure
165
+ FileUtils.rm_rf 'tmp2'
168
166
  end
169
167
  end
170
168
  end
data/test/test_package.rb CHANGED
@@ -3,216 +3,214 @@ require 'rubygems'
3
3
  require "protest"
4
4
  require "lib/andparcel"
5
5
 
6
- Protest.context("The parcel engine") do
6
+ Protest.context("when packaging a parcel") do
7
7
  def load_config(target)
8
8
  Zip::ZipFile.open(target) do |zf|
9
9
  JSON.parse(zf.read('parcel.json'))
10
10
  end
11
11
  end
12
12
 
13
- def config_assert(config)
13
+ def config_assert(config, has_manifest=false)
14
14
  assert config['name']=='andParcel-test'
15
15
  assert config['version']=='0.1.0'
16
16
  assert config['parcel-version']==AndParcel.version
17
17
  assert config['dependencies']==nil
18
+ assert config['minSdkVersion']=='4' if has_manifest
18
19
  end
19
20
 
20
- context("when packaging a parcel") do
21
- test "should support a parcel with no meaningful content" do
22
- begin
23
- FileUtils.mkdir 'tmp'
24
- target=AndParcel::Parcel.package('test/ParcelToPackage/parcel.json',
25
- :dir=>'tmp')
26
- assert target=='tmp/andParcel-test_0.1.0.zip'
27
- assert File.exists?(target)
28
- config=load_config(target)
29
- config_assert(config)
30
- ensure
31
- FileUtils.rm_rf 'tmp'
32
- end
21
+ test "should support a parcel with no meaningful content" do
22
+ begin
23
+ FileUtils.mkdir 'tmp'
24
+ target=AndParcel::Parcel.package('test/ParcelToPackage/parcel.json',
25
+ :dir=>'tmp')
26
+ assert target=='tmp/andParcel-test_0.1.0.zip'
27
+ assert File.exists?(target)
28
+ config=load_config(target)
29
+ config_assert(config)
30
+ ensure
31
+ FileUtils.rm_rf 'tmp'
33
32
  end
34
-
35
- test "should support a parcel with JARs" do
36
- begin
37
- FileUtils.mkdir 'tmp'
38
- target=AndParcel::Parcel.package('test/ParcelToPackage/parcel.json',
39
- :dir=>'tmp',
40
- :jars=>'libs')
41
- assert target=='tmp/andParcel-test_0.1.0.zip'
42
- assert File.exists?(target)
43
- config=load_config(target)
44
- config_assert(config)
45
-
46
- matches=0
47
- Zip::ZipFile.open(target) do |zf|
48
- zf.entries.each do |entry|
49
- if ('libs/one.jar'==entry.name ||
50
- 'libs/two.jar'==entry.name)
51
- matches+=1
52
- end
33
+ end
34
+
35
+ test "should support a parcel with JARs" do
36
+ begin
37
+ FileUtils.mkdir 'tmp'
38
+ target=AndParcel::Parcel.package('test/ParcelToPackage/parcel.json',
39
+ :dir=>'tmp',
40
+ :jars=>'libs')
41
+ assert target=='tmp/andParcel-test_0.1.0.zip'
42
+ assert File.exists?(target)
43
+ config=load_config(target)
44
+ config_assert(config)
45
+
46
+ matches=0
47
+ Zip::ZipFile.open(target) do |zf|
48
+ zf.entries.each do |entry|
49
+ if ('libs/one.jar'==entry.name ||
50
+ 'libs/two.jar'==entry.name)
51
+ matches+=1
53
52
  end
54
53
  end
55
- assert matches==2
56
- ensure
57
- FileUtils.rm_rf 'tmp'
58
54
  end
55
+ assert matches==2
56
+ ensure
57
+ FileUtils.rm_rf 'tmp'
59
58
  end
60
-
61
- test "should support a parcel with documentation" do
62
- begin
63
- FileUtils.mkdir 'tmp'
64
- target=AndParcel::Parcel.package('test/ParcelToPackage/parcel.json',
65
- :dir=>'tmp',
66
- :docs=>'docs')
67
- assert target=='tmp/andParcel-test_0.1.0.zip'
68
- assert File.exists?(target)
69
- config=load_config(target)
70
- config_assert(config)
71
-
72
- matches=0
73
- Zip::ZipFile.open(target) do |zf|
74
- zf.entries.each do |entry|
75
- if ('docs/README'==entry.name)
76
- matches+=1
77
- end
59
+ end
60
+
61
+ test "should support a parcel with documentation" do
62
+ begin
63
+ FileUtils.mkdir 'tmp'
64
+ target=AndParcel::Parcel.package('test/ParcelToPackage/parcel.json',
65
+ :dir=>'tmp',
66
+ :docs=>'docs')
67
+ assert target=='tmp/andParcel-test_0.1.0.zip'
68
+ assert File.exists?(target)
69
+ config=load_config(target)
70
+ config_assert(config)
71
+
72
+ matches=0
73
+ Zip::ZipFile.open(target) do |zf|
74
+ zf.entries.each do |entry|
75
+ if ('docs/README'==entry.name)
76
+ matches+=1
78
77
  end
79
78
  end
80
- assert matches==1
81
- ensure
82
- FileUtils.rm_rf 'tmp'
83
79
  end
80
+ assert matches==1
81
+ ensure
82
+ FileUtils.rm_rf 'tmp'
84
83
  end
85
-
86
- test "should support a parcel with resources" do
87
- begin
88
- FileUtils.mkdir 'tmp'
89
- target=AndParcel::Parcel.package('test/ParcelToPackage/parcel.json',
90
- :dir=>'tmp',
91
- :res=>'res')
92
- assert target=='tmp/andParcel-test_0.1.0.zip'
93
- assert File.exists?(target)
94
- config=load_config(target)
95
- config_assert(config)
96
-
97
- matches=0
98
- Zip::ZipFile.open(target) do |zf|
99
- zf.entries.each do |entry|
100
- if ('res/layout/andParcel_test_row.xml'==entry.name ||
101
- 'res/values/strings.xml'==entry.name)
102
- matches+=1
103
- end
84
+ end
85
+
86
+ test "should support a parcel with resources" do
87
+ begin
88
+ FileUtils.mkdir 'tmp'
89
+ target=AndParcel::Parcel.package('test/ParcelToPackage/parcel.json',
90
+ :dir=>'tmp',
91
+ :res=>'res')
92
+ assert target=='tmp/andParcel-test_0.1.0.zip'
93
+ assert File.exists?(target)
94
+ config=load_config(target)
95
+ config_assert(config)
96
+
97
+ matches=0
98
+ Zip::ZipFile.open(target) do |zf|
99
+ zf.entries.each do |entry|
100
+ if ('res/layout/andParcel_test_row.xml'==entry.name ||
101
+ 'res/values/strings.xml'==entry.name)
102
+ matches+=1
104
103
  end
105
104
  end
106
- assert matches==2
107
- ensure
108
- FileUtils.rm_rf 'tmp'
109
105
  end
106
+ assert matches==2
107
+ ensure
108
+ FileUtils.rm_rf 'tmp'
110
109
  end
111
-
112
- # test "should support a parcel with dependencies"
113
-
114
- test "should support a parcel with all sorts of stuff" do
115
- begin
116
- FileUtils.mkdir 'tmp'
117
- target=AndParcel::Parcel.package('test/ParcelToPackage/parcel.json',
118
- :dir=>'tmp',
119
- :jars=>'libs',
120
- :docs=>'docs')
121
- assert target=='tmp/andParcel-test_0.1.0.zip'
122
- assert File.exists?(target)
123
- config=load_config(target)
124
- config_assert(config)
125
-
126
- matches=0
127
- Zip::ZipFile.open(target) do |zf|
128
- zf.entries.each do |entry|
129
- if ('libs/one.jar'==entry.name ||
130
- 'libs/two.jar'==entry.name)
131
- matches+=1
132
- end
110
+ end
111
+
112
+ test "should support a parcel with all sorts of stuff" do
113
+ begin
114
+ FileUtils.mkdir 'tmp'
115
+ target=AndParcel::Parcel.package('test/ParcelToPackage/parcel.json',
116
+ :dir=>'tmp',
117
+ :jars=>'libs',
118
+ :manifest=>'AndroidManifest.xml',
119
+ :docs=>'docs')
120
+ assert target=='tmp/andParcel-test_0.1.0.zip'
121
+ assert File.exists?(target)
122
+ config=load_config(target)
123
+ config_assert(config, true)
124
+
125
+ matches=0
126
+ Zip::ZipFile.open(target) do |zf|
127
+ zf.entries.each do |entry|
128
+ if ('libs/one.jar'==entry.name ||
129
+ 'libs/two.jar'==entry.name)
130
+ matches+=1
133
131
  end
134
132
  end
135
- assert matches==2
136
-
137
- matches=0
138
- Zip::ZipFile.open(target) do |zf|
139
- zf.entries.each do |entry|
140
- if ('docs/README'==entry.name)
141
- matches+=1
142
- end
133
+ end
134
+ assert matches==2
135
+
136
+ matches=0
137
+ Zip::ZipFile.open(target) do |zf|
138
+ zf.entries.each do |entry|
139
+ if ('docs/README'==entry.name)
140
+ matches+=1
143
141
  end
144
142
  end
145
- assert matches==1
146
- ensure
147
- FileUtils.rm_rf 'tmp'
148
143
  end
144
+ assert matches==1
145
+ ensure
146
+ FileUtils.rm_rf 'tmp'
149
147
  end
150
-
151
- test "should fail if try to package with missing parcel.json" do
148
+ end
149
+
150
+ test "should fail if try to package with missing parcel.json" do
151
+ begin
152
+ FileUtils.mkdir 'tmp'
153
+
152
154
  begin
153
- FileUtils.mkdir 'tmp'
154
-
155
- begin
156
- target=AndParcel::Parcel.package('test/ThisDoesNotExist/parcel.json',
157
- :dir=>'tmp')
158
- assert false
159
- rescue
160
- assert Dir['tmp/*'].empty?
161
- end
162
- ensure
163
- FileUtils.rm_rf 'tmp'
155
+ target=AndParcel::Parcel.package('test/ThisDoesNotExist/parcel.json',
156
+ :dir=>'tmp')
157
+ assert false
158
+ rescue
159
+ assert Dir['tmp/*'].empty?
164
160
  end
161
+ ensure
162
+ FileUtils.rm_rf 'tmp'
165
163
  end
166
-
167
- test "should fail if try to package with missing JARs" do
164
+ end
165
+
166
+ test "should fail if try to package with missing JARs" do
167
+ begin
168
+ FileUtils.mkdir 'tmp'
169
+
168
170
  begin
169
- FileUtils.mkdir 'tmp'
170
-
171
- begin
172
- target=AndParcel::Parcel.package('test/ParcelToPackage/parcel.json',
173
- :dir=>'tmp',
174
- :jars=>'libs-fake')
175
- assert false
176
- rescue
177
- assert Dir['tmp/*'].empty?
178
- end
179
- ensure
180
- FileUtils.rm_rf 'tmp'
171
+ target=AndParcel::Parcel.package('test/ParcelToPackage/parcel.json',
172
+ :dir=>'tmp',
173
+ :jars=>'libs-fake')
174
+ assert false
175
+ rescue
176
+ assert Dir['tmp/*'].empty?
181
177
  end
178
+ ensure
179
+ FileUtils.rm_rf 'tmp'
182
180
  end
183
-
184
- test "should fail if try to package with missing documentation" do
181
+ end
182
+
183
+ test "should fail if try to package with missing documentation" do
184
+ begin
185
+ FileUtils.mkdir 'tmp'
186
+
185
187
  begin
186
- FileUtils.mkdir 'tmp'
187
-
188
- begin
189
- target=AndParcel::Parcel.package('test/ParcelToPackage/parcel.json',
190
- :dir=>'tmp',
191
- :docs=>'docs-fake')
192
- assert false
193
- rescue
194
- assert Dir['tmp/*'].empty?
195
- end
196
- ensure
197
- FileUtils.rm_rf 'tmp'
188
+ target=AndParcel::Parcel.package('test/ParcelToPackage/parcel.json',
189
+ :dir=>'tmp',
190
+ :docs=>'docs-fake')
191
+ assert false
192
+ rescue
193
+ assert Dir['tmp/*'].empty?
198
194
  end
195
+ ensure
196
+ FileUtils.rm_rf 'tmp'
199
197
  end
200
-
201
- test "should fail if try to package with missing resources" do
198
+ end
199
+
200
+ test "should fail if try to package with missing resources" do
201
+ begin
202
+ FileUtils.mkdir 'tmp'
203
+
202
204
  begin
203
- FileUtils.mkdir 'tmp'
204
-
205
- begin
206
- target=AndParcel::Parcel.package('test/ParcelToPackage/parcel.json',
207
- :dir=>'tmp',
208
- :res=>'res-fake')
209
- assert false
210
- rescue
211
- assert Dir['tmp/*'].empty?
212
- end
213
- ensure
214
- FileUtils.rm_rf 'tmp'
205
+ target=AndParcel::Parcel.package('test/ParcelToPackage/parcel.json',
206
+ :dir=>'tmp',
207
+ :res=>'res-fake')
208
+ assert false
209
+ rescue
210
+ assert Dir['tmp/*'].empty?
215
211
  end
212
+ ensure
213
+ FileUtils.rm_rf 'tmp'
216
214
  end
217
215
  end
218
216
  end
data/test/test_remove.rb CHANGED
@@ -3,7 +3,7 @@ require 'rubygems'
3
3
  require "protest"
4
4
  require "lib/andparcel"
5
5
 
6
- Protest.context("The parcel engine") do
6
+ Protest.context("when removing a parcel from a project") do
7
7
  def clone_receiver
8
8
  FileUtils.cp_r 'test/ParcelReceiver', 'tmp2'
9
9
  end
@@ -39,48 +39,46 @@ Protest.context("The parcel engine") do
39
39
  end
40
40
  end
41
41
 
42
- context("when removing a parcel from a project") do
43
- test "should support a parcel with no meaningful content" do
44
- remove_test
45
- end
46
-
47
- test "should support a parcel with JARs" do
48
- remove_test(['tmp2/libs/one.jar',
49
- 'tmp2/libs/two.jar'],
50
- :jars=>'libs')
51
- end
52
-
53
- test "should support a parcel with documentation" do
54
- remove_test([],
55
- :docs=>'docs')
56
- end
57
-
58
- test "should support a parcel with resources" do
59
- remove_test(['tmp2/res/layout/andParcel_test_row.xml',
60
- 'tmp2/res/values/strings.xml'],
61
- :res=>'res')
62
- end
63
-
64
- test "should support a parcel with all sorts of stuff" do
65
- remove_test(['tmp2/libs/one.jar',
66
- 'tmp2/libs/two.jar',
67
- 'tmp2/res/layout/andParcel_test_row.xml',
68
- 'tmp2/res/values/strings.xml'],
69
- :docs=>'docs',
70
- :jars=>'libs',
71
- :res=>'res')
72
- end
73
-
74
- test "should fail to remove a parcel that is not installed" do
75
- begin
76
- clone_receiver
77
- AndParcel::Parcel.remove('andParcel-test', :dir=>'tmp2')
78
- assert false
79
- rescue
80
- # Who-hoo!
81
- ensure
82
- FileUtils.rm_rf 'tmp2'
83
- end
42
+ test "should support a parcel with no meaningful content" do
43
+ remove_test
44
+ end
45
+
46
+ test "should support a parcel with JARs" do
47
+ remove_test(['tmp2/libs/one.jar',
48
+ 'tmp2/libs/two.jar'],
49
+ :jars=>'libs')
50
+ end
51
+
52
+ test "should support a parcel with documentation" do
53
+ remove_test([],
54
+ :docs=>'docs')
55
+ end
56
+
57
+ test "should support a parcel with resources" do
58
+ remove_test(['tmp2/res/layout/andParcel_test_row.xml',
59
+ 'tmp2/res/values/strings.xml'],
60
+ :res=>'res')
61
+ end
62
+
63
+ test "should support a parcel with all sorts of stuff" do
64
+ remove_test(['tmp2/libs/one.jar',
65
+ 'tmp2/libs/two.jar',
66
+ 'tmp2/res/layout/andParcel_test_row.xml',
67
+ 'tmp2/res/values/strings.xml'],
68
+ :docs=>'docs',
69
+ :jars=>'libs',
70
+ :res=>'res')
71
+ end
72
+
73
+ test "should fail to remove a parcel that is not installed" do
74
+ begin
75
+ clone_receiver
76
+ AndParcel::Parcel.remove('andParcel-test', :dir=>'tmp2')
77
+ assert false
78
+ rescue
79
+ # Who-hoo!
80
+ ensure
81
+ FileUtils.rm_rf 'tmp2'
84
82
  end
85
83
  end
86
84
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: andparcel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Murphy
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-05-09 00:00:00 -04:00
12
+ date: 2010-05-24 00:00:00 -04:00
13
13
  default_executable: parcel
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency