moonwalkair 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +21 -0
- data/LICENSE +20 -0
- data/README.rdoc +17 -0
- data/Rakefile +43 -0
- data/VERSION.yml +5 -0
- data/bin/moonwalk +5 -0
- data/lib/initializer.rb +40 -0
- data/lib/moonwalkair/generator/application.rb +36 -0
- data/lib/moonwalkair/generator/options.rb +47 -0
- data/lib/moonwalkair/generator.rb +125 -0
- data/lib/moonwalkair/templates/LICENSE +20 -0
- data/lib/moonwalkair/templates/README +7 -0
- data/lib/moonwalkair/templates/app/assets/css/jqtouch.css +373 -0
- data/lib/moonwalkair/templates/app/assets/css/theme.css +677 -0
- data/lib/moonwalkair/templates/app/assets/images/apple/backButton.png +0 -0
- data/lib/moonwalkair/templates/app/assets/images/apple/blueButton.png +0 -0
- data/lib/moonwalkair/templates/app/assets/images/apple/cancel.png +0 -0
- data/lib/moonwalkair/templates/app/assets/images/apple/chevron.png +0 -0
- data/lib/moonwalkair/templates/app/assets/images/apple/grayButton.png +0 -0
- data/lib/moonwalkair/templates/app/assets/images/apple/listArrowSel.png +0 -0
- data/lib/moonwalkair/templates/app/assets/images/apple/listGroup.png +0 -0
- data/lib/moonwalkair/templates/app/assets/images/apple/loading.gif +0 -0
- data/lib/moonwalkair/templates/app/assets/images/apple/on_off.png +0 -0
- data/lib/moonwalkair/templates/app/assets/images/apple/pinstripes.png +0 -0
- data/lib/moonwalkair/templates/app/assets/images/apple/selection.png +0 -0
- data/lib/moonwalkair/templates/app/assets/images/apple/thumb.png +0 -0
- data/lib/moonwalkair/templates/app/assets/images/apple/toggle.png +0 -0
- data/lib/moonwalkair/templates/app/assets/images/apple/toggleOn.png +0 -0
- data/lib/moonwalkair/templates/app/assets/images/apple/toolButton.png +0 -0
- data/lib/moonwalkair/templates/app/assets/images/apple/toolbar.png +0 -0
- data/lib/moonwalkair/templates/app/assets/images/apple/whiteButton.png +0 -0
- data/lib/moonwalkair/templates/app/assets/images/icons/128.png +0 -0
- data/lib/moonwalkair/templates/app/assets/images/icons/16.png +0 -0
- data/lib/moonwalkair/templates/app/assets/images/icons/32.png +0 -0
- data/lib/moonwalkair/templates/app/assets/images/icons/48.png +0 -0
- data/lib/moonwalkair/templates/app/lib/air/AIRAliases.js +233 -0
- data/lib/moonwalkair/templates/app/lib/air/AIRIntrospector.js +1949 -0
- data/lib/moonwalkair/templates/app/lib/air/AIRLocalizer.js +1325 -0
- data/lib/moonwalkair/templates/app/lib/air/AIRMenuBuilder.js +1322 -0
- data/lib/moonwalkair/templates/app/lib/air/AIRSourceViewer.js +2933 -0
- data/lib/moonwalkair/templates/app/lib/air/airglobal.abc +0 -0
- data/lib/moonwalkair/templates/app/lib/air/applicationupdater.swf +0 -0
- data/lib/moonwalkair/templates/app/lib/air/applicationupdater_ui.swf +0 -0
- data/lib/moonwalkair/templates/app/lib/air/servicemonitor.swf +0 -0
- data/lib/moonwalkair/templates/app/lib/jquery.js +4376 -0
- data/lib/moonwalkair/templates/app/lib/plugins/jqtouch/jqtouch.js +634 -0
- data/lib/moonwalkair/templates/app/lib/plugins/jqtouch/jqtouch.transitions.js +60 -0
- data/lib/moonwalkair/templates/app/views/index.html +19 -0
- data/lib/moonwalkair/templates/config/boot.rb +15 -0
- data/lib/moonwalkair/templates/config/build.yml +9 -0
- data/lib/moonwalkair/templates/config/config.yml +2 -0
- data/lib/moonwalkair/templates/config/update_config.xml +5 -0
- data/lib/moonwalkair/templates/descriptor.xml +122 -0
- data/lib/moonwalkair/templates/script/build +51 -0
- data/lib/moonwalkair/templates/script/certificate +26 -0
- data/lib/moonwalkair/templates/script/run +38 -0
- data/lib/moonwalkair.rb +15 -0
- data/moonwalkair.gemspec +108 -0
- data/spec/moonwalkair_spec.rb +7 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +9 -0
- metadata +127 -0
data/.document
ADDED
data/.gitignore
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Daniel Lopes
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
= moonwalkair
|
2
|
+
|
3
|
+
Description goes here.
|
4
|
+
|
5
|
+
== Note on Patches/Pull Requests
|
6
|
+
|
7
|
+
* Fork the project.
|
8
|
+
* Make your feature addition or bug fix.
|
9
|
+
* Add tests for it. This is important so I don't break it in a
|
10
|
+
future version unintentionally.
|
11
|
+
* Commit, do not mess with rakefile, version, or history.
|
12
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
13
|
+
* Send me a pull request. Bonus points for topic branches.
|
14
|
+
|
15
|
+
== Copyright
|
16
|
+
|
17
|
+
Copyright (c) 2009 Daniel Lopes. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "moonwalkair"
|
8
|
+
gem.summary = %Q{Help you to get your AIR/JS app up and running}
|
9
|
+
gem.description = %Q{Moonwalkair help you to start build your AIR app and make it walk in the right way. The gem let you start your development faster, creating the entire folder structure and many files that a AIR app depends}
|
10
|
+
gem.email = "danielvlopes@gmail.com"
|
11
|
+
gem.homepage = "http://github.com/danielvlopes/moonwalkair"
|
12
|
+
gem.authors = ["Daniel Lopes"]
|
13
|
+
gem.add_development_dependency "rspec", ">= 1.2.9"
|
14
|
+
end
|
15
|
+
Jeweler::GemcutterTasks.new
|
16
|
+
rescue LoadError
|
17
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
18
|
+
end
|
19
|
+
|
20
|
+
require 'spec/rake/spectask'
|
21
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
22
|
+
spec.libs << 'lib' << 'spec'
|
23
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
24
|
+
end
|
25
|
+
|
26
|
+
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
27
|
+
spec.libs << 'lib' << 'spec'
|
28
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
29
|
+
spec.rcov = true
|
30
|
+
end
|
31
|
+
|
32
|
+
task :spec => :check_dependencies
|
33
|
+
task :default => :spec
|
34
|
+
|
35
|
+
require 'rake/rdoctask'
|
36
|
+
Rake::RDocTask.new do |rdoc|
|
37
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
38
|
+
|
39
|
+
rdoc.rdoc_dir = 'rdoc'
|
40
|
+
rdoc.title = "moonwalkair #{version}"
|
41
|
+
rdoc.rdoc_files.include('README*')
|
42
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
43
|
+
end
|
data/VERSION.yml
ADDED
data/bin/moonwalk
ADDED
data/lib/initializer.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
module MoonwalkAir
|
2
|
+
class << self
|
3
|
+
def app_name
|
4
|
+
CONFIG["app_name"]
|
5
|
+
end
|
6
|
+
|
7
|
+
def root
|
8
|
+
@@moon_root ||= MOON_ROOT
|
9
|
+
end
|
10
|
+
|
11
|
+
def config
|
12
|
+
File.expand_path("#{root}/config")
|
13
|
+
end
|
14
|
+
|
15
|
+
def bin
|
16
|
+
File.expand_path("#{root}/bin")
|
17
|
+
end
|
18
|
+
|
19
|
+
def tmp
|
20
|
+
File.expand_path("#{root}/tmp")
|
21
|
+
end
|
22
|
+
|
23
|
+
def air_sdk
|
24
|
+
CONFIG["air_sdk"]
|
25
|
+
end
|
26
|
+
|
27
|
+
def air_lib
|
28
|
+
File.expand_path("#{air_sdk}/lib")
|
29
|
+
end
|
30
|
+
|
31
|
+
def air_bin
|
32
|
+
File.expand_path("#{air_sdk}/bin")
|
33
|
+
end
|
34
|
+
|
35
|
+
def air_frameworks
|
36
|
+
File.expand_path("#{air_sdk}/frameworks")
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
class Moonwalkair
|
2
|
+
class Generator
|
3
|
+
class Application
|
4
|
+
class << self
|
5
|
+
def run!(*arguments)
|
6
|
+
options = Moonwalkair::Generator::Options.new(arguments)
|
7
|
+
|
8
|
+
if options[:invalid_argument]
|
9
|
+
$stderr.puts options[:invalid_argument]
|
10
|
+
options[:show_help] = true
|
11
|
+
end
|
12
|
+
|
13
|
+
if options[:show_help]
|
14
|
+
$stderr.puts options.opts
|
15
|
+
return 1
|
16
|
+
end
|
17
|
+
|
18
|
+
if options[:project_name].nil? || options[:project_name].squeeze.strip == ""
|
19
|
+
$stderr.puts options.opts
|
20
|
+
return 1
|
21
|
+
end
|
22
|
+
|
23
|
+
begin
|
24
|
+
generator = Moonwalkair::Generator.new(options)
|
25
|
+
generator.run
|
26
|
+
return 0
|
27
|
+
rescue Moonwalkair::FileAlreadyExist
|
28
|
+
$stderr.puts "The directory #{options[:project_name]} already exists. Maybe move it out of the way before continuing?"
|
29
|
+
return 1
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
class Moonwalkair
|
2
|
+
class Generator
|
3
|
+
class Options < Hash
|
4
|
+
attr_reader :opts, :orig_args
|
5
|
+
|
6
|
+
def initialize(args)
|
7
|
+
super()
|
8
|
+
|
9
|
+
@orig_args = args.clone
|
10
|
+
|
11
|
+
require 'optparse'
|
12
|
+
@opts = OptionParser.new do |o|
|
13
|
+
o.banner = "Usage: #{File.basename($0)} [options] \ne.g. #{File.basename($0)} air-app"
|
14
|
+
|
15
|
+
o.on('-f', '--directory [DIRECTORY]', 'specify the directory to generate into') do |directory|
|
16
|
+
self[:directory] = directory
|
17
|
+
end
|
18
|
+
|
19
|
+
o.on('-d', '--description [DESCRIPTION]', 'specify a description of the project') do |description|
|
20
|
+
self[:description] = description
|
21
|
+
end
|
22
|
+
|
23
|
+
o.on('-n', '--user-name [USER_NAME]', "the user's name, ie that is credited in the LICENSE") do |user_name|
|
24
|
+
self[:user_name] = user_name
|
25
|
+
end
|
26
|
+
|
27
|
+
o.on('-e','--user-email [USER_EMAIL]', "the user's email, ie that is credited in the README") do |user_email|
|
28
|
+
self[:user_email] = user_email
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
begin
|
34
|
+
@opts.parse!(args)
|
35
|
+
self[:project_name] = args.shift
|
36
|
+
rescue OptionParser::InvalidOption => e
|
37
|
+
self[:invalid_argument] = e.message
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def merge(other)
|
42
|
+
self.class.new(@orig_args + other.orig_args)
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,125 @@
|
|
1
|
+
require 'erb'
|
2
|
+
require 'uri'
|
3
|
+
|
4
|
+
class Moonwalkair
|
5
|
+
class FileAlreadyExist < StandardError ; end
|
6
|
+
|
7
|
+
# Generator for creating a moonwalkair-enabled project
|
8
|
+
class Generator
|
9
|
+
require 'moonwalkair/generator/options'
|
10
|
+
require 'moonwalkair/generator/application'
|
11
|
+
|
12
|
+
# Folder and template files
|
13
|
+
APP_DIR = "app"
|
14
|
+
BIN_DIR = "bin"
|
15
|
+
SCRIPT_DIR = "script"
|
16
|
+
CONFIG_DIR = "config"
|
17
|
+
APP_ASSETS_DIR = File.join(APP_DIR, "assets")
|
18
|
+
APP_LIB_DIR = File.join(APP_DIR, "lib")
|
19
|
+
APP_SCRIPTS_DIR = File.join(APP_DIR, "scripts")
|
20
|
+
APP_VIEWS_DIR = File.join(APP_DIR, "views")
|
21
|
+
|
22
|
+
attr_accessor :target_dir, :user_name, :user_email, :project_name,
|
23
|
+
:options, :description, :air_sdk
|
24
|
+
|
25
|
+
def initialize(options = {})
|
26
|
+
self.options = options
|
27
|
+
|
28
|
+
self.project_name = options[:project_name]
|
29
|
+
if self.project_name.nil? || self.project_name.squeeze.strip == ""
|
30
|
+
raise "Need a project name"
|
31
|
+
end
|
32
|
+
|
33
|
+
self.air_sdk = options[:air_sdk] || "air2.0beta"
|
34
|
+
|
35
|
+
self.target_dir = options[:directory] || self.project_name
|
36
|
+
self.user_name = options[:user_name]
|
37
|
+
self.user_email = options[:user_email]
|
38
|
+
end
|
39
|
+
|
40
|
+
def run
|
41
|
+
create_files
|
42
|
+
$stdout.puts ""
|
43
|
+
$stdout.puts "*** Place your AIR SDK path in #{target_dir}/config/config.yml *** \t"
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
47
|
+
def create_files
|
48
|
+
unless File.exists?(target_dir) || File.directory?(target_dir)
|
49
|
+
FileUtils.mkdir target_dir
|
50
|
+
else
|
51
|
+
raise FileAlreadyExist, "The directory #{target_dir} already exists, aborting."
|
52
|
+
end
|
53
|
+
|
54
|
+
output_template_in_target 'README'
|
55
|
+
output_template_in_target 'LICENSE'
|
56
|
+
output_template_in_target 'descriptor.xml'
|
57
|
+
|
58
|
+
mkdir_in_target APP_DIR
|
59
|
+
mkdir_in_target BIN_DIR
|
60
|
+
|
61
|
+
mkdir_in_target SCRIPT_DIR
|
62
|
+
output_template_in_target File.join(SCRIPT_DIR, 'build')
|
63
|
+
output_template_in_target File.join(SCRIPT_DIR, 'run')
|
64
|
+
output_template_in_target File.join(SCRIPT_DIR, 'certificate')
|
65
|
+
|
66
|
+
mkdir_in_target CONFIG_DIR
|
67
|
+
output_template_in_target File.join(CONFIG_DIR, 'boot.rb')
|
68
|
+
output_template_in_target File.join(CONFIG_DIR, 'build.yml')
|
69
|
+
output_template_in_target File.join(CONFIG_DIR, 'update_config.xml')
|
70
|
+
output_template_in_target File.join(CONFIG_DIR, 'config.yml')
|
71
|
+
|
72
|
+
mkdir_in_target APP_ASSETS_DIR
|
73
|
+
mkdir_in_target File.join(APP_ASSETS_DIR, "audio")
|
74
|
+
copy_in_target File.join(APP_ASSETS_DIR, "images")
|
75
|
+
|
76
|
+
css_dir = File.join(APP_ASSETS_DIR, "css")
|
77
|
+
mkdir_in_target css_dir
|
78
|
+
touch_in_target File.join(css_dir, "#{project_name}.css")
|
79
|
+
output_template_in_target File.join(css_dir, "jqtouch.css")
|
80
|
+
output_template_in_target File.join(css_dir, "theme.css")
|
81
|
+
|
82
|
+
copy_in_target APP_LIB_DIR
|
83
|
+
copy_in_target APP_VIEWS_DIR
|
84
|
+
mkdir_in_target APP_SCRIPTS_DIR
|
85
|
+
end
|
86
|
+
|
87
|
+
def render_template(source)
|
88
|
+
template_contents = File.read(File.join(template_dir, source))
|
89
|
+
template = ERB.new(template_contents, nil, '<>')
|
90
|
+
|
91
|
+
# squish extraneous whitespace from some of the conditionals
|
92
|
+
template.result(binding).gsub(/\n\n\n+/, "\n\n")
|
93
|
+
end
|
94
|
+
|
95
|
+
def output_template_in_target(source, destination = source)
|
96
|
+
final_destination = File.join(target_dir, destination)
|
97
|
+
template_result = render_template(source)
|
98
|
+
|
99
|
+
File.open(final_destination, 'w') {|file| file.write(template_result)}
|
100
|
+
|
101
|
+
$stdout.puts "\tcreate\t#{destination}"
|
102
|
+
end
|
103
|
+
|
104
|
+
def template_dir
|
105
|
+
File.join(File.dirname(__FILE__), 'templates')
|
106
|
+
end
|
107
|
+
|
108
|
+
def mkdir_in_target(directory)
|
109
|
+
final_destination = File.join(target_dir, directory)
|
110
|
+
FileUtils.mkdir final_destination
|
111
|
+
$stdout.puts "\tcreate\t#{directory}"
|
112
|
+
end
|
113
|
+
|
114
|
+
def copy_in_target(directory)
|
115
|
+
FileUtils.cp_r File.join(template_dir,directory), File.join(target_dir, directory)
|
116
|
+
$stdout.puts "\tcreate\t#{directory}"
|
117
|
+
end
|
118
|
+
|
119
|
+
def touch_in_target(destination)
|
120
|
+
final_destination = File.join(target_dir, destination)
|
121
|
+
FileUtils.touch final_destination
|
122
|
+
$stdout.puts "\tcreate\t#{destination}"
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) <%= Date.today.year %> <%= user_name %>
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|