confetti 0.4.7 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,29 +1,13 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- confetti (0.4.7)
4
+ confetti (0.5.0)
5
5
  mustache (~> 0.11.2)
6
- thor (~> 0.14.3)
7
6
 
8
7
  GEM
9
8
  remote: http://rubygems.org/
10
9
  specs:
11
- aruba (0.2.6)
12
- background_process
13
- cucumber (~> 0.9.4)
14
- background_process (1.2)
15
- builder (2.1.2)
16
- cucumber (0.9.4)
17
- builder (~> 2.1.2)
18
- diff-lcs (~> 1.1.2)
19
- gherkin (~> 2.2.9)
20
- json (~> 1.4.6)
21
- term-ansicolor (~> 1.0.5)
22
10
  diff-lcs (1.1.2)
23
- gherkin (2.2.9)
24
- json (~> 1.4.6)
25
- term-ansicolor (~> 1.0.5)
26
- json (1.4.6)
27
11
  mustache (0.11.2)
28
12
  rspec (2.6.0)
29
13
  rspec-core (~> 2.6.0)
@@ -33,14 +17,10 @@ GEM
33
17
  rspec-expectations (2.6.0)
34
18
  diff-lcs (~> 1.1.2)
35
19
  rspec-mocks (2.6.0)
36
- term-ansicolor (1.0.5)
37
- thor (0.14.6)
38
20
 
39
21
  PLATFORMS
40
22
  ruby
41
23
 
42
24
  DEPENDENCIES
43
- aruba
44
25
  confetti!
45
- cucumber
46
26
  rspec (~> 2.6.0)
data/Rakefile CHANGED
@@ -6,14 +6,9 @@ task :spec do
6
6
  system "bundle exec rspec spec"
7
7
  end
8
8
 
9
- desc "run all cucumber features"
10
- task :features do
11
- system "bundle exec cucumber features"
12
- end
13
-
14
9
  namespace :spec do
15
10
  # more spec running tasks here
16
11
  # whenever
17
12
  end
18
13
 
19
- task :default => [:features, :spec]
14
+ task :default => [:spec]
data/confetti.gemspec CHANGED
@@ -17,13 +17,9 @@ Gem::Specification.new do |s|
17
17
 
18
18
  s.files = `git ls-files`.split("\n")
19
19
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
20
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
21
20
  s.require_paths = ["lib"]
22
21
 
23
22
  s.add_dependency "mustache", "~> 0.11.2"
24
- s.add_dependency "thor", "~> 0.14.3"
25
23
 
26
24
  s.add_development_dependency "rspec", "~> 2.6.0"
27
- s.add_development_dependency "cucumber"
28
- s.add_development_dependency "aruba"
29
25
  end
data/lib/confetti.rb CHANGED
@@ -11,7 +11,6 @@ rescue LoadError
11
11
  require "bundler/setup"
12
12
  end
13
13
 
14
- require "thor"
15
14
  require "mustache"
16
15
 
17
16
  # internal dependencies
@@ -24,12 +23,13 @@ require 'confetti/phonegap'
24
23
  require 'confetti/template'
25
24
  require 'confetti/templates/base'
26
25
  require 'confetti/templates/java_checks'
26
+ require 'confetti/templates/version_helper'
27
+
28
+ # each platform template
27
29
  Dir[File.join(CURRENT_DIR, 'confetti', 'templates', '*')].each do |file|
28
30
  require file if File.extname(file) == ".rb"
29
31
  end
30
32
  require 'confetti/template_helper'
31
33
 
32
- require 'confetti/cli'
33
-
34
34
  require 'confetti/config'
35
35
  require 'confetti/config/feature'
@@ -42,6 +42,9 @@
42
42
  </rim:loadingScreen>
43
43
 
44
44
  <rim:orientation mode="{{app_orientation}}" />
