confetti 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- confetti (0.1.8)
4
+ confetti (0.2.0)
5
5
  mustache (= 0.11.2)
6
6
  thor (= 0.14.3)
7
7
 
data/lib/confetti.rb CHANGED
@@ -18,6 +18,7 @@ require "mustache"
18
18
  require 'typedset'
19
19
  require 'confetti/version'
20
20
  require 'confetti/helpers'
21
+ require 'confetti/phonegap'
21
22
 
22
23
  require 'confetti/template'
23
24
  require 'confetti/templates/base'
@@ -1,6 +1,7 @@
1
1
  module Confetti
2
2
  class Config
3
3
  include Helpers
4
+ include PhoneGap
4
5
  self.extend TemplateHelper
5
6
 
6
7
  attr_accessor :package, :version, :description, :height, :width
@@ -0,0 +1,12 @@
1
+ module Confetti
2
+ module PhoneGap
3
+ PHONEGAP_APIS = %w{camera notification geolocation media contacts file network}
4
+
5
+ def add_stock_phonegap_apis
6
+ PHONEGAP_APIS.each do |api|
7
+ api_name = "http://api.phonegap.com/1.0/#{ api }"
8
+ self.feature_set << Confetti::Config::Feature.new(api_name, nil)
9
+ end
10
+ end
11
+ end
12
+ end
@@ -47,6 +47,7 @@ module Confetti
47
47
  permissions.concat(associated_permissions) if associated_permissions
48
48
  end
49
49
 
50
+ permissions.sort!
50
51
  permissions.map { |f| { :name => f } }
51
52
  end
52
53
  end
@@ -1,3 +1,3 @@
1
1
  module Confetti
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -5,11 +5,11 @@
5
5
  android:versionCode="1">
6
6
  <uses-permission android:name="android.permission.READ_PHONE_STATE" />
7
7
  <uses-permission android:name="android.permission.INTERNET" />
8
- <uses-permission android:name="android.permission.VIBRATE" />
9
- <uses-permission android:name="android.permission.CAMERA" />
10
8
  <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
11
9
  <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
12
10
  <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
11
+ <uses-permission android:name="android.permission.CAMERA" />
12
+ <uses-permission android:name="android.permission.VIBRATE" />
13
13
  <application android:icon="@drawable/icon" android:label="@string/app_name"
14
14
  android:debuggable="true">
15
15
  <activity android:name=".ConfettiSampleApp"
@@ -5,9 +5,9 @@
5
5
  android:versionCode="1">
6
6
  <uses-permission android:name="android.permission.READ_PHONE_STATE" />
7
7
  <uses-permission android:name="android.permission.INTERNET" />
8
- <uses-permission android:name="android.permission.RECORD_AUDIO" />
9
- <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
10
8
  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
9
+ <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
10
+ <uses-permission android:name="android.permission.RECORD_AUDIO" />
11
11
  <application android:icon="@drawable/icon" android:label="@string/app_name"
12
12
  android:debuggable="true">
13
13
  <activity android:name=".AwesomeApp"
@@ -0,0 +1,32 @@
1
+ require "spec_helper"
2
+
3
+ class PhoneGapSpec
4
+ include Confetti::PhoneGap
5
+
6
+ attr_accessor :feature_set
7
+
8
+ def initialize
9
+ @feature_set = []
10
+ end
11
+ end
12
+
13
+ describe Confetti::PhoneGap do
14
+ before do
15
+ @obj = PhoneGapSpec.new
16
+ end
17
+
18
+ describe "#add_stock_phonegap_apis" do
19
+ it "should access the object's feature_set" do
20
+ @obj.should_receive(:feature_set).at_least(:once).and_return([])
21
+
22
+ @obj.add_stock_phonegap_apis
23
+ end
24
+
25
+ it "should add one feature for every PhoneGap API" do
26
+ count = Confetti::PhoneGap::PHONEGAP_APIS.length
27
+ @obj.feature_set.should_receive(:<<).exactly(count).times
28
+
29
+ @obj.add_stock_phonegap_apis
30
+ end
31
+ end
32
+ end
@@ -89,5 +89,13 @@ describe Confetti::Template::AndroidManifest do
89
89
  # 1 camera, 1 network, 2 media
90
90
  @template.permissions.size.should be 4
91
91
  end
92
+
93
+ # its dumb, but lets me test
94
+ it "should be sorted alphabetically" do
95
+ expected = ["ACCESS_NETWORK_STATE", "CAMERA", "MODIFY_AUDIO_SETTINGS", "RECORD_AUDIO"]
96
+ permission_names = @template.permissions.map { |f| f[:name] }
97
+
98
+ permission_names.should == expected
99
+ end
92
100
  end
93
101
  end
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: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 0
10
- version: 0.2.0
9
+ - 1
10
+ version: 0.2.1
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: 2011-03-18 00:00:00 -07:00
18
+ date: 2011-03-21 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -124,6 +124,7 @@ files:
124
124
  - lib/confetti/config.rb
125
125
  - lib/confetti/config/feature.rb
126
126
  - lib/confetti/helpers.rb
127
+ - lib/confetti/phonegap.rb
127
128
  - lib/confetti/template.rb
128
129
  - lib/confetti/template_helper.rb
129
130
  - lib/confetti/templates/android_manifest.mustache
@@ -169,6 +170,7 @@ files:
169
170
  - spec/fixtures/webos_appinfo_spec.json
170
171
  - spec/helpers_spec.rb
171
172
  - spec/integration_spec.rb
173
+ - spec/phonegap_spec.rb
172
174
  - spec/spec_helper.rb
173
175
  - spec/template_spec.rb
174
176
  - spec/templates/android_manifest_spec.rb
@@ -249,6 +251,7 @@ test_files:
249
251
  - spec/fixtures/webos_appinfo_spec.json
250
252
  - spec/helpers_spec.rb
251
253
  - spec/integration_spec.rb
254
+ - spec/phonegap_spec.rb
252
255
  - spec/spec_helper.rb
253
256
  - spec/template_spec.rb
254
257
  - spec/templates/android_manifest_spec.rb