web_blocks 2.0.1.dev → 2.0.2.dev
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 +8 -8
- data/README.md +9 -1
- data/demo/Blockfile.rb +19 -13
- data/lib/web_blocks/manager/builder/base.rb +1 -1
- data/lib/web_blocks/manager/builder/js.rb +14 -10
- data/lib/web_blocks/manager/builder/scss.rb +13 -10
- data/lib/web_blocks/strategy/optimize/base.rb +33 -0
- data/lib/web_blocks/strategy/optimize/css.rb +37 -0
- data/lib/web_blocks/strategy/optimize/js.rb +37 -0
- data/lib/web_blocks/thor/base/initialize.rb +1 -3
- data/lib/web_blocks/thor/base/prepare_blocks.rb +12 -0
- data/lib/web_blocks/thor/watch/all.rb +1 -0
- data/lib/web_blocks/version.rb +1 -1
- data/web_blocks.gemspec +1 -0
- metadata +19 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NjlhYjg1NWE1YWEzNDNjMmU2MGZmYTczZWQ3ODE0ZmQwZjYyYzViYg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NzcyNTM0NzQ0NTAxMTY5OWM1ZjE3NTVmOTBhM2QxZTc4NmQ0ZjZjZg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MThlZWJiMWJmZDdkYzFjZWQzM2Y4OWVlMGVlMjViNGI2MDk5YWNkNTFkNzUy
|
10
|
+
ZGY1ZmMxMzMzOWVkMzkxZTIwY2VmZGUzZTA4ZTIzN2JlOThhZjNhYWFjZmU1
|
11
|
+
OTFlYTZmYTBhOGE5NTMzMzdjZWRlMzczMGQ0M2U4YzgxMDRhZTI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZTgzZTA1YWFiODMzNmUxZDQwYzVlZDM2NGI3NTllNjI1ZmU3ZGQ0NDgwOTA2
|
14
|
+
NWUzOWY3NTNjYmJmMTgyMWM1ZmE2MzYwYWNjNGMxZGQ0OTA1NTI3YjVkZDc3
|
15
|
+
MTE5YTljNGViMmUwYWVmNzA2YjRlODY3ZDg4M2MwZDBiYzY1Yjc=
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@ WebBlocks is package, configuration and dependency manager for web assets (SCSS,
|
|
4
4
|
|
5
5
|
## Status
|
6
6
|
|
7
|
-
[](https://codeclimate.com/github/WebBlocks/WebBlocks) [](https://travis-ci.org/WebBlocks/WebBlocks) [](https://coveralls.io/r/WebBlocks/WebBlocks?branch=master)
|
7
|
+
[](http://badge.fury.io/rb/web_blocks) [](https://gemnasium.com/WebBlocks/WebBlocks) [](https://codeclimate.com/github/WebBlocks/WebBlocks) [](https://travis-ci.org/WebBlocks/WebBlocks) [](https://coveralls.io/r/WebBlocks/WebBlocks?branch=master)
|
8
8
|
|
9
9
|
This repository contains the code base for WebBlocks 2.0, which is currently **under development** and **not intended for use at this time**. For those interested in using WebBlocks today, please see WebBlocks 1 under the [ucla/WebBlocks](https://github.com/ucla/WebBlocks) repository.
|
10
10
|
|
@@ -24,6 +24,14 @@ WebBlocks is built on top of a number of outstanding open source platforms and p
|
|
24
24
|
|
25
25
|
**NOTE** Assuming installation in one of the ways described as follows, this documentation uses `blocks` as a shell command; in cases where it's installed locally by bundle rather than globally, it may be necessary to use `bundle exec blocks` instead.
|
26
26
|
|
27
|
+
### Pre-requisites
|
28
|
+
|
29
|
+
The following are required:
|
30
|
+
|
31
|
+
* Ruby, RubyGems and Budler
|
32
|
+
* Node.js and NPM
|
33
|
+
* Java 1.4+ (only for compression)
|
34
|
+
|
27
35
|
### Download
|
28
36
|
|
29
37
|
#### From Source
|
data/demo/Blockfile.rb
CHANGED
@@ -9,22 +9,13 @@
|
|
9
9
|
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
10
10
|
|
11
11
|
#
|
12
|
-
#
|
13
|
-
#
|
14
|
-
# Ideally, frameworks and tools should include Blockfile.rb; however, this will not always be the case. In some cases,
|
15
|
-
# frameworks may not explicitly support WebBlocks (even though, through this syntax, WebBlocks can support them), and,
|
16
|
-
# in others, it may be advantageous simply to download a build product.
|
12
|
+
# BUILD SETTINGS
|
17
13
|
#
|
18
14
|
|
19
|
-
#
|
20
|
-
|
21
|
-
|
22
|
-
end
|
15
|
+
# Set where to build explicitly:
|
16
|
+
# set :build_path, 'build'
|
17
|
+
|
23
18
|
|
24
|
-
# Adding a dependency on the jquery block for efx to include jquery if including efx
|
25
|
-
block 'efx' do
|
26
|
-
dependency framework.route 'jquery'
|
27
|
-
end
|
28
19
|
|
29
20
|
#
|
30
21
|
# BLOCK INCLUSIONS
|
@@ -45,6 +36,21 @@ include 'efx', 'driver', 'toggle'
|
|
45
36
|
|
46
37
|
|
47
38
|
|
39
|
+
|
40
|
+
#
|
41
|
+
# CUSTOM BLOCK DEFINITIONS
|
42
|
+
#
|
43
|
+
# In some cases, the existing definitions do not behave as desired, so reopen and modify accordingly.
|
44
|
+
#
|
45
|
+
|
46
|
+
# The efx block does not enforce a dependency on jQuery so add that here.
|
47
|
+
block 'efx' do
|
48
|
+
dependency framework.route 'jquery'
|
49
|
+
end
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
|
48
54
|
#
|
49
55
|
# CUSTOM SOURCES
|
50
56
|
#
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'fileutils'
|
2
2
|
require 'web_blocks/manager/builder/base'
|
3
3
|
require 'web_blocks/strategy/link/js'
|
4
|
+
require 'web_blocks/strategy/optimize/js'
|
4
5
|
|
5
6
|
module WebBlocks
|
6
7
|
module Manager
|
@@ -8,12 +9,14 @@ module WebBlocks
|
|
8
9
|
class Js < Base
|
9
10
|
|
10
11
|
attr_reader :link_strategy
|
12
|
+
attr_reader :optimize_strategy
|
11
13
|
|
12
14
|
def initialize task
|
13
15
|
|
14
16
|
super task
|
15
17
|
|
16
18
|
@link_strategy = WebBlocks::Strategy::Link::Js.new(task)
|
19
|
+
@optimize_strategy = WebBlocks::Strategy::Optimize::Js.new(task)
|
17
20
|
|
18
21
|
end
|
19
22
|
|
@@ -22,6 +25,7 @@ module WebBlocks
|
|
22
25
|
super do
|
23
26
|
|
24
27
|
link_strategy.execute!
|
28
|
+
optimize_strategy.execute!
|
25
29
|
|
26
30
|
end
|
27
31
|
|
@@ -31,19 +35,19 @@ module WebBlocks
|
|
31
35
|
|
32
36
|
super do |build_path|
|
33
37
|
|
34
|
-
|
35
|
-
|
36
|
-
js_build_path = build_path + task.root.get(:js_build_dir)
|
37
|
-
FileUtils.mkdir_p js_build_path
|
38
|
-
|
39
|
-
source_path = link_strategy.product_path
|
40
|
-
product_path = js_build_path + source_path.basename
|
41
|
-
FileUtils.copy source_path, product_path
|
42
|
-
|
43
|
-
"Saved JS build #{product_path}"
|
38
|
+
js_build_path = build_path
|
39
|
+
FileUtils.mkdir_p js_build_path
|
44
40
|
|
41
|
+
[link_strategy, optimize_strategy].each do |strategy|
|
42
|
+
log.info do
|
43
|
+
source_path = strategy.product_path
|
44
|
+
product_path = js_build_path + source_path.basename
|
45
|
+
FileUtils.copy source_path, product_path
|
46
|
+
"Saved JS build #{product_path}"
|
47
|
+
end
|
45
48
|
end
|
46
49
|
|
50
|
+
|
47
51
|
end
|
48
52
|
|
49
53
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'web_blocks/manager/builder/base'
|
2
2
|
require 'web_blocks/strategy/link/scss'
|
3
3
|
require 'web_blocks/strategy/compile/scss'
|
4
|
+
require 'web_blocks/strategy/optimize/css'
|
4
5
|
|
5
6
|
module WebBlocks
|
6
7
|
module Manager
|
@@ -9,6 +10,7 @@ module WebBlocks
|
|
9
10
|
|
10
11
|
attr_reader :link_strategy
|
11
12
|
attr_reader :compile_strategy
|
13
|
+
attr_reader :optimize_strategy
|
12
14
|
|
13
15
|
def initialize task
|
14
16
|
|
@@ -16,6 +18,7 @@ module WebBlocks
|
|
16
18
|
|
17
19
|
@link_strategy = WebBlocks::Strategy::Link::Scss.new(task)
|
18
20
|
@compile_strategy = WebBlocks::Strategy::Compile::Scss.new(task)
|
21
|
+
@optimize_strategy = WebBlocks::Strategy::Optimize::Css.new(task)
|
19
22
|
|
20
23
|
end
|
21
24
|
|
@@ -25,6 +28,7 @@ module WebBlocks
|
|
25
28
|
|
26
29
|
link_strategy.execute!
|
27
30
|
compile_strategy.execute!
|
31
|
+
optimize_strategy.execute!
|
28
32
|
|
29
33
|
end
|
30
34
|
|
@@ -34,17 +38,16 @@ module WebBlocks
|
|
34
38
|
|
35
39
|
super do |build_path|
|
36
40
|
|
37
|
-
|
38
|
-
|
39
|
-
css_build_path = build_path + task.root.get(:css_build_dir)
|
40
|
-
FileUtils.mkdir_p css_build_path
|
41
|
-
|
42
|
-
source_path = compile_strategy.product_path
|
43
|
-
product_path = css_build_path + source_path.basename
|
44
|
-
FileUtils.copy source_path, product_path
|
45
|
-
|
46
|
-
"Saved CSS build #{product_path}"
|
41
|
+
css_build_path = build_path
|
42
|
+
FileUtils.mkdir_p css_build_path
|
47
43
|
|
44
|
+
[compile_strategy, optimize_strategy].each do |strategy|
|
45
|
+
log.info do
|
46
|
+
source_path = strategy.product_path
|
47
|
+
product_path = css_build_path + source_path.basename
|
48
|
+
FileUtils.copy source_path, product_path
|
49
|
+
"Saved CSS build #{product_path}"
|
50
|
+
end
|
48
51
|
end
|
49
52
|
|
50
53
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module WebBlocks
|
2
|
+
module Strategy
|
3
|
+
module Optimize
|
4
|
+
class Base
|
5
|
+
|
6
|
+
attr_reader :task
|
7
|
+
attr_reader :log
|
8
|
+
attr_reader :product_path
|
9
|
+
attr_reader :source_path
|
10
|
+
|
11
|
+
def initialize task
|
12
|
+
|
13
|
+
@task = task
|
14
|
+
@log = task.log.scope 'Optimize'
|
15
|
+
@product_path = false
|
16
|
+
@source_path = false
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
def execute!
|
21
|
+
|
22
|
+
log.info { "Starting" }
|
23
|
+
|
24
|
+
yield if block_given?
|
25
|
+
|
26
|
+
log.info { "Finished" }
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'web_blocks/strategy/optimize/base'
|
2
|
+
require 'yui/compressor'
|
3
|
+
|
4
|
+
module WebBlocks
|
5
|
+
module Strategy
|
6
|
+
module Optimize
|
7
|
+
class Css < Base
|
8
|
+
|
9
|
+
def initialize task
|
10
|
+
|
11
|
+
super task
|
12
|
+
|
13
|
+
@log = task.log.scope 'CSS - Optimize'
|
14
|
+
@product_path = task.base_path + '.blocks/workspace/css/blocks.min.css'
|
15
|
+
@source_path = task.base_path + '.blocks/workspace/css/blocks.css'
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
def execute!
|
20
|
+
|
21
|
+
super do
|
22
|
+
|
23
|
+
File.open task.base_path + product_path, 'w' do |product|
|
24
|
+
File.open task.base_path + source_path, 'r' do |source|
|
25
|
+
compressor = YUI::CssCompressor.new
|
26
|
+
product.write compressor.compress source
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'web_blocks/strategy/optimize/base'
|
2
|
+
require 'yui/compressor'
|
3
|
+
|
4
|
+
module WebBlocks
|
5
|
+
module Strategy
|
6
|
+
module Optimize
|
7
|
+
class Js < Base
|
8
|
+
|
9
|
+
def initialize task
|
10
|
+
|
11
|
+
super task
|
12
|
+
|
13
|
+
@log = task.log.scope 'JS - Optimize'
|
14
|
+
@product_path = task.base_path + '.blocks/workspace/js/blocks.min.js'
|
15
|
+
@source_path = task.base_path + '.blocks/workspace/js/blocks.js'
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
def execute!
|
20
|
+
|
21
|
+
super do
|
22
|
+
|
23
|
+
File.open task.base_path + product_path, 'w' do |product|
|
24
|
+
File.open task.base_path + source_path, 'r' do |source|
|
25
|
+
compressor = YUI::JavaScriptCompressor.new
|
26
|
+
product.write compressor.compress source
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -22,6 +22,11 @@ module WebBlocks
|
|
22
22
|
:default => nil,
|
23
23
|
:desc => 'Paths to explicitly include'
|
24
24
|
|
25
|
+
class_option :build_path,
|
26
|
+
:type => :string,
|
27
|
+
:default => nil,
|
28
|
+
:desc => 'Path where WebBlocks should build products'
|
29
|
+
|
25
30
|
no_commands do
|
26
31
|
|
27
32
|
def prepare_blocks!
|
@@ -51,6 +56,7 @@ module WebBlocks
|
|
51
56
|
load_blockfile! log
|
52
57
|
include_own_routes! log
|
53
58
|
include_routes_from_command_line! log if self.options.include
|
59
|
+
set_build_path_from_command_line!
|
54
60
|
|
55
61
|
end
|
56
62
|
|
@@ -150,6 +156,12 @@ module WebBlocks
|
|
150
156
|
|
151
157
|
end
|
152
158
|
|
159
|
+
def set_build_path_from_command_line!
|
160
|
+
|
161
|
+
root.set :build_path, self.options.build_path if self.options.build_path
|
162
|
+
|
163
|
+
end
|
164
|
+
|
153
165
|
end
|
154
166
|
end
|
155
167
|
end
|
data/lib/web_blocks/version.rb
CHANGED
data/web_blocks.gemspec
CHANGED
@@ -27,6 +27,7 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.add_dependency 'sass-css-importer'
|
28
28
|
spec.add_dependency 'fork'
|
29
29
|
spec.add_dependency 'fssm'
|
30
|
+
spec.add_dependency 'yui-compressor'
|
30
31
|
|
31
32
|
spec.add_development_dependency 'bundler'
|
32
33
|
spec.add_development_dependency 'rake'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: web_blocks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2.dev
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Bollens
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -122,6 +122,20 @@ dependencies:
|
|
122
122
|
- - ! '>='
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: yui-compressor
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ! '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ! '>='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
125
139
|
- !ruby/object:Gem::Dependency
|
126
140
|
name: bundler
|
127
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -202,6 +216,9 @@ files:
|
|
202
216
|
- lib/web_blocks/strategy/link/base.rb
|
203
217
|
- lib/web_blocks/strategy/link/js.rb
|
204
218
|
- lib/web_blocks/strategy/link/scss.rb
|
219
|
+
- lib/web_blocks/strategy/optimize/base.rb
|
220
|
+
- lib/web_blocks/strategy/optimize/css.rb
|
221
|
+
- lib/web_blocks/strategy/optimize/js.rb
|
205
222
|
- lib/web_blocks/structure.rb
|
206
223
|
- lib/web_blocks/structure/attribute/dependency.rb
|
207
224
|
- lib/web_blocks/structure/attribute/loose_dependency.rb
|