cordova-rake 0.0.3
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.
- checksums.yaml +7 -0
- data/.coveralls.yml +1 -0
- data/.gitignore +8 -0
- data/.hound.yml +2 -0
- data/.travis.yml +10 -0
- data/Gemfile +15 -0
- data/Guardfile +26 -0
- data/MIT-LICENSE +19 -0
- data/README.md +38 -0
- data/Rakefile +11 -0
- data/cordova-rake.gemspec +18 -0
- data/lib/cordova/rake.rb +9 -0
- data/lib/tasks/cordova.rake +204 -0
- metadata +56 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b5d17d4b08bcc44d95e0ef085872eadb8b270154
|
4
|
+
data.tar.gz: 886dd03236b9465ac950a2c29ed153bbb6b958a6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1d3da0235528e3b734edc42141aa2d5a5731f6191ec0f44ea64f1e3bca227583bf0c8fd763f203bb42fa2dfc80afee296bb29db7672e91c0296997f69f1d057a
|
7
|
+
data.tar.gz: 18552dfceda71a4b0ea2c9101e045354b60f60010983551aa0507d099a730a535e2da46641100ab477e94668cac2679ceeb59f1e014021824dfd599b07118286
|
data/.coveralls.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
service_name: travis-ci
|
data/.gitignore
ADDED
data/.hound.yml
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in phonie-codes.gemspec
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
group :test do
|
7
|
+
gem 'rake'
|
8
|
+
gem 'psych'
|
9
|
+
gem 'rubocop'
|
10
|
+
gem 'guard'
|
11
|
+
gem 'guard-rubocop'
|
12
|
+
gem 'minitest'
|
13
|
+
gem 'guard-minitest'
|
14
|
+
gem 'coveralls', require: false
|
15
|
+
end
|
data/Guardfile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
## Uncomment and set this to only include directories you want to watch
|
5
|
+
# directories %w(app lib config test spec feature)
|
6
|
+
|
7
|
+
## Uncomment to clear the screen before every task
|
8
|
+
# clearing :on
|
9
|
+
|
10
|
+
guard :minitest do
|
11
|
+
# with Minitest::Unit
|
12
|
+
# watch(%r{^test/(.*)\/?test_(.*)\.rb$})
|
13
|
+
# watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
|
14
|
+
# watch(%r{^test/test_helper\.rb$}) { 'test' }
|
15
|
+
|
16
|
+
# with Minitest::Spec
|
17
|
+
watch(/^spec\/(.*)_spec\.rb$/)
|
18
|
+
watch(/^lib\/(.+)\.rb$/) { 'spec' }
|
19
|
+
# watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
20
|
+
watch(/^spec\/spec_helper\.rb$/) { 'spec' }
|
21
|
+
end
|
22
|
+
|
23
|
+
guard :rubocop do
|
24
|
+
watch(/.+\.rb$/)
|
25
|
+
watch(/(?:.+\/)?\.rubocop\.yml$/) { |m| File.dirname(m[0]) }
|
26
|
+
end
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2014-2015 Cordova Rake Authors
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a
|
4
|
+
copy of this software and associated documentation files (the "Software"),
|
5
|
+
to deal in the Software without restriction, including without limitation
|
6
|
+
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
7
|
+
and/or sell copies of the Software, and to permit persons to whom the
|
8
|
+
Software is furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be
|
11
|
+
included in all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
14
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
15
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
16
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
17
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
18
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
19
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# Rake Cordova
|
2
|
+
|
3
|
+
[](http://badge.fury.io/rb/cordova-rake)
|
4
|
+
|
5
|
+
The missing cordova tasks. And the better: On Ruby!
|
6
|
+
|
7
|
+
## Install
|
8
|
+
|
9
|
+
gem install cordova-rake
|
10
|
+
|
11
|
+
|
12
|
+
## Use
|
13
|
+
|
14
|
+
Add to your `Rakefile`
|
15
|
+
|
16
|
+
require 'cordova-rake'
|
17
|
+
|
18
|
+
If you don't have one
|
19
|
+
|
20
|
+
echo "require 'cordova-rake'" > Rakefile
|
21
|
+
|
22
|
+
|
23
|
+
## From Rake
|
24
|
+
|
25
|
+
```
|
26
|
+
rake compile # Compiles all resources
|
27
|
+
rake compile:css # Compiles SASS -> CSS
|
28
|
+
rake compile:html # Compiles HAML -> HTML
|
29
|
+
rake compile:js # Compiles Coffee -> JS
|
30
|
+
rake compile:vars # Postcompile ENV variables
|
31
|
+
rake release:apple # Deploy to Apple’s App Store
|
32
|
+
rake release:google # Deploy to Google’s Play Store
|
33
|
+
rake ripple # Prepare & Ripple emulate
|
34
|
+
rake run:android # Run on Android device or emulator
|
35
|
+
rake run:ios # Run on iOS plugged device or emulator
|
36
|
+
rake serve # Phonegap Dev App, optional: port
|
37
|
+
rake setup # Setup env for development
|
38
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$LOAD_PATH.push File.expand_path('../lib', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = 'cordova-rake'
|
6
|
+
s.version = '0.0.3'
|
7
|
+
s.platform = Gem::Platform::RUBY
|
8
|
+
s.authors = ['Marcos Piccinini']
|
9
|
+
s.email = ['nofxx@github.com']
|
10
|
+
s.homepage = 'http://github.com/nofxx/cordova-rake'
|
11
|
+
s.summary = 'Rake tasks to help cordova development'
|
12
|
+
s.description = 'Rake tasks to help cordova development'
|
13
|
+
s.license = 'MIT'
|
14
|
+
|
15
|
+
s.files = `git ls-files`.split("\n")
|
16
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
|
+
s.require_paths = ['lib']
|
18
|
+
end
|
data/lib/cordova/rake.rb
ADDED
@@ -0,0 +1,204 @@
|
|
1
|
+
#
|
2
|
+
# Rake / Cordova
|
3
|
+
#
|
4
|
+
def get_sources(ext, dir = 'app')
|
5
|
+
source_files = Rake::FileList.new("#{dir}/**/*.#{ext}") do |fl|
|
6
|
+
fl.exclude("~*")
|
7
|
+
fl.exclude(/^scratch\//)
|
8
|
+
# fl.exclude { |f| `git ls-files #{f}`.empty? } # Only commited
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def environment
|
13
|
+
ENV['TARGET'] || 'development'
|
14
|
+
end
|
15
|
+
|
16
|
+
def config(key)
|
17
|
+
return @xml[key] if @xml
|
18
|
+
xml = Nokogiri::XML(File.open('config.xml'))
|
19
|
+
@xml = {
|
20
|
+
app: xml.xpath("//xmlns:name").text,
|
21
|
+
desc: xml.xpath("//xmlns:description").text,
|
22
|
+
platforms: xml.xpath("//xmlns:platform").map { |os| os['name'] }
|
23
|
+
}
|
24
|
+
config(key)
|
25
|
+
end
|
26
|
+
|
27
|
+
def app
|
28
|
+
config(:app)
|
29
|
+
end
|
30
|
+
|
31
|
+
def layout
|
32
|
+
@layout ||= Tilt.new('app/html/layout.haml')
|
33
|
+
end
|
34
|
+
|
35
|
+
task default: [:greet, :compile, :report]
|
36
|
+
|
37
|
+
task :greet do
|
38
|
+
puts "PhoneGap Rake! #{environment} #{ENV['CORDOVA_PLATFORMS']}"
|
39
|
+
puts "---"
|
40
|
+
end
|
41
|
+
|
42
|
+
desc 'Setup env for development'
|
43
|
+
task :setup do
|
44
|
+
sh 'npm -g install phonegap cordova coffee-script'
|
45
|
+
sh 'gem install haml sass yamg'
|
46
|
+
end
|
47
|
+
|
48
|
+
task :report do
|
49
|
+
puts "---"
|
50
|
+
puts "Rake done! #{format("%.2f", Time.now - START)}s"
|
51
|
+
end
|
52
|
+
|
53
|
+
desc 'Phonegap Dev App, optional: port.'
|
54
|
+
task :serve do
|
55
|
+
port = ARGV.last.to_i
|
56
|
+
port = 4000 if port.zero?
|
57
|
+
sh "phonegap serve -p #{port}"
|
58
|
+
end
|
59
|
+
|
60
|
+
desc 'Prepare & Ripple emulate'
|
61
|
+
task :ripple do
|
62
|
+
sh 'cordova prepare'
|
63
|
+
sh 'ripple emulate'
|
64
|
+
end
|
65
|
+
|
66
|
+
namespace :run do
|
67
|
+
desc 'Run on Android device or emulator'
|
68
|
+
task :android do
|
69
|
+
sh 'cordova build android'
|
70
|
+
sh 'cordova run android'
|
71
|
+
end
|
72
|
+
|
73
|
+
desc 'Run on iOS plugged device or emulator'
|
74
|
+
task :ios do
|
75
|
+
sh 'cordova build ios'
|
76
|
+
sh 'cordova run ios --device'
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
desc 'Compiles all resources'
|
81
|
+
task :compile => ['compile:all']
|
82
|
+
|
83
|
+
namespace :compile do
|
84
|
+
task :all => [:js, :css, :html, :vars]
|
85
|
+
|
86
|
+
desc 'Compiles Coffee -> JS'
|
87
|
+
task :js => get_sources(:coffee).ext('.js')
|
88
|
+
|
89
|
+
desc 'Compiles SASS -> CSS'
|
90
|
+
task :css => get_sources(:sass).ext('.css')
|
91
|
+
|
92
|
+
desc 'Compiles HAML -> HTML'
|
93
|
+
task :html => get_sources(:haml).ext('.html')
|
94
|
+
|
95
|
+
desc 'Postcompile ENV variables'
|
96
|
+
task :vars do
|
97
|
+
data = YAML.load_file('config/app.yml')[environment]
|
98
|
+
[:js, :css, :html].map { |f| get_sources(f, 'www/js') }.flatten.each do |f|
|
99
|
+
data.each do |k, v|
|
100
|
+
sh "sed -i \"s/'...#{k.upcase}...'/'#{v}'/g\" #{f}"
|
101
|
+
# sh "sed -i \"s/'####{k.upcase}###'/#{v}/g\" #{f}" # numbers
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
rule '.js' => '.coffee' do |t|
|
107
|
+
output = File.dirname(t.source).gsub(/app\//, 'www/')
|
108
|
+
# print "CoffeeScript | " # #{t.source} -> #{output}"
|
109
|
+
sh "coffee --no-header -b -o #{output} #{t.source}"
|
110
|
+
end
|
111
|
+
|
112
|
+
rule '.css' => '.sass' do |t|
|
113
|
+
# print "SASS | #{t.source} -> #{t.name} | "
|
114
|
+
sh "sass #{t.source} #{t.name.gsub(/app\//, 'www/')}"
|
115
|
+
end
|
116
|
+
|
117
|
+
rule '.html' => '.haml' do |t|
|
118
|
+
next if t.name =~ /layout/
|
119
|
+
template = Tilt.new(t.source)
|
120
|
+
# => #<Tilt::HAMLTemplate @file="path/to/file.haml" ...>
|
121
|
+
File.open(t.name.gsub(/app\//, 'www/'), 'w') do |f|
|
122
|
+
f.puts layout.render { template.render }
|
123
|
+
end
|
124
|
+
# print "HAML | #{t.source} -> #{t.name} | "
|
125
|
+
# sh "haml #{t.source} #{}"
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
#
|
130
|
+
#
|
131
|
+
# RELEASE
|
132
|
+
#
|
133
|
+
#
|
134
|
+
namespace :release do
|
135
|
+
|
136
|
+
task :check_dirs do
|
137
|
+
%w( .keys build ).each do |dir|
|
138
|
+
FileUtils.mkdir dir unless File.exist?(dir)
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
desc 'Deploy to Google’s Play Store'
|
143
|
+
task google: [:check_dirs, 'google:all', :report]
|
144
|
+
|
145
|
+
namespace :google do
|
146
|
+
task :all => [:clean, :keygen, :archive, :sign, :align, :check, :submit]
|
147
|
+
|
148
|
+
# desc 'Clean up build folder from apks'
|
149
|
+
task :clean do
|
150
|
+
Dir['build/*.apk'].each { |f| File.delete(f) }
|
151
|
+
end
|
152
|
+
|
153
|
+
# desc 'Generates Google Play Store .keystore'
|
154
|
+
task :keygen do
|
155
|
+
next if File.exist?('.keys/google.keystore')
|
156
|
+
puts "\nGenerate key first!\n\n"
|
157
|
+
sh "keytool -genkey -v -keystore ./.keys/google.keystore "\
|
158
|
+
"-alias #{app} -keyalg RSA -keysize 2048 -validity 10000"
|
159
|
+
end
|
160
|
+
|
161
|
+
task :archive do
|
162
|
+
sh 'cordova build --release android'
|
163
|
+
FileUtils.cp 'platforms/android/build/outputs'\
|
164
|
+
'/apk/android-release-unsigned.apk',
|
165
|
+
"build/#{app}-unsigned.apk"
|
166
|
+
end
|
167
|
+
|
168
|
+
task :sign do
|
169
|
+
sh "jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 "\
|
170
|
+
"-keystore ./.keys/google.keystore build/#{app}-unsigned.apk "\
|
171
|
+
"#{app}"
|
172
|
+
FileUtils.cp "build/#{app}-unsigned.apk", "build/#{app}-signed.apk"
|
173
|
+
end
|
174
|
+
|
175
|
+
task :align do
|
176
|
+
sh "zipalign -f -v 4 build/#{app}-signed.apk build/#{app}.apk"
|
177
|
+
end
|
178
|
+
|
179
|
+
task :check do
|
180
|
+
arch = "build/#{app}.apk"
|
181
|
+
if File.exists? arch
|
182
|
+
puts "Build done! #{arch} #{File.size(arch).to_f/(1024 * 1024)} Mb"
|
183
|
+
else
|
184
|
+
puts "Something BAD! No #{arch}!"
|
185
|
+
exit 1
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
task :submit do
|
190
|
+
#hope we can soon
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
#
|
195
|
+
# Apple
|
196
|
+
#
|
197
|
+
desc 'Deploy to Apple’s App Store'
|
198
|
+
task apple: [:check_keys_dir, 'apple:all', :report]
|
199
|
+
|
200
|
+
namespace :apple do
|
201
|
+
task :all => [:archive, :upload, :check]
|
202
|
+
|
203
|
+
end
|
204
|
+
end
|
metadata
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cordova-rake
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Marcos Piccinini
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-07-02 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Rake tasks to help cordova development
|
14
|
+
email:
|
15
|
+
- nofxx@github.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- ".coveralls.yml"
|
21
|
+
- ".gitignore"
|
22
|
+
- ".hound.yml"
|
23
|
+
- ".travis.yml"
|
24
|
+
- Gemfile
|
25
|
+
- Guardfile
|
26
|
+
- MIT-LICENSE
|
27
|
+
- README.md
|
28
|
+
- Rakefile
|
29
|
+
- cordova-rake.gemspec
|
30
|
+
- lib/cordova/rake.rb
|
31
|
+
- lib/tasks/cordova.rake
|
32
|
+
homepage: http://github.com/nofxx/cordova-rake
|
33
|
+
licenses:
|
34
|
+
- MIT
|
35
|
+
metadata: {}
|
36
|
+
post_install_message:
|
37
|
+
rdoc_options: []
|
38
|
+
require_paths:
|
39
|
+
- lib
|
40
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
45
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
requirements: []
|
51
|
+
rubyforge_project:
|
52
|
+
rubygems_version: 2.4.7
|
53
|
+
signing_key:
|
54
|
+
specification_version: 4
|
55
|
+
summary: Rake tasks to help cordova development
|
56
|
+
test_files: []
|