web_blocks 2.0.0.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 +15 -0
- data/.coveralls.yml +1 -0
- data/.gitignore +23 -0
- data/.travis.yml +8 -0
- data/CHANGELOG.md +1 -0
- data/CONTRIBUTING.md +1 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +27 -0
- data/README.md +641 -0
- data/Rakefile +13 -0
- data/bin/blocks +9 -0
- data/demo/.gitignore +4 -0
- data/demo/Blockfile.rb +67 -0
- data/demo/bower.json +8 -0
- data/demo/package.json +5 -0
- data/demo/src/config/WebBlocks-breakpoints.scss +9 -0
- data/lib/web_blocks/framework.rb +20 -0
- data/lib/web_blocks/manager/bower.rb +106 -0
- data/lib/web_blocks/manager/builder/base.rb +31 -0
- data/lib/web_blocks/manager/builder/js.rb +54 -0
- data/lib/web_blocks/manager/builder/scss.rb +57 -0
- data/lib/web_blocks/manager/parallel_builder.rb +52 -0
- data/lib/web_blocks/product/concat_file/js.rb +15 -0
- data/lib/web_blocks/product/concat_file/raw.rb +33 -0
- data/lib/web_blocks/product/concat_file/scss.rb +21 -0
- data/lib/web_blocks/strategy/compile/scss.rb +90 -0
- data/lib/web_blocks/strategy/link/base.rb +51 -0
- data/lib/web_blocks/strategy/link/js.rb +30 -0
- data/lib/web_blocks/strategy/link/scss.rb +30 -0
- data/lib/web_blocks/structure/attribute/dependency.rb +25 -0
- data/lib/web_blocks/structure/attribute/loose_dependency.rb +25 -0
- data/lib/web_blocks/structure/attribute/reverse_dependency.rb +16 -0
- data/lib/web_blocks/structure/attribute/reverse_loose_dependency.rb +16 -0
- data/lib/web_blocks/structure/block.rb +95 -0
- data/lib/web_blocks/structure/font_file.rb +9 -0
- data/lib/web_blocks/structure/framework.rb +79 -0
- data/lib/web_blocks/structure/img_file.rb +9 -0
- data/lib/web_blocks/structure/js_file.rb +9 -0
- data/lib/web_blocks/structure/raw_file.rb +30 -0
- data/lib/web_blocks/structure/scss_file.rb +9 -0
- data/lib/web_blocks/structure/tree/leaf_node.rb +44 -0
- data/lib/web_blocks/structure/tree/node.rb +14 -0
- data/lib/web_blocks/structure.rb +7 -0
- data/lib/web_blocks/support/attributes/class/container.rb +24 -0
- data/lib/web_blocks/support/attributes/container.rb +41 -0
- data/lib/web_blocks/support/parallel_jobs.rb +26 -0
- data/lib/web_blocks/support/scoped_logger.rb +49 -0
- data/lib/web_blocks/support/tree/child.rb +23 -0
- data/lib/web_blocks/support/tree/node.rb +14 -0
- data/lib/web_blocks/support/tree/parent.rb +35 -0
- data/lib/web_blocks/support/tsort/hash.rb +29 -0
- data/lib/web_blocks/thor/base/class/type_get_class_from_string.rb +36 -0
- data/lib/web_blocks/thor/base/class/types.rb +21 -0
- data/lib/web_blocks/thor/base/initialize.rb +145 -0
- data/lib/web_blocks/thor/base/prepare_blocks.rb +155 -0
- data/lib/web_blocks/thor/base.rb +12 -0
- data/lib/web_blocks/thor/build/all.rb +30 -0
- data/lib/web_blocks/thor/build.rb +13 -0
- data/lib/web_blocks/thor/inspect/blocks/attribute_printer.rb +48 -0
- data/lib/web_blocks/thor/inspect/blocks/block_printer.rb +43 -0
- data/lib/web_blocks/thor/inspect/blocks/printer.rb +24 -0
- data/lib/web_blocks/thor/inspect/blocks.rb +27 -0
- data/lib/web_blocks/thor/inspect/bower_registry.rb +24 -0
- data/lib/web_blocks/thor/inspect/dependency_list.rb +30 -0
- data/lib/web_blocks/thor/inspect/dependency_order.rb +26 -0
- data/lib/web_blocks/thor/inspect.rb +11 -0
- data/lib/web_blocks/thor/partial/compile/scss.rb +24 -0
- data/lib/web_blocks/thor/partial/compile.rb +13 -0
- data/lib/web_blocks/thor/partial/link/js.rb +23 -0
- data/lib/web_blocks/thor/partial/link/scss.rb +23 -0
- data/lib/web_blocks/thor/partial/link.rb +13 -0
- data/lib/web_blocks/thor/partial/runner.rb +14 -0
- data/lib/web_blocks/thor/runner.rb +16 -0
- data/lib/web_blocks/thor/watch/all.rb +67 -0
- data/lib/web_blocks/thor/watch.rb +13 -0
- data/lib/web_blocks/version.rb +3 -0
- data/lib/web_blocks.rb +13 -0
- data/test/init.rb +7 -0
- data/test/web_blocks/framework.rb +40 -0
- data/test/web_blocks/structure.rb +42 -0
- data/test/web_blocks/support/attribute/class/container.rb +29 -0
- data/test/web_blocks/support/attribute/container.rb +71 -0
- data/test/web_blocks/support/tree/child.rb +60 -0
- data/test/web_blocks/support/tree/node.rb +18 -0
- data/test/web_blocks/support/tree/parent.rb +81 -0
- data/test/web_blocks/version.rb +10 -0
- data/web_blocks.gemspec +35 -0
- metadata +297 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'web_blocks/thor/base'
|
2
|
+
|
3
|
+
module WebBlocks
|
4
|
+
module Thor
|
5
|
+
class Base
|
6
|
+
class << self
|
7
|
+
|
8
|
+
def types
|
9
|
+
@@types ||= {
|
10
|
+
'all' => 'All files regardless of type',
|
11
|
+
'scss' => 'SCSS files',
|
12
|
+
'js' => 'Javascript files',
|
13
|
+
'img' => 'Image files such as JPG, GIF, PNG and SVG',
|
14
|
+
'font' => 'Font files such as WOFF, TTF, EOT and SVG'
|
15
|
+
}
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,145 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
require 'logger'
|
3
|
+
require 'web_blocks/support/scoped_logger'
|
4
|
+
require 'web_blocks/manager/bower'
|
5
|
+
require 'web_blocks/thor/base'
|
6
|
+
|
7
|
+
module WebBlocks
|
8
|
+
module Thor
|
9
|
+
class Base
|
10
|
+
|
11
|
+
attr_reader :base_path
|
12
|
+
attr_reader :bowerfile_path
|
13
|
+
attr_reader :blockfile_path
|
14
|
+
attr_reader :bower_manager
|
15
|
+
attr_reader :log
|
16
|
+
attr_reader :root
|
17
|
+
|
18
|
+
class_option :base_path,
|
19
|
+
:type => :string,
|
20
|
+
:default => nil,
|
21
|
+
:desc => 'Path to workspace'
|
22
|
+
|
23
|
+
class_option :blockfile_path,
|
24
|
+
:type => :string,
|
25
|
+
:default => nil,
|
26
|
+
:desc => 'Path to workspace'
|
27
|
+
|
28
|
+
def initialize args = [], options = {}, config = {}
|
29
|
+
|
30
|
+
super args, options, config
|
31
|
+
|
32
|
+
initialize_version!
|
33
|
+
initialize_log!
|
34
|
+
initialize_paths!
|
35
|
+
initialize_bower_manager!
|
36
|
+
initialize_root!
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def initialize_version!
|
43
|
+
|
44
|
+
if WebBlocks::VERSION.match /dev$/
|
45
|
+
puts "
|
46
|
+
= = = = = = = = = = = = W A R N I N G = = = = = = = = = = = = = = =
|
47
|
+
|
48
|
+
You are using a pre-release DEVELOPMENT SNAPSHOT of WebBlocks.
|
49
|
+
This software should not be considered stable, and users are asked
|
50
|
+
to be mindful of the fact that there may be significant changes to
|
51
|
+
the APIs ad internals before release.
|
52
|
+
|
53
|
+
= = = = = = = = = = = = W A R N I N G = = = = = = = = = = = = = = =\n\n"
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
def initialize_log!
|
59
|
+
base = ::Logger.new STDOUT
|
60
|
+
base.level = ::Logger::DEBUG
|
61
|
+
base.datetime_format = '%Y-%m-%d %H:%M:%S'
|
62
|
+
@log = ::WebBlocks::Support::ScopedLogger.new_without_scope base
|
63
|
+
end
|
64
|
+
|
65
|
+
def initialize_paths!
|
66
|
+
|
67
|
+
initialize_base_path_from_resolved! unless initialize_base_path_from_options!
|
68
|
+
initialize_bowerfile_path!
|
69
|
+
initialize_blockfile_path!
|
70
|
+
|
71
|
+
end
|
72
|
+
|
73
|
+
def initialize_base_path_from_options!
|
74
|
+
|
75
|
+
if self.options.base_path
|
76
|
+
@base_path = Pathname.new(Dir.pwd) + self.options.base_path
|
77
|
+
true
|
78
|
+
else
|
79
|
+
false
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
83
|
+
|
84
|
+
def initialize_base_path_from_resolved! path = nil
|
85
|
+
|
86
|
+
path = Pathname.new(Dir.pwd) unless path
|
87
|
+
|
88
|
+
if File.exists? path + 'bower.json'
|
89
|
+
@base_path = path
|
90
|
+
return true
|
91
|
+
end
|
92
|
+
|
93
|
+
if path.to_s == '/'
|
94
|
+
log.fatal('INIT') { 'Workspace could not be resolved' }
|
95
|
+
exit 1
|
96
|
+
end
|
97
|
+
|
98
|
+
initialize_base_path_from_resolved! path.parent
|
99
|
+
|
100
|
+
end
|
101
|
+
|
102
|
+
def initialize_bowerfile_path!
|
103
|
+
|
104
|
+
@bowerfile_path = base_path + 'bower.json'
|
105
|
+
|
106
|
+
unless File.exists? @bowerfile_path
|
107
|
+
log.fatal('INIT') { "bower.json does not exist at #{bowerfile_path}" }
|
108
|
+
exit 1
|
109
|
+
end
|
110
|
+
|
111
|
+
end
|
112
|
+
|
113
|
+
def initialize_blockfile_path!
|
114
|
+
|
115
|
+
if self.options.blockfile_path
|
116
|
+
@blockfile_path = Pathname.new(Dir.pwd) + self.options.blockfile_path
|
117
|
+
else
|
118
|
+
@blockfile_path = base_path + 'Blockfile.rb'
|
119
|
+
end
|
120
|
+
|
121
|
+
unless File.exists? @blockfile_path
|
122
|
+
@blockfile_path = nil
|
123
|
+
end
|
124
|
+
|
125
|
+
end
|
126
|
+
|
127
|
+
def initialize_bower_manager!
|
128
|
+
|
129
|
+
@bower_manager = ::WebBlocks::Manager::Bower.new @base_path
|
130
|
+
|
131
|
+
end
|
132
|
+
|
133
|
+
def initialize_root!
|
134
|
+
|
135
|
+
@root = framework do
|
136
|
+
set :build_dir, 'build'
|
137
|
+
set :css_build_dir, 'css'
|
138
|
+
set :js_build_dir, 'js'
|
139
|
+
end
|
140
|
+
|
141
|
+
end
|
142
|
+
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
@@ -0,0 +1,155 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
require 'execjs/module'
|
3
|
+
require 'web_blocks/manager/bower'
|
4
|
+
require 'web_blocks/thor/base'
|
5
|
+
|
6
|
+
module WebBlocks
|
7
|
+
module Thor
|
8
|
+
class Base
|
9
|
+
|
10
|
+
class_option :reload_bower,
|
11
|
+
:type => :boolean,
|
12
|
+
:default => false,
|
13
|
+
:desc => 'Reload Bower-managed blocks'
|
14
|
+
|
15
|
+
class_option :reload_registry,
|
16
|
+
:type => :boolean,
|
17
|
+
:default => false,
|
18
|
+
:desc => 'Reload block registry rather than using cache'
|
19
|
+
|
20
|
+
class_option :include,
|
21
|
+
:type => :array,
|
22
|
+
:default => nil,
|
23
|
+
:desc => 'Paths to explicitly include'
|
24
|
+
|
25
|
+
no_commands do
|
26
|
+
|
27
|
+
def prepare_blocks!
|
28
|
+
|
29
|
+
log.scope 'INIT' do |log|
|
30
|
+
|
31
|
+
begin
|
32
|
+
|
33
|
+
if !bower_manager.installed? or self.options.reload_bower
|
34
|
+
install_bower_components! log
|
35
|
+
elsif self.options.reload_registry
|
36
|
+
clean_bower_registry! log
|
37
|
+
end
|
38
|
+
|
39
|
+
rescue ::ExecJS::ProgramError => e
|
40
|
+
|
41
|
+
if e.message.match "Cannot find module 'bower'"
|
42
|
+
log.fatal { 'Bower must be installed -- try `npm install bower\'' }
|
43
|
+
exit 1
|
44
|
+
else
|
45
|
+
raise e
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
load_bower_registry! log
|
51
|
+
load_blockfile! log
|
52
|
+
include_own_routes! log
|
53
|
+
include_routes_from_command_line! log if self.options.include
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
private
|
62
|
+
|
63
|
+
def install_bower_components! log
|
64
|
+
|
65
|
+
log.debug do
|
66
|
+
bower_manager.clean_update!
|
67
|
+
bower_manager.installed? ? 'Reloaded bower components and cleaning component registry' : 'Installed bower components'
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
|
72
|
+
def clean_bower_registry! log
|
73
|
+
|
74
|
+
log.debug do
|
75
|
+
bower_manager.clean_registry_cache!
|
76
|
+
'Cleaned bower component registry'
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
80
|
+
|
81
|
+
def load_bower_registry! log
|
82
|
+
|
83
|
+
log.scope 'Block' do |log|
|
84
|
+
log.debug do
|
85
|
+
task = self
|
86
|
+
framework :path => @base_path do
|
87
|
+
task.bower_manager.registry.components.each do |name, path|
|
88
|
+
begin
|
89
|
+
log.debug name do
|
90
|
+
register :name => name, :path => path
|
91
|
+
"Loaded"
|
92
|
+
end
|
93
|
+
rescue
|
94
|
+
log.warn("#{name}") { "Skipped -- Blockfile.rb does not exist" }
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
bower_manager.has_registry_cache? ? 'Loaded cached bower component registry' : 'Generated bower component registry'
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
end
|
103
|
+
|
104
|
+
def load_blockfile! log
|
105
|
+
|
106
|
+
if blockfile_path
|
107
|
+
|
108
|
+
log.debug do
|
109
|
+
|
110
|
+
root.instance_eval File.read blockfile_path
|
111
|
+
"Loaded #{blockfile_path}"
|
112
|
+
|
113
|
+
end
|
114
|
+
|
115
|
+
else
|
116
|
+
|
117
|
+
log.warn('INIT') { "Running without Blockfile -- does not exist" }
|
118
|
+
|
119
|
+
end
|
120
|
+
|
121
|
+
end
|
122
|
+
|
123
|
+
def include_own_routes! log
|
124
|
+
|
125
|
+
own_name = bower_manager.registry.name
|
126
|
+
if root.has_child? own_name
|
127
|
+
root.children[own_name].set :required, true
|
128
|
+
end
|
129
|
+
|
130
|
+
end
|
131
|
+
|
132
|
+
def include_routes_from_command_line! log
|
133
|
+
|
134
|
+
route = []
|
135
|
+
|
136
|
+
self.options.include.each do |segment|
|
137
|
+
|
138
|
+
delimiter = segment[segment.length-1] == ','
|
139
|
+
|
140
|
+
route.push delimiter ? segment[0,segment.length-1] : segment
|
141
|
+
|
142
|
+
if delimiter
|
143
|
+
root.include *route
|
144
|
+
route = []
|
145
|
+
end
|
146
|
+
|
147
|
+
end
|
148
|
+
|
149
|
+
root.include *route if route.length > 0
|
150
|
+
|
151
|
+
end
|
152
|
+
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'tsort'
|
2
|
+
require 'web_blocks/thor/build'
|
3
|
+
require 'web_blocks/manager/parallel_builder'
|
4
|
+
|
5
|
+
class Fork
|
6
|
+
|
7
|
+
end
|
8
|
+
|
9
|
+
module WebBlocks
|
10
|
+
module Thor
|
11
|
+
class Build
|
12
|
+
|
13
|
+
description = "Build all assets"
|
14
|
+
desc "all", description
|
15
|
+
long_desc description
|
16
|
+
|
17
|
+
def all
|
18
|
+
|
19
|
+
prepare_blocks!
|
20
|
+
|
21
|
+
jobs = WebBlocks::Manager::ParallelBuilder.new self
|
22
|
+
jobs.start :scss
|
23
|
+
jobs.start :js
|
24
|
+
jobs.save_when_done!
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'web_blocks/thor/inspect/blocks/printer'
|
2
|
+
|
3
|
+
module WebBlocks
|
4
|
+
module Thor
|
5
|
+
class Inspect
|
6
|
+
no_commands do
|
7
|
+
module Blocks
|
8
|
+
class AttributePrinter < Printer
|
9
|
+
|
10
|
+
def initialize key, value, options
|
11
|
+
super options
|
12
|
+
@value = value
|
13
|
+
@key_string = parse_key(key)
|
14
|
+
@value_string = parse_value(value)
|
15
|
+
end
|
16
|
+
|
17
|
+
def parse_key key
|
18
|
+
":#{key}"
|
19
|
+
end
|
20
|
+
|
21
|
+
def parse_value value
|
22
|
+
if @value.is_a?(::Array) or @value.is_a?(::Hash)
|
23
|
+
value.size > 0 ? value : nil
|
24
|
+
elsif value.is_a?(::String)
|
25
|
+
"\"#{value}\""
|
26
|
+
elsif value.is_a?(::TrueClass)
|
27
|
+
"true"
|
28
|
+
elsif value.is_a?(::FalseClass)
|
29
|
+
"false"
|
30
|
+
else
|
31
|
+
nil
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def color
|
36
|
+
@value ? [:green] : [:red]
|
37
|
+
end
|
38
|
+
|
39
|
+
def print!
|
40
|
+
say("#{@key_string} = #{@value_string}", color) if @value_string
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'web_blocks/thor/inspect/blocks/printer'
|
2
|
+
require 'web_blocks/thor/inspect/blocks/attribute_printer'
|
3
|
+
|
4
|
+
module WebBlocks
|
5
|
+
module Thor
|
6
|
+
class Inspect
|
7
|
+
no_commands do
|
8
|
+
module Blocks
|
9
|
+
class BlockPrinter < Printer
|
10
|
+
|
11
|
+
def initialize block, options
|
12
|
+
super options
|
13
|
+
@block = block
|
14
|
+
end
|
15
|
+
|
16
|
+
def print_name!
|
17
|
+
say "#{@block.name} (#{@block.class.name.split('::')[-1]})", (@block.respond_to?(:children) ? :bold : [])
|
18
|
+
end
|
19
|
+
|
20
|
+
def print_attributes!
|
21
|
+
@block.attributes.each do |key, value|
|
22
|
+
AttributePrinter.new(key, value, @options).print!
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def print_children!
|
27
|
+
@block.children.each do |_, child|
|
28
|
+
self.class.new(child, @options).print!
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def print!
|
33
|
+
print_name!
|
34
|
+
print_attributes! if @options[:attributes]
|
35
|
+
print_children! if @block.respond_to? :children
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module WebBlocks
|
2
|
+
module Thor
|
3
|
+
class Inspect
|
4
|
+
no_commands do
|
5
|
+
module Blocks
|
6
|
+
class Printer
|
7
|
+
|
8
|
+
def initialize options
|
9
|
+
@options = options.clone
|
10
|
+
@options[:depth] = 0 unless @options.has_key?(:depth)
|
11
|
+
@options[:depth] = @options[:depth] + 1
|
12
|
+
@shell = ::WebBlocks::Thor::Inspect::Shell::Color.new
|
13
|
+
end
|
14
|
+
|
15
|
+
def say(message = '', color = nil, force_new_line = (message.to_s !~ /( |\t)\Z/))
|
16
|
+
@shell.say Array.new(@options[:depth]).join(' ') + message, color, force_new_line
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'web_blocks/thor/inspect'
|
2
|
+
require 'web_blocks/thor/inspect/blocks/block_printer'
|
3
|
+
|
4
|
+
module WebBlocks
|
5
|
+
module Thor
|
6
|
+
class Inspect
|
7
|
+
|
8
|
+
blocks_desc = 'List of registered blocks, optionally with attributes and filtered to a route'
|
9
|
+
desc "blocks", blocks_desc
|
10
|
+
long_desc blocks_desc
|
11
|
+
method_option :route, :type => :array, :default => [], :desc => 'Route to block to print'
|
12
|
+
method_option :attributes, :type => :boolean, :default => false, :desc => 'Show block attributes'
|
13
|
+
|
14
|
+
def blocks
|
15
|
+
|
16
|
+
prepare_blocks!
|
17
|
+
|
18
|
+
Blocks::BlockPrinter.new(
|
19
|
+
root.block_from_route(options.route),
|
20
|
+
:attributes => options[:attributes]
|
21
|
+
).print!
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'web_blocks/thor/inspect'
|
2
|
+
|
3
|
+
module WebBlocks
|
4
|
+
module Thor
|
5
|
+
class Inspect
|
6
|
+
|
7
|
+
bower_registry_desc = "Registry of blocks as defined by bower.json"
|
8
|
+
desc "bower_registry", bower_registry_desc
|
9
|
+
long_desc bower_registry_desc
|
10
|
+
|
11
|
+
def bower_registry
|
12
|
+
|
13
|
+
prepare_blocks!
|
14
|
+
|
15
|
+
bower_manager.registry.components.each do |name,path|
|
16
|
+
say name, :bold
|
17
|
+
say " #{path}", :green
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'web_blocks/thor/inspect'
|
2
|
+
|
3
|
+
module WebBlocks
|
4
|
+
module Thor
|
5
|
+
class Inspect
|
6
|
+
|
7
|
+
list_desc = "Adjacency list of all files and dependencies"
|
8
|
+
desc "dependency_list", list_desc
|
9
|
+
long_desc list_desc
|
10
|
+
method_option :type, :desc => "Any of: \"#{types.keys.join('", "')}\"; default \"all\"."
|
11
|
+
|
12
|
+
def dependency_list
|
13
|
+
|
14
|
+
prepare_blocks!
|
15
|
+
|
16
|
+
type = self.class.type_get_class_from_string options.type
|
17
|
+
|
18
|
+
root.adjacency_list.each do |file, dependencies|
|
19
|
+
next unless file.is_a? type
|
20
|
+
say file.resolved_path.to_s
|
21
|
+
dependencies.each do |dependency|
|
22
|
+
say " #{dependency.resolved_path.to_s}", :green
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'web_blocks/thor/inspect'
|
2
|
+
|
3
|
+
module WebBlocks
|
4
|
+
module Thor
|
5
|
+
class Inspect
|
6
|
+
|
7
|
+
order_desc = "File order based on topological sort of dependency list"
|
8
|
+
desc "dependency_order", order_desc
|
9
|
+
long_desc order_desc
|
10
|
+
method_option :type, :desc => "Any of: \"#{types.keys.join('", "')}\"; default \"all\"."
|
11
|
+
|
12
|
+
def dependency_order
|
13
|
+
|
14
|
+
prepare_blocks!
|
15
|
+
|
16
|
+
type = self.class.type_get_class_from_string options.type
|
17
|
+
|
18
|
+
root.get_file_load_order(type).each do |file|
|
19
|
+
say "#{file.resolved_path.to_s}"
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'tsort'
|
2
|
+
require 'web_blocks/thor/partial/link'
|
3
|
+
require 'web_blocks/strategy/compile/scss'
|
4
|
+
|
5
|
+
module WebBlocks
|
6
|
+
module Thor
|
7
|
+
module Partial
|
8
|
+
class Compile
|
9
|
+
|
10
|
+
description = "Compile linked SCSS files"
|
11
|
+
desc "scss", description
|
12
|
+
long_desc description
|
13
|
+
|
14
|
+
def scss
|
15
|
+
|
16
|
+
prepare_blocks!
|
17
|
+
::WebBlocks::Strategy::Compile::Scss.new(self).execute!
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'tsort'
|
2
|
+
require 'web_blocks/thor/partial/link'
|
3
|
+
require 'web_blocks/strategy/link/js'
|
4
|
+
|
5
|
+
module WebBlocks
|
6
|
+
module Thor
|
7
|
+
module Partial
|
8
|
+
class Link
|
9
|
+
|
10
|
+
description = "Construct linked construct of JS files based on dependencies"
|
11
|
+
desc "js", description
|
12
|
+
long_desc description
|
13
|
+
|
14
|
+
def js
|
15
|
+
|
16
|
+
prepare_blocks!
|
17
|
+
::WebBlocks::Strategy::Link::Js.new(self).execute!
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|