bower_vendor 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bower_vendor/base.rb +10 -6
- data/lib/bower_vendor/copy.rb +15 -15
- data/lib/bower_vendor/version.rb +1 -1
- data/lib/bower_vendor/yarn.rb +8 -7
- data/vendor.yml +30 -0
- metadata +1 -2
- data/vendor_yarn.yml +0 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae8df14c3a4d96a011ea97afacbb840302295cf7ccad308ba7c85c2e54bbc102
|
4
|
+
data.tar.gz: 7023fd813d12928fc16e54b1a5be7e05cb6475f07af0ce5c1a46c48b9275950d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b57c087bf946edd1e96a8213ac99a9973da50afe983ef1ce4f8b5778ee687a22f1a47ba6d519953bdd787312516389bf56ed345be1f308da7e06a0e1c41bccb
|
7
|
+
data.tar.gz: 3ad422ffec81f6bff8c73d15cbdbfa0f98f9cf0969402d30b5a4e907c45dac9b9eacbbac111be31afb21646f8ed3f1347442b429e7d5ff8a4dfceb24c5fca546
|
data/lib/bower_vendor/base.rb
CHANGED
@@ -3,14 +3,18 @@ class BowerVendor::Base
|
|
3
3
|
end
|
4
4
|
|
5
5
|
def vendors
|
6
|
-
@vendors ||= load_vendors
|
7
|
-
validate_vendors
|
6
|
+
@vendors ||= load_vendors.delete_if { |vendor, vendor_data| !accept_vendor?(vendor, vendor_data) }
|
7
|
+
validate_vendors(@vendors)
|
8
8
|
@vendors
|
9
9
|
end
|
10
10
|
|
11
|
-
def
|
11
|
+
def accept_vendor?(vendor, vendor_data)
|
12
|
+
!vendor_data['yarn']
|
13
|
+
end
|
14
|
+
|
15
|
+
def validate_vendors(vendors)
|
12
16
|
# validate resources
|
13
|
-
|
17
|
+
vendors.each do |vendor_key, vendor|
|
14
18
|
raise "VERSION MISSING: #{vendor_key}: #{vendor.inspect}" unless vendor['version']
|
15
19
|
puts "WARN: ASSETS MISSING: #{vendor_key}: #{vendor.inspect}" unless vendor['assets']
|
16
20
|
end
|
@@ -29,8 +33,8 @@ class BowerVendor::Base
|
|
29
33
|
end
|
30
34
|
end
|
31
35
|
|
32
|
-
def
|
33
|
-
"#{self.work_dir}/bower_components/#{
|
36
|
+
def full_vendor_src_dir(vendor)
|
37
|
+
"#{self.work_dir}/bower_components/#{vendor}"
|
34
38
|
end
|
35
39
|
|
36
40
|
def work_dir
|
data/lib/bower_vendor/copy.rb
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
class BowerVendor::Copy < BowerVendor::Base
|
2
2
|
def execute
|
3
|
-
vendors.each do |
|
4
|
-
src_dir =
|
3
|
+
vendors.each do |vendor, asset_data|
|
4
|
+
src_dir = full_vendor_src_dir(vendor)
|
5
5
|
msg 0, "processing: #{src_dir}"
|
6
6
|
|
7
|
-
run_build_scripts(
|
8
|
-
copy_assets(
|
7
|
+
run_build_scripts(vendor, asset_data, 1)
|
8
|
+
copy_assets(vendor, asset_data, 1)
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
|
-
def run_build_scripts(
|
12
|
+
def run_build_scripts(vendor, asset_data, level)
|
13
13
|
scripts = (asset_data['build'] || [])
|
14
14
|
return if scripts.empty?
|
15
15
|
|
16
|
-
src_dir =
|
16
|
+
src_dir = full_vendor_src_dir(vendor)
|
17
17
|
|
18
18
|
msg level, "building..."
|
19
19
|
scripts.each do |cmd|
|
@@ -27,12 +27,12 @@ class BowerVendor::Copy < BowerVendor::Base
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
-
def copy_assets(
|
31
|
-
msg level, "copying: #{
|
32
|
-
copy_asset(
|
30
|
+
def copy_assets(vendor, asset_data, level)
|
31
|
+
msg level, "copying: #{vendor}..."
|
32
|
+
copy_asset(vendor, asset_data, asset_data['assets'], '', level + 1)
|
33
33
|
end
|
34
34
|
|
35
|
-
def copy_asset(
|
35
|
+
def copy_asset(vendor, asset_data, assets, target_path = '', level)
|
36
36
|
assets ||= []
|
37
37
|
if assets.empty?
|
38
38
|
msg level, "WARN: ASSETS MISSING"
|
@@ -42,7 +42,7 @@ class BowerVendor::Copy < BowerVendor::Base
|
|
42
42
|
if asset.is_a? Hash
|
43
43
|
sub_asset = asset.keys.first
|
44
44
|
sub_target_path = target_path.empty? ? sub_asset : target_path + '/' + sub_asset
|
45
|
-
copy_asset(
|
45
|
+
copy_asset(vendor, asset_data, asset[sub_asset], sub_target_path, level + 1)
|
46
46
|
else
|
47
47
|
msg level, asset
|
48
48
|
|
@@ -50,18 +50,18 @@ class BowerVendor::Copy < BowerVendor::Base
|
|
50
50
|
raise "VERSION MISSING: #{asset_data.inspect}" if version.empty?
|
51
51
|
|
52
52
|
asset_path = asset.gsub("{{VERSION}}", version)
|
53
|
-
src = "#{
|
53
|
+
src = "#{full_vendor_src_dir(vendor)}/#{asset_path}"
|
54
54
|
|
55
55
|
files = Dir[src].sort!
|
56
56
|
raise "NOT_FOUND: #{src}" if files.empty?
|
57
57
|
files.each do |src_path|
|
58
|
-
copy_src_file
|
58
|
+
copy_src_file vendor, asset_data, asset, src_path, target_path, level + 1
|
59
59
|
end
|
60
60
|
end
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
|
-
def copy_src_file(
|
64
|
+
def copy_src_file(vendor, asset_data, orig_path, full_src_file, target_path, level)
|
65
65
|
if !File.exist? full_src_file
|
66
66
|
raise "NOT_FOUND: #{full_src_file}"
|
67
67
|
end
|
@@ -74,7 +74,7 @@ class BowerVendor::Copy < BowerVendor::Base
|
|
74
74
|
base_dst_dir = self.dst_dirs[ext]
|
75
75
|
raise "NOT_FOUND_EXT: #{ext}" unless base_dst_dir
|
76
76
|
|
77
|
-
dst_dir = "#{base_dst_dir}/#{
|
77
|
+
dst_dir = "#{base_dst_dir}/#{vendor}-#{version}"
|
78
78
|
dst_dir = "#{dst_dir}/#{target_path}" unless target_path.empty?
|
79
79
|
full_dst_file = "#{dst_dir}/#{dst_file}"
|
80
80
|
|
data/lib/bower_vendor/version.rb
CHANGED
data/lib/bower_vendor/yarn.rb
CHANGED
@@ -1,24 +1,25 @@
|
|
1
1
|
class BowerVendor::Yarn < BowerVendor::Copy
|
2
|
-
def
|
3
|
-
"node_modules/#{
|
2
|
+
def full_vendor_src_dir(vendor)
|
3
|
+
"node_modules/#{vendor}"
|
4
4
|
end
|
5
5
|
|
6
|
-
def
|
7
|
-
|
6
|
+
def accept_vendor?(vendor, vendor_data)
|
7
|
+
vendor_data['yarn']
|
8
8
|
end
|
9
9
|
|
10
10
|
def load_vendors
|
11
11
|
versions = load_vendor_versions
|
12
12
|
|
13
|
-
|
13
|
+
vendors_data = YAML.load_file 'vendor.yml'
|
14
|
+
vendors_data.delete_if { |vendor, vendor_data| !accept_vendor?(vendor, vendor_data) }
|
14
15
|
|
15
|
-
|
16
|
+
vendors_data.each do |vendor, vendor_data|
|
16
17
|
version = versions[vendor]
|
17
18
|
raise "YARN: missing vendor: #{vendor}" unless version
|
18
19
|
vendor_data['version'] = version
|
19
20
|
end
|
20
21
|
|
21
|
-
|
22
|
+
vendors_data
|
22
23
|
end
|
23
24
|
|
24
25
|
def load_vendor_versions
|
data/vendor.yml
CHANGED
@@ -21,3 +21,33 @@ test_3:
|
|
21
21
|
version: test3
|
22
22
|
assets:
|
23
23
|
- index.jpg
|
24
|
+
|
25
|
+
bootstrap:
|
26
|
+
yarn: true
|
27
|
+
assets:
|
28
|
+
- scss/*.scss
|
29
|
+
- mixins:
|
30
|
+
- scss/mixins/*.scss
|
31
|
+
- utilities:
|
32
|
+
- scss/utilities/*.scss
|
33
|
+
- js/dist/*.js
|
34
|
+
|
35
|
+
jquery:
|
36
|
+
yarn: true
|
37
|
+
assets:
|
38
|
+
- dist/jquery.js
|
39
|
+
|
40
|
+
lodash:
|
41
|
+
yarn: true
|
42
|
+
assets:
|
43
|
+
- lodash.js
|
44
|
+
|
45
|
+
url.js:
|
46
|
+
yarn: true
|
47
|
+
assets:
|
48
|
+
- url.js
|
49
|
+
|
50
|
+
vue:
|
51
|
+
yarn: true
|
52
|
+
assets:
|
53
|
+
- dist/vue.js
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bower_vendor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kari
|
@@ -99,7 +99,6 @@ files:
|
|
99
99
|
- test/test1.js
|
100
100
|
- test/test2.js
|
101
101
|
- vendor.yml
|
102
|
-
- vendor_yarn.yml
|
103
102
|
- yarn.lock
|
104
103
|
homepage: https://github.com/kikonen/bower_vendor
|
105
104
|
licenses:
|
data/vendor_yarn.yml
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
bootstrap:
|
2
|
-
assets:
|
3
|
-
- scss/*.scss
|
4
|
-
- mixins:
|
5
|
-
- scss/mixins/*.scss
|
6
|
-
- utilities:
|
7
|
-
- scss/utilities/*.scss
|
8
|
-
- js/dist/*.js
|
9
|
-
|
10
|
-
jquery:
|
11
|
-
assets:
|
12
|
-
- dist/jquery.js
|
13
|
-
|
14
|
-
lodash:
|
15
|
-
assets:
|
16
|
-
- lodash.js
|
17
|
-
|
18
|
-
url.js:
|
19
|
-
assets:
|
20
|
-
- url.js
|
21
|
-
|
22
|
-
vue:
|
23
|
-
assets:
|
24
|
-
- dist/vue.js
|