cyborg 0.5.23 → 0.5.24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/cyborg.gemspec +1 -1
- data/lib/cyborg/esvg.rb +14 -0
- data/lib/cyborg/plugin/assets/asset.rb +15 -14
- data/lib/cyborg/plugin/assets/svgs.rb +19 -13
- data/lib/cyborg/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68cf19f866d0d344943d3d4844e0329bce1e52f2
|
4
|
+
data.tar.gz: 01126b6a0e25132737e68be1799fc3cbc8a5fe0a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b865ce911bec5cb84129cf9f48877bd43355ac7a666af16987bb8be422fa5d48256777b9071affba1c89a9a25d2bcdfb914f1d43a84a3928c221bec3235722c
|
7
|
+
data.tar.gz: 638361f7f4520e682211cb09a75393af11919e960eb620e69b2aadfaea128a62152b049c4f09a207a037ac7b8f6b259ece2b2bcd2458c9c5bef5d9c080c12b9f
|
data/cyborg.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
21
|
spec.add_runtime_dependency 'sass', '~> 3.4'
|
22
|
-
spec.add_runtime_dependency 'esvg', '~>
|
22
|
+
spec.add_runtime_dependency 'esvg', '~> 4.0'
|
23
23
|
spec.add_runtime_dependency 'listen', '~> 3.0.0'
|
24
24
|
spec.add_runtime_dependency 'block_helpers', '~> 0.3'
|
25
25
|
spec.add_runtime_dependency 'colorize', '~> 0.8'
|
data/lib/cyborg/esvg.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'esvg'
|
2
|
+
|
3
|
+
module Esvg
|
4
|
+
module Helpers
|
5
|
+
|
6
|
+
def use_svg(name, options={})
|
7
|
+
if esvg_files.exist?(name, options[:fallback])
|
8
|
+
esvg_files.use(name, options).html_safe
|
9
|
+
elsif Cyborg.plugin.svgs.icons.exist?(name, options[:fallback])
|
10
|
+
Cyborg.plugin.svgs.use(name, options).html_safe
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -56,26 +56,27 @@ module Cyborg
|
|
56
56
|
STDERR.puts msg.to_s.colorize(:red)
|
57
57
|
end
|
58
58
|
|
59
|
-
# Determine if an NPM module is installed by checking paths with `npm
|
59
|
+
# Determine if an NPM module is installed by checking paths with `npm bin`
|
60
60
|
# Returns path to binary if installed
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
elsif Open3.capture3(
|
71
|
-
|
61
|
+
def find_node_module(cmd)
|
62
|
+
require 'open3'
|
63
|
+
(@modules ||= {})[cmd] ||= begin
|
64
|
+
|
65
|
+
local = "$(npm bin)/#{cmd}"
|
66
|
+
global = "$(npm -g bin)/#{cmd}"
|
67
|
+
|
68
|
+
if Open3.capture3(local)[2].success?
|
69
|
+
local
|
70
|
+
elsif Open3.capture3(global)[2].success?
|
71
|
+
global
|
72
72
|
end
|
73
|
+
|
73
74
|
end
|
75
|
+
end
|
74
76
|
|
75
77
|
def npm_command(cmd)
|
76
78
|
cmd = cmd.split(' ')
|
77
|
-
path = find_node_module(cmd.shift)
|
78
|
-
if path
|
79
|
+
if path = find_node_module(cmd.shift)
|
79
80
|
system "#{path} #{cmd.join(' ')}"
|
80
81
|
end
|
81
82
|
end
|
@@ -3,18 +3,23 @@ module Cyborg
|
|
3
3
|
class Svgs < AssetType
|
4
4
|
|
5
5
|
def initialize(plugin, path)
|
6
|
-
|
6
|
+
|
7
|
+
require 'cyborg/esvg'
|
8
|
+
|
7
9
|
@plugin = plugin
|
8
10
|
@base = path
|
9
11
|
|
10
|
-
@svg = Esvg.new({
|
12
|
+
@svg = Esvg::SVG.new({
|
11
13
|
config_file: File.join(plugin.root, 'config', 'esvg.yml'),
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
14
|
+
source: path,
|
15
|
+
assets: plugin.paths[:javascripts],
|
16
|
+
version: plugin.version,
|
17
|
+
build: plugin.destination,
|
18
|
+
temp: Cyborg.rails_path('tmp/cache/assets'),
|
19
|
+
filename: '_icons.js',
|
20
|
+
compress: Cyborg.production?,
|
21
|
+
optimize: true,
|
22
|
+
print: false
|
18
23
|
})
|
19
24
|
|
20
25
|
end
|
@@ -35,6 +40,10 @@ module Cyborg
|
|
35
40
|
.sub(plugin.root+'/','') # writtent to public dir
|
36
41
|
end
|
37
42
|
|
43
|
+
def use(*args)
|
44
|
+
icons.use(*args)
|
45
|
+
end
|
46
|
+
|
38
47
|
def build_paths
|
39
48
|
@svg.build_paths.map { |file| file.sub("-#{plugin.version}",'') }
|
40
49
|
end
|
@@ -44,13 +53,10 @@ module Cyborg
|
|
44
53
|
begin
|
45
54
|
@svg.read_files
|
46
55
|
|
47
|
-
return if @svg.
|
56
|
+
return if @svg.svgs.empty?
|
48
57
|
|
49
|
-
if files = @svg.
|
58
|
+
if files = @svg.build
|
50
59
|
files.each do |file|
|
51
|
-
if file.start_with?(plugin.destination)
|
52
|
-
compress(file)
|
53
|
-
end
|
54
60
|
puts build_success(file)
|
55
61
|
end
|
56
62
|
else
|
data/lib/cyborg/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cyborg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.24
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Mathis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sass
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '4.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '4.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: listen
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -193,6 +193,7 @@ files:
|
|
193
193
|
- lib/cyborg/command/help.rb
|
194
194
|
- lib/cyborg/command/npm.rb
|
195
195
|
- lib/cyborg/command/scaffold.rb
|
196
|
+
- lib/cyborg/esvg.rb
|
196
197
|
- lib/cyborg/helpers/asset_helpers.rb
|
197
198
|
- lib/cyborg/helpers/layout_helpers.rb
|
198
199
|
- lib/cyborg/middleware.rb
|