confetti 0.1.0 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/README.md +26 -0
- data/lib/confetti/config.rb +7 -0
- data/lib/confetti/version.rb +1 -1
- data/spec/config_spec.rb +34 -0
- data/spec/fixtures/config.xml +1 -1
- metadata +4 -4
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,31 @@
|
|
1
1
|
# Confetti
|
2
2
|
|
3
|
+
> Write mobile app configuration files based on a W3C Widget compliant `config.xml` file
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
`gem install confetti`
|
8
|
+
|
9
|
+
## Usage
|
10
|
+
|
11
|
+
$ confetti generate android_manifest
|
12
|
+
|
13
|
+
or, from Ruby
|
14
|
+
|
15
|
+
require "confetti"
|
16
|
+
c_whatever = Confetti::Config.new "/some/dir/config.xml"
|
17
|
+
c_whatever.write_android_manifest "/some/dir/AndroidManifest.xml"
|
18
|
+
|
19
|
+
Supported outputs right now: `android_manifest`, `android_strings`, `webos_appinfo`, `ios_info`, `symbian_wrt_info`, `blackberry_widgets_config`
|
20
|
+
|
21
|
+
## Roadmap
|
22
|
+
|
23
|
+
* extra platforms: Windows Phone 7, who knows what else
|
24
|
+
* conversion from platform to platform (iOS to Android, or whatever)
|
25
|
+
* support for platform-specific preferences, and features as PhoneGap APIs
|
26
|
+
* you can see the config.xml file @ http://github.com/phonegap/phonegap-start for a sample of where we plan to go
|
27
|
+
* maybe some documentation (let's not go crazy)
|
28
|
+
|
3
29
|
## How to Add a New Platform
|
4
30
|
|
5
31
|
Let's say you want write a `nintendo_ds_config` generator:
|
data/lib/confetti/config.rb
CHANGED
@@ -50,8 +50,15 @@ module Confetti
|
|
50
50
|
ele.attributes["email"])
|
51
51
|
when "description"
|
52
52
|
@description = ele.text.strip
|
53
|
+
when "icon"
|
54
|
+
@icon_set << Icon.new(ele.attributes["src"], ele.attributes["height"],
|
55
|
+
ele.attributes["width"])
|
53
56
|
end
|
54
57
|
end
|
55
58
|
end
|
59
|
+
|
60
|
+
def icon
|
61
|
+
@icon_set.first
|
62
|
+
end
|
56
63
|
end
|
57
64
|
end
|
data/lib/confetti/version.rb
CHANGED
data/spec/config_spec.rb
CHANGED
@@ -198,6 +198,24 @@ describe Confetti::Config do
|
|
198
198
|
@config.author.email.should == "alunny@gmail.com"
|
199
199
|
end
|
200
200
|
end
|
201
|
+
|
202
|
+
describe "icons" do
|
203
|
+
it "should append icons to the icon_set" do
|
204
|
+
@config.icon_set.size.should be 1
|
205
|
+
end
|
206
|
+
|
207
|
+
it "should set the icon's src correctly" do
|
208
|
+
@config.icon_set.first.src.should == "icon.png"
|
209
|
+
end
|
210
|
+
|
211
|
+
it "should set the icon's height correctly" do
|
212
|
+
@config.icon_set.first.height.should == "150"
|
213
|
+
end
|
214
|
+
|
215
|
+
it "should set the icon's width correctly" do
|
216
|
+
@config.icon_set.first.width.should == "200"
|
217
|
+
end
|
218
|
+
end
|
201
219
|
end
|
202
220
|
end
|
203
221
|
|
@@ -214,4 +232,20 @@ describe Confetti::Config do
|
|
214
232
|
|
215
233
|
it_should_have_generate_and_write_methods_for :blackberry_widgets_config
|
216
234
|
end
|
235
|
+
|
236
|
+
describe "#icon helper" do
|
237
|
+
it "should return nil if no icon has been set" do
|
238
|
+
@config.icon.should be_nil
|
239
|
+
end
|
240
|
+
|
241
|
+
describe "when populated correctly" do
|
242
|
+
before do
|
243
|
+
@config = Confetti::Config.new(fixture_dir + "/config.xml")
|
244
|
+
end
|
245
|
+
|
246
|
+
it "should return an icon" do
|
247
|
+
@config.icon.should be_a Confetti::Config::Icon
|
248
|
+
end
|
249
|
+
end
|
250
|
+
end
|
217
251
|
end
|
data/spec/fixtures/config.xml
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: confetti
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 5
|
10
|
+
version: 0.1.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Andrew Lunny
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2011-02-21 00:00:00 -08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|