45
+ {{# no_cursor? }}
46
+ <rim:navigation />
47
+ {{/ no_cursor? }}
45
48
 
46
49
  <rim:permissions>
47
50
  <rim:permit>use_camera</rim:permit>
@@ -1,6 +1,8 @@
1
1
  module Confetti
2
2
  module Template
3
3
  class BlackberryWidgetsConfig < Base
4
+ include VersionHelper
5
+
4
6
  @@legacy_template = File.read(
5
7
  File.join(
6
8
  File.dirname(__FILE__),
@@ -35,11 +37,7 @@ module Confetti
35
37
  end
36
38
 
37
39
  def version
38
- if @config.version_string.nil? or @config.version_string.empty?
39
- "0.0.1"
40
- else
41
- @config.version_string
42
- end
40
+ normalize_version(@config.version_string)
43
41
  end
44
42
 
45
43
  def widget_name
@@ -89,6 +87,10 @@ module Confetti
89
87
  def app_orientation
90
88
  ORIENTATIONS_MAP[@config.orientation]
91
89
  end
90
+
91
+ def no_cursor?
92
+ @config.preference("disable-cursor") == :true
93
+ end
92
94
  end
93
95
  end
94
96
  end
@@ -32,4 +32,7 @@
32
32
  <rim:transitionEffect type="fadeOut"/>
33
33
  </rim:loadingScreen>
34
34
  <rim:orientation mode="{{app_orientation}}" />
35
+ {{# no_cursor? }}
36
+ <rim:navigation />
37
+ {{/ no_cursor? }}
35
38
  </widget>
@@ -50,5 +50,9 @@
50
50
  <key>UIStatusBarHidden</key>
51
51
  <true/>
52
52
  {{/ fullscreen? }}
53
+ {{# prerendered_icon? }}
54
+ <key>UIPrerenderedIcon</key>
55
+ <true/>
56
+ {{/ prerendered_icon? }}
53
57
  </dict>
54
58
  </plist>
@@ -53,6 +53,10 @@ module Confetti
53
53
  def fullscreen?
54
54
  @config.preference(:fullscreen) == :true
55
55
  end
56
+
57
+ def prerendered_icon?
58
+ @config.preference("prerendered-icon") == :true
59
+ end
56
60
  end
57
61
  end
58
62
  end
@@ -1,11 +1,20 @@
1
1
  module Confetti
2
2
  module Template
3
3
  module JavaChecks
4
+ RESERVED_WORDS = %w{abstract assert boolean break byte case catch char
5
+ class const continue default do double else enum extends false final
6
+ finally float for goto if implements import instanceof int interface
7
+ long native new null package private protected public return short
8
+ static strictfp super switch synchronized this throw throws transient
9
+ true try void volatile while}
10
+
4
11
  def is_java_identifier(str)
5
- str.match(/^[a-zA-Z_][a-zA-Z0-9_]*$/)
12
+ str.match(/^[a-zA-Z_][a-zA-Z0-9_]*$/) and !reserved_word?(str)
6
13
  end
7
14
 
8
15
  def convert_to_java_identifier(str)
16
+ return "_#{ str }" if reserved_word?(str)
17
+
9
18
  str.
10
19
  sub(/^\d/,"_").
11
20
  gsub(/\s/,"").
@@ -31,6 +40,11 @@ module Confetti
31
40
 
32
41
  fixed_bits.join('.')
33
42
  end
43
+
44
+ # checks whether str is a reserved word in Java
45
+ def reserved_word?(str)
46
+ RESERVED_WORDS.include?(str.downcase)
47
+ end
34
48
  end
35
49
  end
36
50
  end
@@ -0,0 +1,32 @@
1
+ module Confetti
2
+ module Template
3
+ module VersionHelper
4
+ class VersionError < Confetti::Error ; end
5
+
6
+ # ensure version is in "x.x.x" format
7
+ def normalize_version(str)
8
+ default = "0.0.1"
9
+
10
+ if str.nil? or str.empty?
11
+ default
12
+ elsif str.match /^(\d)+[.](\d)+[.](\d)+$/
13
+ str
14
+ elsif str.match /^((\d)+[.])*(\d)+$/
15
+ fix_version(str)
16
+ else
17
+ raise VersionError, "need a valid version number of the form 0.0.0"
18
+ end
19
+ end
20
+
21
+ private
22
+ def fix_version(str)
23
+ segments = str.split('.')
24
+
25
+ segments << '0' if segments.length == 1
26
+ segments << '0' if segments.length == 2
27
+
28
+ segments[0,3].join '.'
29
+ end
30
+ end
31
+ end
32
+ end
@@ -2,6 +2,7 @@ module Confetti
2
2
  module Template
3
3
  class WebosAppinfo < Base
4
4
  include JavaChecks
5
+ include VersionHelper
5
6
 
6
7
  def app_id
7
8
  if @config
@@ -20,30 +21,12 @@ module Confetti
20
21
  end
21
22
 
22
23
  def version
23
- if @config.version_string.nil?
24
- '0.0.1'
25
- elsif @config.version_string.match /^(\d)+[.](\d)+[.](\d)+$/
26
- @config.version_string
27
- elsif @config.version_string.match /^((\d)+[.])*(\d)+$/
28
- fix_version(@config.version_string)
29
- else
30
- fail "need a valid version number of the form 0.0.0"
31
- end
24
+ normalize_version(@config.version_string)
32
25
  end
33
26
 
34
27
  def vendor
35
28
  @config.author.name
36
29
  end
37
-
38
- private
39
- def fix_version(str)
40
- segments = str.split('.')
41
-
42
- segments << '0' if segments.length == 1
43
- segments << '0' if segments.length == 2
44
-
45
- segments[0,3].join '.'
46
- end
47
30
  end
48
31
  end
49
32
  end
@@ -1,3 +1,3 @@
1
1
  module Confetti
2
- VERSION = "0.4.7"
2
+ VERSION = "0.5.0"
3
3
  end
@@ -62,7 +62,6 @@ THE SOFTWARE.</license>
62
62
  </rim:loadingScreen>
63
63
 
64
64
  <rim:orientation mode="auto" />
65
-
66
65
  <rim:permissions>
67
66
  <rim:permit>use_camera</rim:permit>
68
67
  <rim:permit>read_device_identifying_information</rim:permit>
@@ -0,0 +1,21 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <widget xmlns = "http://www.w3.org/ns/widgets"
3
+ id = "com.app.bare"
4
+ version = "1.0.0">
5
+
6
+ <name>Confetti Bare App</name>
7
+
8
+ <description>
9
+ This is a sample config.xml with all Android permissions disabled
10
+ </description>
11
+
12
+ <author href="http://alunny.github.com"
13
+ email="hardeep.shoker@nitobi.com">
14
+ Hardeep Shoker
15
+ </author>
16
+
17
+ <icon src="smallicon.png" height="100" width="100" />
18
+ <icon src="bigicon.png" height="200" width="200" />
19
+
20
+ <preference name="disable-cursor" value="true"/>
21
+ </widget>
@@ -0,0 +1,21 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <widget xmlns = "http://www.w3.org/ns/widgets"
3
+ id = "com.app.bare"
4
+ version = "1.0.0">
5
+
6
+ <name>Confetti Bare App</name>
7
+
8
+ <description>
9
+ This is a sample config.xml with all Android permissions disabled
10
+ </description>
11
+
12
+ <author href="http://alunny.github.com"
13
+ email="hardeep.shoker@nitobi.com">
14
+ Hardeep Shoker
15
+ </author>
16
+
17
+ <icon src="smallicon.png" height="100" width="100" />
18
+ <icon src="bigicon.png" height="200" width="200" />
19
+
20
+ <preference name="prerendered-icon" value="true"/>
21
+ </widget>
data/spec/spec_helper.rb CHANGED
@@ -3,6 +3,7 @@ require "confetti"
3
3
  module HelpfulPaths
4
4
  SPEC_DIR = File.dirname(__FILE__)
5
5
  FIXTURE_DIR = SPEC_DIR + "/fixtures"
6
+ CONFIGS_DIR = FIXTURE_DIR + "/configs"
6
7
  TEMPLATES_DIR = File.expand_path "../lib/confetti/templates", SPEC_DIR
7
8
 
8
9
  def fixture_dir
@@ -12,6 +13,10 @@ module HelpfulPaths
12
13
  def templates_dir
13
14
  TEMPLATES_DIR
14
15
  end
16
+
17
+ def configs_dir
18
+ CONFIGS_DIR
19
+ end
15
20
  end
16
21
 
17
22
  module FileHelpers
@@ -178,4 +178,18 @@ describe Confetti::Template::BlackberryWidgetsConfig do
178
178
  @template.phonegap_version.should == "1.0.0"
179
179
  end
180
180
  end
181
+
182
+ describe "#no_cursor?" do
183
+ it "should be false with no preference" do
184
+ config = Confetti::Config.new("#{fixture_dir}/config.xml")
185
+ template = @template_class.new(config)
186
+ template.no_cursor?.should be_false
187
+ end
188
+
189
+ it "should be true when the preference is set" do
190
+ config = Confetti::Config.new("#{ configs_dir }/no-cursor.xml")
191
+ template = @template_class.new(config)
192
+ template.no_cursor?.should be_true
193
+ end
194
+ end
181
195
  end
@@ -140,4 +140,18 @@ describe Confetti::Template::IosInfo do
140
140
  template.fullscreen?.should be_true
141
141
  end
142
142
  end
143
+
144
+ describe "#prerendered_icon? method" do
145
+ it "should be false with no preference" do
146
+ config = Confetti::Config.new("#{fixture_dir}/config.xml")
147
+ template = @template_class.new(config)
148
+ template.prerendered_icon?.should be_false
149
+ end
150
+
151
+ it "should be true when the preference is set" do
152
+ config = Confetti::Config.new("#{ configs_dir }/prerendered.xml")
153
+ template = @template_class.new(config)
154
+ template.prerendered_icon?.should be_true
155
+ end
156
+ end
143
157
  end
@@ -4,18 +4,22 @@ describe Confetti::Template::JavaChecks do
4
4
  include Confetti::Template::JavaChecks
5
5
 
6
6
  describe "#is_java_identifier" do
7
- describe "should fail when" do
8
- it "has invalid characters" do
7
+ describe "should fail with" do
8
+ it "invalid characters" do
9
9
  is_java_identifier("ooo:bu").should be_false
10
10
  end
11
11
 
12
- it "begins with a number" do
12
+ it "an initial number" do
13
13
  is_java_identifier("12Class").should be_false
14
14
  end
15
15
 
16
- it "should fail wtih an empty string" do
16
+ it "an empty string" do
17
17
  is_java_identifier('').should be_false
18
18
  end
19
+
20
+ it "a reserved word" do
21
+ is_java_identifier('public').should be_false
22
+ end
19
23
  end
20
24
 
21
25
  describe "should succeed when" do
@@ -41,6 +45,10 @@ describe Confetti::Template::JavaChecks do
41
45
  it "should convert an initial digit to an underscore" do
42
46
  convert_to_java_identifier("12Foo").should == "_2Foo"
43
47
  end
48
+
49
+ it "should prefix a reserved word with an underscore" do
50
+ convert_to_java_identifier("public").should == "_public"
51
+ end
44
52
  end
45
53
 
46
54
  describe "#is_java_package_id" do
@@ -89,4 +97,18 @@ describe Confetti::Template::JavaChecks do
89
97
  convert_to_java_package_id(pkg).should == fixed_pkg
90
98
  end
91
99
  end
100
+
101
+ describe "#reserved_word?" do
102
+ it "should return true for reserved words" do
103
+ reserved_word?("void").should be_true
104
+ end
105
+
106
+ it "should return false for non-reserved words" do
107
+ reserved_word?("phonegap").should be_false
108
+ end
109
+
110
+ it "should return true for reserved words of any case" do
111
+ reserved_word?("Package").should be_true
112
+ end
113
+ end
92
114
  end
@@ -0,0 +1,35 @@
1
+ require 'spec_helper'
2
+
3
+ describe Confetti::Template::VersionHelper do
4
+ include Confetti::Template::VersionHelper
5
+
6
+ describe "#normalize_version" do
7
+ it "should return str if it matches expectations" do
8
+ normalize_version('1.8.7').should == "1.8.7"
9
+ end
10
+
11
+ it "should return the default (0.0.1) when str is nil" do
12
+ normalize_version(nil).should == "0.0.1"
13
+ end
14
+
15
+ it "should return the default (0.0.1) when str is empty" do
16
+ normalize_version('').should == "0.0.1"
17
+ end
18
+
19
+ it "should raise an error if version_string isn't even close" do
20
+ lambda { normalize_version('barbeque') }.should raise_error
21
+ end
22
+
23
+ it "should add empty digits if str has one segment" do
24
+ normalize_version('1').should == "1.0.0"
25
+ end
26
+
27
+ it "should add empty digits if string has two segments" do
28
+ normalize_version('1.1').should == "1.1.0"
29
+ end
30
+
31
+ it "should truncate extra digits if string has too many segments" do
32
+ normalize_version('1.2.3.4.5').should == "1.2.3"
33
+ end
34
+ end
35
+ 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: 1
4
+ hash: 11
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 4
9
- - 7
10
- version: 0.4.7
8
+ - 5
9
+ - 0
10
+ version: 0.5.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Andrew Lunny
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2012-01-02 00:00:00 -08:00
20
+ date: 2012-01-09 00:00:00 -08:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
@@ -36,26 +36,10 @@ dependencies:
36
36
  version: 0.11.2
37
37
  type: :runtime
38
38
  version_requirements: *id001
39
- - !ruby/object:Gem::Dependency
40
- name: thor
41
- prerelease: false
42
- requirement: &id002 !ruby/object:Gem::Requirement
43
- none: false
44
- requirements:
45
- - - ~>
46
- - !ruby/object:Gem::Version
47
- hash: 33
48
- segments:
49
- - 0
50
- - 14
51
- - 3
52
- version: 0.14.3
53
- type: :runtime
54
- version_requirements: *id002
55
39
  - !ruby/object:Gem::Dependency
56
40
  name: rspec
57
41
  prerelease: false
58
- requirement: &id003 !ruby/object:Gem::Requirement
42
+ requirement: &id002 !ruby/object:Gem::Requirement
59
43
  none: false
60
44
  requirements:
61
45
  - - ~>
@@ -67,40 +51,12 @@ dependencies:
67
51
  - 0
68
52
  version: 2.6.0
69
53
  type: :development
70
- version_requirements: *id003
71
- - !ruby/object:Gem::Dependency
72
- name: cucumber
73
- prerelease: false
74
- requirement: &id004 !ruby/object:Gem::Requirement
75
- none: false
76
- requirements:
77
- - - ">="
78
- - !ruby/object:Gem::Version
79
- hash: 3
80
- segments:
81
- - 0
82
- version: "0"
83
- type: :development
84
- version_requirements: *id004
85
- - !ruby/object:Gem::Dependency
86
- name: aruba
87
- prerelease: false
88
- requirement: &id005 !ruby/object:Gem::Requirement
89
- none: false
90
- requirements:
91
- - - ">="
92
- - !ruby/object:Gem::Version
93
- hash: 3
94
- segments:
95
- - 0
96
- version: "0"
97
- type: :development
98
- version_requirements: *id005
54
+ version_requirements: *id002
99
55
  description: " A little library to generate platform-specific mobile app\n configuration files from a W3C widget spec compliant config.xml"
100
56
  email:
101
57
  - alunny@gmail.com
102
- executables:
103
- - confetti
58
+ executables: []
59
+
104
60
  extensions: []
105
61
 
106
62
  extra_rdoc_files: []
@@ -112,18 +68,8 @@ files:
112
68
  - LICENSE
113
69
  - README.md
114
70
  - Rakefile
115
- - bin/confetti
116
71
  - confetti.gemspec
117
- - features/android.feature
118
- - features/blackberry.feature
119
- - features/command_line.feature
120
- - features/ios.feature
121
- - features/step_definitions/aruba_ext_steps.rb
122
- - features/support/setup.rb
123
- - features/symbian.wrt.feature
124
- - features/webos.feature
125
72
  - lib/confetti.rb
126
- - lib/confetti/cli.rb
127
73
  - lib/confetti/config.rb
128
74
  - lib/confetti/config/feature.rb
129
75
  - lib/confetti/error.rb
@@ -145,11 +91,11 @@ files:
145
91
  - lib/confetti/templates/java_checks.rb
146
92
  - lib/confetti/templates/symbian_wrt_info.mustache
147
93
  - lib/confetti/templates/symbian_wrt_info.rb
94
+ - lib/confetti/templates/version_helper.rb
148
95
  - lib/confetti/templates/webos_appinfo.mustache
149
96
  - lib/confetti/templates/webos_appinfo.rb
150
97
  - lib/confetti/version.rb
151
98
  - lib/typedset.rb
152
- - spec/cli_spec.rb
153
99
  - spec/config/config_author_spec.rb
154
100
  - spec/config/config_content_spec.rb
155
101
  - spec/config/config_feature_spec.rb
@@ -179,6 +125,8 @@ files:
179
125
  - spec/fixtures/config_with_version_code.xml
180
126
  - spec/fixtures/configs/blank-splash.xml
181
127
  - spec/fixtures/configs/config_bare.xml
128
+ - spec/fixtures/configs/no-cursor.xml
129
+ - spec/fixtures/configs/prerendered.xml
182
130
  - spec/fixtures/empty_elements.xml
183
131
  - spec/fixtures/ios/ios_info_expected.plist
184
132
  - spec/fixtures/ios/ios_info_spec.plist
@@ -199,6 +147,7 @@ files:
199
147
  - spec/templates/ios_info_spec.rb
200
148
  - spec/templates/java_checks_spec.rb
201
149
  - spec/templates/symbian_wrt_info_spec.rb
150
+ - spec/templates/version_helper_spec.rb
202
151
  - spec/templates/webos_appinfo_spec.rb
203
152
  - spec/typedset_spec.rb
204
153
  has_rdoc: true
@@ -236,15 +185,6 @@ signing_key:
236
185
  specification_version: 3
237
186
  summary: Generate mobile app config files
238
187
  test_files:
239
- - features/android.feature
240
- - features/blackberry.feature
241
- - features/command_line.feature
242
- - features/ios.feature
243
- - features/step_definitions/aruba_ext_steps.rb
244
- - features/support/setup.rb
245
- - features/symbian.wrt.feature
246
- - features/webos.feature
247
- - spec/cli_spec.rb
248
188
  - spec/config/config_author_spec.rb
249
189
  - spec/config/config_content_spec.rb
250
190
  - spec/config/config_feature_spec.rb
@@ -274,6 +214,8 @@ test_files:
274
214
  - spec/fixtures/config_with_version_code.xml
275
215
  - spec/fixtures/configs/blank-splash.xml
276
216
  - spec/fixtures/configs/config_bare.xml
217
+ - spec/fixtures/configs/no-cursor.xml
218
+ - spec/fixtures/configs/prerendered.xml
277
219
  - spec/fixtures/empty_elements.xml
278
220
  - spec/fixtures/ios/ios_info_expected.plist
279
221
  - spec/fixtures/ios/ios_info_spec.plist
@@ -294,5 +236,6 @@ test_files:
294
236
  - spec/templates/ios_info_spec.rb
295
237
  - spec/templates/java_checks_spec.rb
296
238
  - spec/templates/symbian_wrt_info_spec.rb
239
+ - spec/templates/version_helper_spec.rb
297
240
  - spec/templates/webos_appinfo_spec.rb
298
241
  - spec/typedset_spec.rb
data/bin/confetti DELETED
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "confetti/cli"
4
- Confetti::CLI.start
@@ -1,14 +0,0 @@
1
- Feature: Android
2
- In order to build Android Apps
3
- As a Mobile Developer
4
- I want to generate Android configuration files
5
-
6
- Scenario: I need an AndroidManifest
7
- When I have a config.xml file
8
- And I run "confetti generate android_manifest"
9
- Then a file named "AndroidManifest.xml" should exist
10
-
11
- Scenario: I need an Android strings.xml file
12
- When I have a config.xml file
13
- And I run "confetti generate android_strings"
14
- Then a file named "strings.xml" should exist
@@ -1,9 +0,0 @@
1
- Feature: Blackberry
2
- In order to build Blackberry Apps
3
- As a Mobile Developer
4
- I want to generate whatever config files are required
5
-
6
- Scenario: I need a (BB widget) config.xml
7
- When I have a config.xml file
8
- And I run "confetti generate blackberry_widgets_config"
9
- Then a file named "config.xml" should exist
@@ -1,12 +0,0 @@
1
- Feature: Command Line
2
- In order to generate mobile configurations
3
- As a PhoneGap Developer
4
- I want to use the Confetti CLI
5
-
6
- Scenario: I want an unsupported type
7
- When I have a config.xml file
8
- And I run "confetti generate microsoft_word"
9
- Then it should fail with:
10
- """
11
- microsoft_word unsupported
12
- """
data/features/ios.feature DELETED
@@ -1,9 +0,0 @@
1
- Feature: iOS
2
- In order to build iOS Apps
3
- As a Mobile Developer
4
- I want to generate the iOS configuration files
5
-
6
- Scenario: I need an Info.plist
7
- When I have a config.xml file
8
- And I run "confetti generate ios_info"
9
- Then a file named "Info.plist" should exist
@@ -1,7 +0,0 @@
1
- When /^I have a config.xml file$/ do
2
- fixtures_dir = File.join(File.dirname(__FILE__), '..', '..', 'spec', 'fixtures')
3
- fixtures_dir = File.expand_path(fixtures_dir)
4
- config_fixture = File.read(File.join(fixtures_dir, "config.xml"))
5
-
6
- create_file("config.xml", config_fixture)
7
- end
@@ -1 +0,0 @@
1
- require "aruba"
@@ -1,9 +0,0 @@
1
- Feature: Symbian.wrt
2
- In order to build Symbian.wrt Apps
3
- As a Mobile Developer
4
- I want to generate the Symbian.wrt configuration files
5
-
6
- Scenario: I need an info.plist
7
- When I have a config.xml file
8
- And I run "confetti generate symbian_wrt_info"
9
- Then a file named "info.plist" should exist
@@ -1,9 +0,0 @@
1
- Feature: webOS
2
- In order to build webOS Apps
3
- As a Mobile Developer
4
- I want to generate the webOS configuration files
5
-
6
- Scenario: I need a appinfo.json
7
- When I have a config.xml file
8
- And I run "confetti generate webos_appinfo"
9
- Then a file named "appinfo.json" should exist
data/lib/confetti/cli.rb DELETED
@@ -1,21 +0,0 @@
1
- require "confetti"
2
-
3
- module Confetti
4
- class CLI < Thor
5
- desc "generate OUTPUT_FILE", "Generates a config file of type OUTPUT_FILE"
6
- def generate(output_file)
7
- config_xml = File.join(Dir.pwd, "config.xml")
8
-
9
- config = Confetti::Config.new(config_xml)
10
- msg = "write_#{ output_file }".to_sym
11
-
12
- begin
13
- config.send msg
14
- rescue Confetti::Config::FiletypeError
15
- fail "Confetti failed: #{ output_file } unsupported"
16
- rescue Confetti::Error => e
17
- fail "Confetti Failed: #{ e.message }"
18
- end
19
- end
20
- end
21
- end
data/spec/cli_spec.rb DELETED
@@ -1,28 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Confetti::CLI do
4
- include HelpfulPaths
5
-
6
- describe "generate method" do
7
- before do
8
- Dir.stub(:pwd).and_return(fixture_dir)
9
- @cli = Confetti::CLI.new
10
- Confetti::Config.any_instance.stub(:open)
11
- end
12
-
13
- describe "with a correct ouput file" do
14
- it "should not raise an error" do
15
- lambda { @cli.generate "android_manifest" }.should_not raise_error
16
- end
17
- end
18
-
19
- describe "with an unsupported output file" do
20
- it "should raise the correct error" do
21
- lambda {
22
- @cli.generate "mgm_dvd"
23
- }.should raise_error RuntimeError,
24
- "Confetti failed: mgm_dvd unsupported"
25
- end
26
- end
27
- end
28
- end