confetti 0.5.0 → 0.5.1

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/lib/confetti.rb CHANGED
@@ -25,10 +25,13 @@ require 'confetti/templates/base'
25
25
  require 'confetti/templates/java_checks'
26
26
  require 'confetti/templates/version_helper'
27
27
 
28
- # each platform template
29
- Dir[File.join(CURRENT_DIR, 'confetti', 'templates', '*')].each do |file|
30
- require file if File.extname(file) == ".rb"
31
- end
28
+ require 'confetti/templates/android_manifest'
29
+ require 'confetti/templates/android_strings'
30
+ require 'confetti/templates/blackberry_widgets_config'
31
+ require 'confetti/templates/ios_info'
32
+ require 'confetti/templates/symbian_wrt_info'
33
+ require 'confetti/templates/webos_appinfo'
34
+
32
35
  require 'confetti/template_helper'
33
36
 
34
37
  require 'confetti/config'
@@ -1,6 +1,7 @@
1
1
  module Confetti
2
2
  module PhoneGap
3
3
  PHONEGAP_APIS = %w{camera notification geolocation media contacts file network}
4
+ Plugin = Class.new Struct.new(:name, :version)
4
5
 
5
6
  def add_stock_phonegap_apis
6
7
  PHONEGAP_APIS.each do |api|
@@ -22,7 +23,21 @@ module Confetti
22
23
  else
23
24
  pref.value = v
24
25
  end
26
+ end
27
+
28
+ def plugins
29
+ p_name = /http:\/\/plugins[.]phonegap[.]com\/([^\/]*)\/([^\/]*)/
25
30
 
31
+ # find features corresponding to plugins
32
+ plugin_features = self.feature_set.select do |f|
33
+ f.name.match(p_name)
34
+ end
35
+
36
+ # turn matching features into plugins
37
+ plugin_features.map do |f|
38
+ matches = f.name.match(p_name)
39
+ Plugin.new(matches[1], matches[2])
40
+ end
26
41
  end
27
42
  end
28
43
  end
@@ -1,3 +1,3 @@
1
1
  module Confetti
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
@@ -29,4 +29,37 @@ describe Confetti::PhoneGap do
29
29
  @obj.add_stock_phonegap_apis
30
30
  end
31
31
  end
32
+
33
+ describe "#plugins" do
34
+ before do
35
+ @obj.feature_set = []
36
+ childbrowser = "http://plugins.phonegap.com/ChildBrowser/1.0.1"
37
+ fbconnect = "http://plugins.phonegap.com/FBConnect/1.2.1/"
38
+ file_api = "http://api.phonegap.com/1.0/file"
39
+
40
+ @obj.feature_set << Confetti::Config::Feature.new(childbrowser, nil)
41
+ @obj.feature_set << Confetti::Config::Feature.new(fbconnect, nil)
42
+ @obj.feature_set << Confetti::Config::Feature.new(file_api, nil)
43
+ end
44
+
45
+ it "should return an array with 2 entries" do
46
+ @obj.plugins.length.should be 2
47
+ end
48
+
49
+ it "should return an array with 2 Plugin objects" do
50
+ @obj.plugins.first.should be_a Confetti::PhoneGap::Plugin
51
+ @obj.plugins.last.should be_a Confetti::PhoneGap::Plugin
52
+ end
53
+
54
+ it "should return the right data as plugins" do
55
+ childbrowser = @obj.plugins.first
56
+ fbconnect = @obj.plugins.last
57
+
58
+ childbrowser.name.should == "ChildBrowser"
59
+ childbrowser.version.should == "1.0.1"
60
+
61
+ fbconnect.name.should == "FBConnect"
62
+ fbconnect.version.should == "1.2.1"
63
+ end
64
+ end
32
65
  end
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: confetti
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
5
4
  prerelease: false
6
5
  segments:
7
6
  - 0
8
7
  - 5
9
- - 0
10
- version: 0.5.0
8
+ - 1
9
+ version: 0.5.1
11
10
  platform: ruby
12
11
  authors:
13
12
  - Andrew Lunny
@@ -17,18 +16,16 @@ autorequire:
17
16
  bindir: bin
18
17
  cert_chain: []
19
18
 
20
- date: 2012-01-09 00:00:00 -08:00
19
+ date: 2012-02-17 00:00:00 -08:00
21
20
  default_executable:
22
21
  dependencies:
23
22
  - !ruby/object:Gem::Dependency
24
23
  name: mustache
25
24
  prerelease: false
26
25
  requirement: &id001 !ruby/object:Gem::Requirement
27
- none: false
28
26
  requirements:
29
27
  - - ~>
30
28
  - !ruby/object:Gem::Version
31
- hash: 55
32
29
  segments:
33
30
  - 0
34
31
  - 11
@@ -40,11 +37,9 @@ dependencies:
40
37
  name: rspec
41
38
  prerelease: false
42
39
  requirement: &id002 !ruby/object:Gem::Requirement
43
- none: false
44
40
  requirements:
45
41
  - - ~>
46
42
  - !ruby/object:Gem::Version
47
- hash: 23
48
43
  segments:
49
44
  - 2
50
45
  - 6
@@ -160,27 +155,23 @@ rdoc_options: []
160
155
  require_paths:
161
156
  - lib
162
157
  required_ruby_version: !ruby/object:Gem::Requirement
163
- none: false
164
158
  requirements:
165
159
  - - ">="
166
160
  - !ruby/object:Gem::Version
167
- hash: 3
168
161
  segments:
169
162
  - 0
170
163
  version: "0"
171
164
  required_rubygems_version: !ruby/object:Gem::Requirement
172
- none: false
173
165
  requirements:
174
166
  - - ">="
175
167
  - !ruby/object:Gem::Version
176
- hash: 3
177
168
  segments:
178
169
  - 0
179
170
  version: "0"
180
171
  requirements: []
181
172
 
182
173
  rubyforge_project: confetti
183
- rubygems_version: 1.3.7
174
+ rubygems_version: 1.3.6
184
175
  signing_key:
185
176
  specification_version: 3
186
177
  summary: Generate mobile app config files