confetti 0.2.0 → 0.2.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/Gemfile.lock +1 -1
- data/lib/confetti.rb +1 -0
- data/lib/confetti/config.rb +1 -0
- data/lib/confetti/phonegap.rb +12 -0
- data/lib/confetti/templates/android_manifest.rb +1 -0
- data/lib/confetti/version.rb +1 -1
- data/spec/fixtures/AndroidManifest_expected.xml +2 -2
- data/spec/fixtures/android_manifest_spec.xml +2 -2
- data/spec/phonegap_spec.rb +32 -0
- data/spec/templates/android_manifest_spec.rb +8 -0
- metadata +7 -4
data/Gemfile.lock
CHANGED
data/lib/confetti.rb
CHANGED
data/lib/confetti/config.rb
CHANGED
@@ -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
|
data/lib/confetti/version.rb
CHANGED
@@ -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:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
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
|
+
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
|