high_five 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +6 -2
- data/high_five.gemspec +1 -1
- data/lib/high_five/cli.rb +0 -1
- data/lib/high_five/config.rb +9 -2
- data/lib/high_five/deploy_task.rb +20 -5
- data/lib/high_five/version.rb +1 -1
- data/spec/config_spec.rb +7 -0
- data/spec/deploy_spec.rb +38 -11
- data/spec/dummy/javascripts/app.js +7 -1
- metadata +11 -19
- data/spec/dummy/sass/ie.scss +0 -5
- data/spec/dummy/sass/print.scss +0 -3
- data/spec/dummy/stylesheets/ie.css +0 -5
- data/spec/dummy/stylesheets/print.css +0 -3
- /data/spec/dummy/sass/{screen.scss → sass.scss} +0 -0
data/Gemfile.lock
CHANGED
@@ -3,9 +3,9 @@ PATH
|
|
3
3
|
specs:
|
4
4
|
high_five (0.0.7)
|
5
5
|
compass (~> 0.12.2)
|
6
|
-
json
|
7
6
|
sprockets (~> 2.9.0)
|
8
7
|
thor (~> 0.17.0)
|
8
|
+
uglifier (~> 2.1.1)
|
9
9
|
yui-compressor (~> 0.9.6)
|
10
10
|
|
11
11
|
GEM
|
@@ -21,9 +21,10 @@ GEM
|
|
21
21
|
fssm (>= 0.2.7)
|
22
22
|
sass (~> 3.1)
|
23
23
|
diff-lcs (1.2.1)
|
24
|
+
execjs (1.4.0)
|
25
|
+
multi_json (~> 1.0)
|
24
26
|
fssm (0.2.10)
|
25
27
|
hike (1.2.2)
|
26
|
-
json (1.7.7)
|
27
28
|
multi_json (1.7.2)
|
28
29
|
open4 (1.3.0)
|
29
30
|
rack (1.5.2)
|
@@ -43,6 +44,9 @@ GEM
|
|
43
44
|
tilt (~> 1.1, != 1.3.0)
|
44
45
|
thor (0.17.0)
|
45
46
|
tilt (1.3.7)
|
47
|
+
uglifier (2.1.1)
|
48
|
+
execjs (>= 0.3.0)
|
49
|
+
multi_json (~> 1.0, >= 1.0.2)
|
46
50
|
yui-compressor (0.9.6)
|
47
51
|
POpen4 (>= 0.1.4)
|
48
52
|
|
data/high_five.gemspec
CHANGED
@@ -18,8 +18,8 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.add_runtime_dependency "thor", "~>0.17.0"
|
19
19
|
s.add_runtime_dependency "compass", "~>0.12.2"
|
20
20
|
s.add_runtime_dependency "yui-compressor", "~>0.9.6"
|
21
|
+
s.add_runtime_dependency "uglifier", "~>2.1.1"
|
21
22
|
s.add_runtime_dependency "sprockets", "~>2.9.0"
|
22
|
-
s.add_runtime_dependency "json"
|
23
23
|
s.add_development_dependency "rspec", "~>2.13.0"
|
24
24
|
|
25
25
|
s.files = `git ls-files`.split("\n")
|
data/lib/high_five/cli.rb
CHANGED
data/lib/high_five/config.rb
CHANGED
@@ -14,7 +14,8 @@ module HighFive
|
|
14
14
|
:compass_dir,
|
15
15
|
:js_settings, #serialized out to HighFive.Settings in index.html
|
16
16
|
:is_environment, #boolean for if this config is an environment platform
|
17
|
-
:dev_index #copy generated index.html to here on build for use in development
|
17
|
+
:dev_index, #copy generated index.html to here on build for use in development
|
18
|
+
:minify #defaults to true in production mode and false otherwise, overridable
|
18
19
|
|
19
20
|
|
20
21
|
def self.configure(&block)
|
@@ -53,6 +54,7 @@ module HighFive
|
|
53
54
|
new_config.asset_paths += self.asset_paths
|
54
55
|
new_config.compass_dir ||= self.compass_dir
|
55
56
|
new_config.dev_index ||= self.dev_index
|
57
|
+
new_config.minify ||= self.minify
|
56
58
|
new_config.js_settings.merge! self.js_settings do |key, new_setting, old_setting|
|
57
59
|
new_setting || old_setting #don't clobber settings from the parent
|
58
60
|
end
|
@@ -79,6 +81,7 @@ module HighFive
|
|
79
81
|
self.dev_index = config.dev_index
|
80
82
|
self.page_title = config.page_title
|
81
83
|
self.meta = config.meta
|
84
|
+
self.minify = config.minify
|
82
85
|
else
|
83
86
|
@static_assets = []
|
84
87
|
@static_javascripts = []
|
@@ -119,7 +122,11 @@ module HighFive
|
|
119
122
|
|
120
123
|
def environment(name, &block)
|
121
124
|
platform(name, &block)
|
122
|
-
@platform_configs[name.to_s]
|
125
|
+
platform_config = @platform_configs[name.to_s]
|
126
|
+
platform_config.is_environment = true
|
127
|
+
if (name.to_s == 'production')
|
128
|
+
platform_config.minify = :uglifier if platform_config.minify.nil?
|
129
|
+
end
|
123
130
|
end
|
124
131
|
|
125
132
|
def setting(hash)
|
@@ -1,5 +1,7 @@
|
|
1
1
|
require 'sprockets'
|
2
2
|
require 'sass'
|
3
|
+
require 'uglifier'
|
4
|
+
|
3
5
|
module HighFive
|
4
6
|
module DeployTask
|
5
7
|
|
@@ -26,13 +28,12 @@ module HighFive
|
|
26
28
|
raise "Please set config.destination" if @config.destination.nil?
|
27
29
|
self.destination_root = @config.destination
|
28
30
|
FileUtils.rm_rf(self.destination_root)
|
31
|
+
FileUtils.mkdir_p(self.destination_root)
|
29
32
|
|
30
33
|
#todo add to config
|
31
34
|
say "Deploying app: <#{@platform}> <#{options[:environment]}>"
|
32
35
|
say "\t#{self.destination_root}"
|
33
36
|
say " -Weinre url: #{@weinre_url}" if @weinre_url
|
34
|
-
|
35
|
-
|
36
37
|
|
37
38
|
if @config.compass_dir
|
38
39
|
compass_dir = File.join(base_config.root, @config.compass_dir)
|
@@ -65,8 +66,22 @@ module HighFive
|
|
65
66
|
if (@environment == "production")
|
66
67
|
appjs = File.join(self.destination_root, "app.js")
|
67
68
|
@javascripts = ["app.js"]
|
68
|
-
|
69
|
-
|
69
|
+
|
70
|
+
output_js = nil
|
71
|
+
if @config.minify == :uglifier
|
72
|
+
say " uglify #{appjs}", :green
|
73
|
+
output_js = Uglifier.compile(bundle.to_s)
|
74
|
+
elsif @config.minify == :yui
|
75
|
+
say " minify #{appjs}", :green
|
76
|
+
output_js = YUI::JavaScriptCompressor.new.compress(bundle.to_s)
|
77
|
+
else
|
78
|
+
say " create #{appjs}", :green
|
79
|
+
output_js = bundle.to_s
|
80
|
+
end
|
81
|
+
File.open(appjs, "w") do |file|
|
82
|
+
file.write output_js
|
83
|
+
end
|
84
|
+
output_js = nil
|
70
85
|
else
|
71
86
|
# Add each of the javascript files to the generated folder
|
72
87
|
@javascripts = []
|
@@ -121,7 +136,7 @@ module HighFive
|
|
121
136
|
# Build index.html
|
122
137
|
say "Generating index.html"
|
123
138
|
template File.join(@config_root, "index.html.erb"), File.join(self.destination_root, "index.html")
|
124
|
-
if (@config.dev_index)
|
139
|
+
if (@environment == 'development' && !@config.dev_index.nil?)
|
125
140
|
say "Cloning to #{@config.dev_index}"
|
126
141
|
FileUtils.cp(File.join(self.destination_root, "index.html"), File.join(@config.root, @config.dev_index))
|
127
142
|
end
|
data/lib/high_five/version.rb
CHANGED
data/spec/config_spec.rb
CHANGED
@@ -76,6 +76,13 @@ describe HighFive::Config do
|
|
76
76
|
config.js_settings.should be_has_key(:base_url)
|
77
77
|
config.js_settings.should be_has_key(:android_flag)
|
78
78
|
end
|
79
|
+
|
80
|
+
it "sets minify to true by default for production environments" do
|
81
|
+
config = @config.build_platform_config('android').build_platform_config('production')
|
82
|
+
config.minify.should eq :uglifier
|
83
|
+
config = @config.build_platform_config(:production).build_platform_config(:android)
|
84
|
+
config.minify.should eq :uglifier
|
85
|
+
end
|
79
86
|
end
|
80
87
|
|
81
88
|
context "easy settings" do
|
data/spec/deploy_spec.rb
CHANGED
@@ -8,8 +8,8 @@ describe HighFive::DeployTask do
|
|
8
8
|
FileUtils.cp_r(Dir[File.join(File.dirname(__FILE__), "dummy", "*")], @project_root)
|
9
9
|
end
|
10
10
|
|
11
|
-
def cli
|
12
|
-
cli = HighFive::Cli.new
|
11
|
+
def cli(options={environment: 'development'})
|
12
|
+
cli = HighFive::Cli.new([], options)
|
13
13
|
cli.instance_variable_set("@base_config", HighFive::Config.instance)
|
14
14
|
cli
|
15
15
|
end
|
@@ -30,9 +30,8 @@ describe HighFive::DeployTask do
|
|
30
30
|
config.platform :android do |android|
|
31
31
|
|
32
32
|
end
|
33
|
-
|
34
|
-
cli.deploy("android")
|
35
33
|
end
|
34
|
+
cli.deploy("android")
|
36
35
|
end
|
37
36
|
|
38
37
|
after(:all) { destroy_dummy_app! }
|
@@ -59,19 +58,18 @@ describe HighFive::DeployTask do
|
|
59
58
|
config.platform :android do |android|
|
60
59
|
|
61
60
|
end
|
62
|
-
|
63
|
-
cli.deploy("android")
|
64
61
|
end
|
62
|
+
cli.deploy("android")
|
65
63
|
end
|
66
64
|
|
67
65
|
after(:all) { destroy_dummy_app! }
|
68
66
|
|
69
67
|
it "should invoke compass to compile stylesheets" do
|
70
|
-
expect(File.join(@project_root, "stylesheets", "
|
68
|
+
expect(File.join(@project_root, "stylesheets", "sass.css")).to exist
|
69
|
+
expect(File.join(@project_root, "www", "stylesheets", "sass.css")).to exist
|
71
70
|
end
|
72
71
|
|
73
72
|
it "should copy the css sheets to the deploy directory" do
|
74
|
-
pending "better compass integration"
|
75
73
|
expect(File.join(@project_root, "www", "stylesheets", "screen.css")).to exist
|
76
74
|
end
|
77
75
|
end
|
@@ -88,17 +86,46 @@ describe HighFive::DeployTask do
|
|
88
86
|
config.destination "www-web"
|
89
87
|
config.dev_index "index-debug.html"
|
90
88
|
end
|
91
|
-
|
92
|
-
cli.deploy("web")
|
93
89
|
end
|
90
|
+
cli.deploy("web")
|
94
91
|
end
|
95
92
|
|
93
|
+
after(:all) { destroy_dummy_app! }
|
94
|
+
|
96
95
|
it "should clone index.html to index-debug.html when directed" do
|
97
96
|
index = File.read(File.join(@project_root, "www-web", "index.html"))
|
98
|
-
|
99
97
|
index_debug = File.read(File.join(@project_root, "index-debug.html"))
|
100
98
|
index.should eq index_debug
|
101
99
|
end
|
102
100
|
end
|
103
101
|
|
102
|
+
context "Production environment" do
|
103
|
+
before :all do
|
104
|
+
create_dummy_app!
|
105
|
+
HighFive::Config.configure do |config|
|
106
|
+
config.root = @project_root
|
107
|
+
config.destination = "www"
|
108
|
+
config.compass_dir = "."
|
109
|
+
config.assets "stylesheets"
|
110
|
+
config.platform :web do |web|
|
111
|
+
config.dev_index "index-debug.html"
|
112
|
+
end
|
113
|
+
config.environment :production do |prod|
|
114
|
+
|
115
|
+
end
|
116
|
+
|
117
|
+
end
|
118
|
+
cli(environment: 'production').deploy("web")
|
119
|
+
end
|
120
|
+
|
121
|
+
after(:all) { destroy_dummy_app! }
|
122
|
+
|
123
|
+
it "should produce just one javascript file" do
|
124
|
+
expect(File.join(@project_root, "www", "app.js")).to exist
|
125
|
+
end
|
126
|
+
it "should not clone index.html to index-debug.html" do
|
127
|
+
File.exist?(File.join(@project_root, "index-debug.html")).should be_false
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
104
131
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: high_five
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -60,13 +60,13 @@ dependencies:
|
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 0.9.6
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
|
-
name:
|
63
|
+
name: uglifier
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
65
65
|
none: false
|
66
66
|
requirements:
|
67
67
|
- - ~>
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: 2.
|
69
|
+
version: 2.1.1
|
70
70
|
type: :runtime
|
71
71
|
prerelease: false
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -74,23 +74,23 @@ dependencies:
|
|
74
74
|
requirements:
|
75
75
|
- - ~>
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version: 2.
|
77
|
+
version: 2.1.1
|
78
78
|
- !ruby/object:Gem::Dependency
|
79
|
-
name:
|
79
|
+
name: sprockets
|
80
80
|
requirement: !ruby/object:Gem::Requirement
|
81
81
|
none: false
|
82
82
|
requirements:
|
83
|
-
- -
|
83
|
+
- - ~>
|
84
84
|
- !ruby/object:Gem::Version
|
85
|
-
version:
|
85
|
+
version: 2.9.0
|
86
86
|
type: :runtime
|
87
87
|
prerelease: false
|
88
88
|
version_requirements: !ruby/object:Gem::Requirement
|
89
89
|
none: false
|
90
90
|
requirements:
|
91
|
-
- -
|
91
|
+
- - ~>
|
92
92
|
- !ruby/object:Gem::Version
|
93
|
-
version:
|
93
|
+
version: 2.9.0
|
94
94
|
- !ruby/object:Gem::Dependency
|
95
95
|
name: rspec
|
96
96
|
requirement: !ruby/object:Gem::Requirement
|
@@ -148,11 +148,7 @@ files:
|
|
148
148
|
- spec/dummy/config/high_five/index.html.erb
|
149
149
|
- spec/dummy/javascripts/app.js
|
150
150
|
- spec/dummy/javascripts/app/component.js
|
151
|
-
- spec/dummy/sass/
|
152
|
-
- spec/dummy/sass/print.scss
|
153
|
-
- spec/dummy/sass/screen.scss
|
154
|
-
- spec/dummy/stylesheets/ie.css
|
155
|
-
- spec/dummy/stylesheets/print.css
|
151
|
+
- spec/dummy/sass/sass.scss
|
156
152
|
- spec/dummy/stylesheets/screen.css
|
157
153
|
- spec/init_spec.rb
|
158
154
|
- spec/spec_helper.rb
|
@@ -197,11 +193,7 @@ test_files:
|
|
197
193
|
- spec/dummy/config/high_five/index.html.erb
|
198
194
|
- spec/dummy/javascripts/app.js
|
199
195
|
- spec/dummy/javascripts/app/component.js
|
200
|
-
- spec/dummy/sass/
|
201
|
-
- spec/dummy/sass/print.scss
|
202
|
-
- spec/dummy/sass/screen.scss
|
203
|
-
- spec/dummy/stylesheets/ie.css
|
204
|
-
- spec/dummy/stylesheets/print.css
|
196
|
+
- spec/dummy/sass/sass.scss
|
205
197
|
- spec/dummy/stylesheets/screen.css
|
206
198
|
- spec/init_spec.rb
|
207
199
|
- spec/spec_helper.rb
|
data/spec/dummy/sass/ie.scss
DELETED
@@ -1,5 +0,0 @@
|
|
1
|
-
/* Welcome to Compass. Use this file to write IE specific override styles.
|
2
|
-
* Import this file using the following HTML or equivalent:
|
3
|
-
* <!--[if IE]>
|
4
|
-
* <link href="/stylesheets/ie.css" media="screen, projection" rel="stylesheet" type="text/css" />
|
5
|
-
* <![endif]--> */
|
data/spec/dummy/sass/print.scss
DELETED
@@ -1,5 +0,0 @@
|
|
1
|
-
/* Welcome to Compass. Use this file to write IE specific override styles.
|
2
|
-
* Import this file using the following HTML or equivalent:
|
3
|
-
* <!--[if IE]>
|
4
|
-
* <link href="/stylesheets/ie.css" media="screen, projection" rel="stylesheet" type="text/css" />
|
5
|
-
* <![endif]--> */
|
File without changes
|