cyborg 0.0.5 → 0.0.6
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 +4 -4
- data/bin/cyborg +15 -0
- data/lib/cyborg.rb +11 -10
- data/lib/cyborg/command.rb +7 -3
- data/lib/cyborg/command/help.rb +4 -4
- data/lib/cyborg/command/scaffold.rb +2 -0
- data/lib/cyborg/plugin.rb +16 -9
- data/lib/cyborg/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8be8c78e209edaa778911fe6eb792394e33b58f0
|
4
|
+
data.tar.gz: cc0cb8ae86a6ce4b68a851bcf8593ea38e2823a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa46ffe222014a8c92e0cd4eda081b68106cb7ebf80646686751031ec2c9e9f369f910a759cee589a53b867997de1ded3d52e224b22932bdd67c711fd7c1910c
|
7
|
+
data.tar.gz: c92d05d34c5f00cc2ba96f5a1bf96907bf0ab5fbcf1fe0f59a2d3ebc02dde3faf2ffffd46b8585bd7dce87f66f15a249d5c0b5d7f5b39558bf0e149457a58091
|
data/bin/cyborg
CHANGED
@@ -37,6 +37,21 @@ OptionParser.new do |opts|
|
|
37
37
|
options[:cli_path] = next_arg || Dir.pwd
|
38
38
|
end
|
39
39
|
|
40
|
+
if %w(build watch server).include? options[:command]
|
41
|
+
opts.on("-j", "--js", "build javascripts") do |val|
|
42
|
+
options[:select_assets] = true
|
43
|
+
options[:js] = true
|
44
|
+
end
|
45
|
+
opts.on("-c", "--css", "build css") do |val|
|
46
|
+
options[:select_assets] = true
|
47
|
+
options[:css] = true
|
48
|
+
end
|
49
|
+
opts.on("-s", "--svg", "build svg") do |val|
|
50
|
+
options[:select_assets] = true
|
51
|
+
options[:svg] = true
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
40
55
|
opts.on("-v", "--version", "Print version") do |version|
|
41
56
|
options[:version] = true
|
42
57
|
end
|
data/lib/cyborg.rb
CHANGED
@@ -30,19 +30,20 @@ module Cyborg
|
|
30
30
|
load_helpers
|
31
31
|
end
|
32
32
|
|
33
|
-
def dispatch(command)
|
33
|
+
def dispatch(command, *args)
|
34
34
|
@threads = []
|
35
|
-
send(command)
|
35
|
+
send(command, *args)
|
36
36
|
@threads.each { |thr| thr.join }
|
37
37
|
end
|
38
38
|
|
39
|
-
def build
|
39
|
+
def build(options={})
|
40
40
|
puts 'Building…'
|
41
|
-
|
41
|
+
require File.join(Dir.pwd, rails_path, 'config/application')
|
42
|
+
@threads.concat plugin.build(options)
|
42
43
|
end
|
43
44
|
|
44
|
-
def watch
|
45
|
-
build
|
45
|
+
def watch(options={})
|
46
|
+
build(options)
|
46
47
|
require 'listen'
|
47
48
|
|
48
49
|
trap("SIGINT") {
|
@@ -50,12 +51,12 @@ module Cyborg
|
|
50
51
|
exit!
|
51
52
|
}
|
52
53
|
|
53
|
-
@threads.concat plugin.watch
|
54
|
+
@threads.concat plugin.watch(options)
|
54
55
|
end
|
55
56
|
|
56
|
-
def server
|
57
|
-
@threads << Thread.new {
|
58
|
-
watch
|
57
|
+
def server(options={})
|
58
|
+
@threads << Thread.new { Cyborg::Command.from_rails 'rails server' }
|
59
|
+
watch(options)
|
59
60
|
end
|
60
61
|
|
61
62
|
def load_rake_tasks
|
data/lib/cyborg/command.rb
CHANGED
@@ -14,11 +14,11 @@ module Cyborg
|
|
14
14
|
when 'npm'
|
15
15
|
from_root { NPM.setup }
|
16
16
|
when 'build'
|
17
|
-
|
17
|
+
from_root { Cyborg.dispatch(:build, options) }
|
18
18
|
when 'watch'
|
19
|
-
|
19
|
+
from_root { Cyborg.dispatch(:watch, options) }
|
20
20
|
when 'server'
|
21
|
-
|
21
|
+
from_root { Cyborg.dispatch(:server, options) }
|
22
22
|
when 'rails'
|
23
23
|
from_rails "rails s"
|
24
24
|
else
|
@@ -26,6 +26,10 @@ module Cyborg
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
+
def load_rails
|
30
|
+
require File.join(Dir.pwd, Cyborg.rails_path, 'config/application')
|
31
|
+
end
|
32
|
+
|
29
33
|
def from_rails(command=nil, &blk)
|
30
34
|
unless dir = Cyborg.rails_path
|
31
35
|
abort "Command must be run from the root of a Cyborg Plugin project, or in its Rails 'site' directory."
|
data/lib/cyborg/command/help.rb
CHANGED
@@ -19,16 +19,16 @@ Options:
|
|
19
19
|
|
20
20
|
def commands
|
21
21
|
{
|
22
|
-
|
22
|
+
new: new,
|
23
23
|
npm: npm,
|
24
24
|
build: build,
|
25
25
|
watch: watch,
|
26
|
-
help:
|
26
|
+
help: help
|
27
27
|
}
|
28
28
|
end
|
29
29
|
|
30
|
-
def
|
31
|
-
"cyborg
|
30
|
+
def new
|
31
|
+
"cyborg new project_name # Create a new Cyborg based project"
|
32
32
|
end
|
33
33
|
|
34
34
|
def npm
|
data/lib/cyborg/plugin.rb
CHANGED
@@ -47,28 +47,35 @@ module Cyborg
|
|
47
47
|
@svgs = Assets::Svgs.new(self, paths[:svgs])
|
48
48
|
end
|
49
49
|
|
50
|
-
def assets
|
51
|
-
|
50
|
+
def assets(options={})
|
51
|
+
assets = []
|
52
|
+
if options[:select_assets]
|
53
|
+
assets.push @svgs if options[:svg]
|
54
|
+
assets.push @stylesheets if options[:css]
|
55
|
+
assets.push @javascripts if options[:js]
|
56
|
+
else
|
57
|
+
assets = [@svgs, @stylesheets, @javascripts]
|
58
|
+
end
|
59
|
+
|
60
|
+
assets
|
52
61
|
end
|
53
62
|
|
54
63
|
def svgs?
|
55
64
|
@svgs.icons.nil?
|
56
65
|
end
|
57
66
|
|
58
|
-
def build
|
59
|
-
|
60
|
-
FileUtils.mkdir_p(File.join(destination, asset_root))
|
61
|
-
}
|
67
|
+
def build(options={})
|
68
|
+
FileUtils.mkdir_p(File.join(destination, asset_root))
|
62
69
|
threads = []
|
63
|
-
assets.each do |asset|
|
70
|
+
assets(options).each do |asset|
|
64
71
|
threads << Thread.new { asset.build }
|
65
72
|
end
|
66
73
|
|
67
74
|
threads
|
68
75
|
end
|
69
76
|
|
70
|
-
def watch
|
71
|
-
assets.map(&:watch)
|
77
|
+
def watch(options)
|
78
|
+
assets(options).map(&:watch)
|
72
79
|
end
|
73
80
|
|
74
81
|
def config(options)
|
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.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Mathis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sass
|