cordova-rake 0.0.5 → 0.0.7
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 +4 -4
- data/README.md +87 -13
- data/cordova-rake.gemspec +5 -1
- data/lib/cordova/rake.rb +6 -4
- data/lib/tasks/application.rake +20 -9
- data/lib/tasks/cordova.rake +32 -7
- data/lib/tasks/deploy.rake +26 -21
- data/lib/templates/Guardfile +13 -0
- metadata +46 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70d12e1fd9d7513756bc92fe1edfa7a641913ef7
|
4
|
+
data.tar.gz: ab842a6b53d717dd8523375ce5ba1dfa05da37cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a66bc53073b0237732ecf048a4808765633658d4533fb5b7281d0835ccf4b678753081f721330ebacf05682af9e686967c73120508c0178d8ac5cd70ab3ec000
|
7
|
+
data.tar.gz: 033e9ce4b6038f4192e4a362e28183c02716a347362b77d55b59f46b8ed2319d4c297e88f812f8d483e242588908c507574f1b963b00a07f1bd6d3807ca7ad57
|
data/README.md
CHANGED
@@ -13,7 +13,7 @@ The missing cordova tasks. And the better: On Ruby!
|
|
13
13
|
|
14
14
|
Add to your `Rakefile`
|
15
15
|
|
16
|
-
require 'cordova
|
16
|
+
require 'cordova/rake'
|
17
17
|
|
18
18
|
If you don't have one
|
19
19
|
|
@@ -23,20 +23,87 @@ If you don't have one
|
|
23
23
|
## rake -T
|
24
24
|
|
25
25
|
```
|
26
|
-
rake compile
|
27
|
-
rake compile:css
|
28
|
-
rake compile:html
|
29
|
-
rake compile:js
|
30
|
-
rake compile:vars
|
31
|
-
rake
|
32
|
-
rake
|
33
|
-
rake
|
34
|
-
rake
|
35
|
-
rake
|
36
|
-
rake
|
37
|
-
rake
|
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 emulate:android # Run on Android emulator
|
32
|
+
rake emulate:ios # Run on iOS emulator
|
33
|
+
rake guard # Prepare & Ripple emulate
|
34
|
+
rake release # Compiles all resources with ENV=production
|
35
|
+
rake release:apple # Deploy to Apple’s App Store
|
36
|
+
rake release:google # Deploy to Google’s Play Store
|
37
|
+
rake ripple # Prepare & Ripple emulate
|
38
|
+
rake run:android # Run on Android device or emulator
|
39
|
+
rake run:ios # Run on iOS plugged device or emulator
|
40
|
+
rake serve # Phonegap Dev App, optional: port
|
41
|
+
rake setup # Setup env for development
|
38
42
|
```
|
39
43
|
|
44
|
+
# Guard + Compile
|
45
|
+
|
46
|
+
Just run `guard`. Or directly `rake`.
|
47
|
+
```
|
48
|
+
HAML -> HTML
|
49
|
+
SASS -> CSS
|
50
|
+
COFFEE -> JS
|
51
|
+
```
|
52
|
+
Right into www/
|
53
|
+
|
54
|
+
## Config
|
55
|
+
|
56
|
+
Create a config/app.yml:
|
57
|
+
|
58
|
+
```
|
59
|
+
development:
|
60
|
+
server: '10.1.1.88:3000'
|
61
|
+
production:
|
62
|
+
server: 'site.com'
|
63
|
+
```
|
64
|
+
|
65
|
+
This postcompiles ERB tags `<%= server %>` into the env's value.
|
66
|
+
|
67
|
+
Example `file.coffee`:
|
68
|
+
|
69
|
+
apiURL = 'http://<%= server %>'
|
70
|
+
|
71
|
+
Will render `file.js` in production:
|
72
|
+
|
73
|
+
apiURL = 'http://site.com'
|
74
|
+
|
75
|
+
### HAML
|
76
|
+
|
77
|
+
You may use ERB tags anywhere in haml.
|
78
|
+
You may also use ERB logic if wanted.
|
79
|
+
|
80
|
+
Tip: to precompile more than once the same ERB tag: `<%%= value %>`.
|
81
|
+
First time it'll compile to `<%= value %>`.
|
82
|
+
|
83
|
+
### Coffee
|
84
|
+
|
85
|
+
Content replaced must be inside a string.
|
86
|
+
|
87
|
+
|
88
|
+
### SASS
|
89
|
+
|
90
|
+
To precompile a value that must not contain quotes (eg colors):
|
91
|
+
Use `unquote('<%= value %>')`:
|
92
|
+
|
93
|
+
```sass
|
94
|
+
.btn
|
95
|
+
color: unquote('<%= color %>')
|
96
|
+
```
|
97
|
+
|
98
|
+
Will render CSS:
|
99
|
+
|
100
|
+
```sass
|
101
|
+
.btn {
|
102
|
+
color: #FF3311;
|
103
|
+
}
|
104
|
+
```
|
105
|
+
|
106
|
+
# Deploy
|
40
107
|
|
41
108
|
## Google | Play Store
|
42
109
|
|
@@ -70,3 +137,10 @@ Also you need to open the project once in Xcode. (working on xproject gem)
|
|
70
137
|
To change developer per project:
|
71
138
|
|
72
139
|
APPLE_DEVELOPER = 'Developer X (XXXXX)'
|
140
|
+
|
141
|
+
|
142
|
+
## YAMG - Yet Another Media Generator
|
143
|
+
|
144
|
+
To generate icons, splashes and screenshots check out:
|
145
|
+
|
146
|
+
https://github.com/nofxx/yamg
|
data/cordova-rake.gemspec
CHANGED
@@ -3,7 +3,7 @@ $LOAD_PATH.push File.expand_path('../lib', __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = 'cordova-rake'
|
6
|
-
s.version = '0.0.
|
6
|
+
s.version = '0.0.7'
|
7
7
|
s.platform = Gem::Platform::RUBY
|
8
8
|
s.authors = ['Marcos Piccinini']
|
9
9
|
s.email = ['nofxx@github.com']
|
@@ -12,6 +12,10 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.description = 'Rake tasks to help cordova development'
|
13
13
|
s.license = 'MIT'
|
14
14
|
|
15
|
+
s.add_dependency('paint', ['>= 1.0.0'])
|
16
|
+
s.add_dependency('tilt', ['>= 2.0.0'])
|
17
|
+
s.add_dependency('nokogiri', ['>= 1.6.0'])
|
18
|
+
|
15
19
|
s.files = `git ls-files`.split("\n")
|
16
20
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
21
|
s.require_paths = ['lib']
|
data/lib/cordova/rake.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
require 'rake'
|
2
2
|
require 'yaml'
|
3
3
|
require 'tilt'
|
4
|
+
require 'paint'
|
4
5
|
require 'nokogiri'
|
6
|
+
require 'erb'
|
5
7
|
START = Time.now
|
6
8
|
|
7
9
|
#
|
@@ -15,10 +17,6 @@ def get_sources(ext, dir = 'app')
|
|
15
17
|
end
|
16
18
|
end
|
17
19
|
|
18
|
-
def environment
|
19
|
-
ENV['TARGET'] || 'development'
|
20
|
-
end
|
21
|
-
|
22
20
|
def config(key)
|
23
21
|
return @xml[key] if @xml
|
24
22
|
xml = Nokogiri::XML(File.open('config.xml'))
|
@@ -38,6 +36,10 @@ def app
|
|
38
36
|
config(:app)
|
39
37
|
end
|
40
38
|
|
39
|
+
def env
|
40
|
+
@env ||= ENV['TARGET'] || 'development'
|
41
|
+
end
|
42
|
+
|
41
43
|
# And load all tasks
|
42
44
|
tasks = File.join(File.dirname(__FILE__), '..', 'tasks')
|
43
45
|
Dir.glob("#{tasks}/*.rake").each { |r| import r }
|
data/lib/tasks/application.rake
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
desc 'Compiles all resources'
|
2
|
-
task :compile
|
2
|
+
task :compile => [:greet, 'compile:all', :report]
|
3
|
+
desc 'Compiles all resources with ENV=production'
|
4
|
+
task :release => [:set_release, :compile]
|
5
|
+
|
6
|
+
task :set_release do
|
7
|
+
@env = 'production'
|
8
|
+
end
|
9
|
+
|
10
|
+
class Erbs < OpenStruct
|
11
|
+
def render(template)
|
12
|
+
ERB.new(template).result(binding)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
3
16
|
|
4
17
|
namespace :compile do
|
5
18
|
task :all => [:js, :css, :html, :vars]
|
@@ -15,12 +28,11 @@ namespace :compile do
|
|
15
28
|
|
16
29
|
desc 'Postcompile ENV variables'
|
17
30
|
task :vars do
|
18
|
-
data = YAML.load_file('config/app.yml')[
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
end
|
31
|
+
data = YAML.load_file('config/app.yml')[env]
|
32
|
+
# STDOUT.puts 'ERB.new(config/app.yml).render on www/'
|
33
|
+
[:js, :css, :html].map { |f| get_sources(f, 'www') }.flatten.each do |file|
|
34
|
+
out = Erbs.new(data).render(File.read(file))
|
35
|
+
File.open(file, 'w') { |f| f << out }
|
24
36
|
end
|
25
37
|
end
|
26
38
|
|
@@ -42,7 +54,6 @@ namespace :compile do
|
|
42
54
|
File.open(t.name.gsub(/app\//, 'www/'), 'w') do |f|
|
43
55
|
f.puts layout.render { template.render }
|
44
56
|
end
|
45
|
-
|
46
|
-
# sh "haml #{t.source} #{}"
|
57
|
+
STDOUT.puts "haml #{t.source} -> #{t.name}"
|
47
58
|
end
|
48
59
|
end
|
data/lib/tasks/cordova.rake
CHANGED
@@ -2,22 +2,23 @@
|
|
2
2
|
# Rake / Cordova
|
3
3
|
#
|
4
4
|
|
5
|
-
task default: [:
|
5
|
+
task default: [:compile]
|
6
6
|
|
7
7
|
task :greet do
|
8
|
-
puts "
|
9
|
-
puts "
|
8
|
+
puts Paint["Cordova Rake [#{env}] #{ENV['CORDOVA_PLATFORMS']}", :red]
|
9
|
+
puts Paint[" ----", :red]
|
10
10
|
end
|
11
11
|
|
12
12
|
desc 'Setup env for development'
|
13
13
|
task :setup do
|
14
|
-
sh 'npm -g install phonegap cordova coffee-script'
|
15
|
-
sh '
|
14
|
+
sh 'npm -g install phonegap cordova coffee-script '
|
15
|
+
sh 'npm -g install ios-deploy ios-sim ' if RUBY_PLATFORM =~ /darwin/
|
16
|
+
sh 'gem install haml sass yamg guard guard-coffeelint'
|
16
17
|
end
|
17
18
|
|
18
19
|
task :report do
|
19
|
-
puts "
|
20
|
-
puts "Rake done! #{format("%.2f", Time.now - START)}s"
|
20
|
+
puts Paint["----", :red]
|
21
|
+
puts Paint["Rake done! #{format("%.2f", Time.now - START)}s", :black]
|
21
22
|
end
|
22
23
|
|
23
24
|
desc 'Phonegap Dev App, optional: port.'
|
@@ -33,6 +34,30 @@ task :ripple do
|
|
33
34
|
sh 'ripple emulate'
|
34
35
|
end
|
35
36
|
|
37
|
+
desc 'Prepare & Ripple emulate'
|
38
|
+
task :guard do
|
39
|
+
if File.exists?('Guardfile')
|
40
|
+
puts "Guardfile exists"
|
41
|
+
else
|
42
|
+
puts "Creating Guardfile"
|
43
|
+
FileUtils.cp(File.join(__FILE__, '..', 'templates', 'Guardfile'), '.')
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
namespace :emulate do
|
48
|
+
desc 'Run on Android emulator'
|
49
|
+
task :android do
|
50
|
+
sh 'cordova build android'
|
51
|
+
sh "cordova emulate android --target #{ARGV[1]}"
|
52
|
+
end
|
53
|
+
|
54
|
+
desc 'Run on iOS emulator'
|
55
|
+
task :ios do
|
56
|
+
sh 'cordova build ios'
|
57
|
+
sh 'cordova emulate ios'
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
36
61
|
namespace :run do
|
37
62
|
desc 'Run on Android device or emulator'
|
38
63
|
task :android do
|
data/lib/tasks/deploy.rake
CHANGED
@@ -3,6 +3,16 @@
|
|
3
3
|
# Deploy!
|
4
4
|
#
|
5
5
|
#
|
6
|
+
def check_file(file)
|
7
|
+
if File.exists? file
|
8
|
+
file_size = File.size(file).to_f/(1024 * 1024)
|
9
|
+
puts Paint["---\nRelease build ok: #{file} #{file_size} Mb", :green]
|
10
|
+
else
|
11
|
+
puts Paint["Something BAD! No #{file}!", :red]
|
12
|
+
exit 1
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
6
16
|
namespace :release do
|
7
17
|
|
8
18
|
task :check_dirs do
|
@@ -12,7 +22,7 @@ namespace :release do
|
|
12
22
|
end
|
13
23
|
|
14
24
|
desc 'Deploy to Google’s Play Store'
|
15
|
-
task google: [:check_dirs,
|
25
|
+
task google: [:release, :check_dirs, 'google:all', :report]
|
16
26
|
|
17
27
|
namespace :google do
|
18
28
|
task :all => [:clean, :keygen, :archive, :sign, :align, :check, :submit]
|
@@ -25,7 +35,7 @@ namespace :release do
|
|
25
35
|
# desc 'Generates Google Play Store .keystore'
|
26
36
|
task :keygen do
|
27
37
|
next if File.exist?('.keys/google.keystore')
|
28
|
-
puts "\nGenerate key first!\n\n"
|
38
|
+
puts Paint["\nGenerate key first!\n\n", :red]
|
29
39
|
sh "keytool -genkey -v -keystore ./.keys/google.keystore "\
|
30
40
|
"-alias #{app} -keyalg RSA -keysize 2048 -validity 10000"
|
31
41
|
end
|
@@ -40,9 +50,11 @@ namespace :release do
|
|
40
50
|
task :sign do
|
41
51
|
key = ENV['GOOGLE_KEY']
|
42
52
|
key = GOOGLE_KEY if Object.const_defined?(:GOOGLE_KEY)
|
43
|
-
|
44
|
-
|
45
|
-
|
53
|
+
comm = " jarsigner -verbose -sigalg SHA1withRSA "\
|
54
|
+
"-digestalg SHA1 -keystore "\
|
55
|
+
"./.keys/google.keystore build/#{app}-unsigned.apk #{app}"
|
56
|
+
comm = "echo '#{key}' | #{comm}" if key
|
57
|
+
sh comm
|
46
58
|
FileUtils.cp "build/#{app}-unsigned.apk", "build/#{app}-signed.apk"
|
47
59
|
end
|
48
60
|
|
@@ -51,13 +63,7 @@ namespace :release do
|
|
51
63
|
end
|
52
64
|
|
53
65
|
task :check do
|
54
|
-
|
55
|
-
if File.exists? arch
|
56
|
-
puts "Build done! #{arch} #{File.size(arch).to_f/(1024 * 1024)} Mb"
|
57
|
-
else
|
58
|
-
puts "Something BAD! No #{arch}!"
|
59
|
-
exit 1
|
60
|
-
end
|
66
|
+
check_file("build/#{app}.apk")
|
61
67
|
end
|
62
68
|
|
63
69
|
task :submit do
|
@@ -69,10 +75,15 @@ namespace :release do
|
|
69
75
|
# Apple
|
70
76
|
#
|
71
77
|
desc 'Deploy to Apple’s App Store'
|
72
|
-
task apple: [:check_dirs, 'apple:all', :report]
|
78
|
+
task apple: [:release, :check_dirs, 'apple:all', :report]
|
73
79
|
|
74
80
|
namespace :apple do
|
75
|
-
task :all => [:archive, :ipa, :check] #, :upload]
|
81
|
+
task :all => [:clean, :archive, :ipa, :check] #, :upload]
|
82
|
+
|
83
|
+
# desc 'Clean up build folder from apks'
|
84
|
+
task :clean do
|
85
|
+
Dir['build/*.ipa'].each { |f| File.delete(f) }
|
86
|
+
end
|
76
87
|
|
77
88
|
task :archive do
|
78
89
|
sh "cordova build --release ios"
|
@@ -92,13 +103,7 @@ namespace :release do
|
|
92
103
|
end
|
93
104
|
|
94
105
|
task :check do
|
95
|
-
|
96
|
-
if File.exists? arch
|
97
|
-
puts "Build done! #{arch} #{File.size(arch).to_f/(1024 * 1024)} Mb"
|
98
|
-
else
|
99
|
-
puts "Something BAD! No #{arch}!"
|
100
|
-
exit 1
|
101
|
-
end
|
106
|
+
check_file("build/#{app}.ipa")
|
102
107
|
end
|
103
108
|
|
104
109
|
end
|
@@ -0,0 +1,13 @@
|
|
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
|
+
|
11
|
+
watch(/^(app\/|config\/)/) do |m|
|
12
|
+
`rake`
|
13
|
+
end
|
metadata
CHANGED
@@ -1,15 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cordova-rake
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marcos Piccinini
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
12
|
-
dependencies:
|
11
|
+
date: 2015-07-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: paint
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.0.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.0.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: tilt
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.0.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 2.0.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: nokogiri
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.6.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.6.0
|
13
55
|
description: Rake tasks to help cordova development
|
14
56
|
email:
|
15
57
|
- nofxx@github.com
|
@@ -31,6 +73,7 @@ files:
|
|
31
73
|
- lib/tasks/application.rake
|
32
74
|
- lib/tasks/cordova.rake
|
33
75
|
- lib/tasks/deploy.rake
|
76
|
+
- lib/templates/Guardfile
|
34
77
|
homepage: http://github.com/nofxx/cordova-rake
|
35
78
|
licenses:
|
36
79
|
- MIT
|