cyborg 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9547534101abdc5d49c1d75dc86880d121761a2f
4
- data.tar.gz: 05fb8e45650f989b57c7adcd8a5f7a427dc2ec02
3
+ metadata.gz: 8be8c78e209edaa778911fe6eb792394e33b58f0
4
+ data.tar.gz: cc0cb8ae86a6ce4b68a851bcf8593ea38e2823a9
5
5
  SHA512:
6
- metadata.gz: a01cfb9ac3c825f825cbb9ae1bdb8ef308d4f7f4d854b9882767804d8707eb37bc1a64c7cfe3ceaf7b534adb2044507384a690c61b0762b228e42f9cf8d9d4d3
7
- data.tar.gz: 561a38775cb07cace8c5332bae7b09d5d107a4579d1ab1074f7049a8bbbf255843df6f206b59e86ec33cf828c00cc4c9098d166d8dbd2b0783dbbfbb9c9f950b
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
- @threads.concat plugin.build
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 { system 'rails server' }
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
@@ -14,11 +14,11 @@ module Cyborg
14
14
  when 'npm'
15
15
  from_root { NPM.setup }
16
16
  when 'build'
17
- from_rails "bundle exec rake cyborg:build"
17
+ from_root { Cyborg.dispatch(:build, options) }
18
18
  when 'watch'
19
- from_rails "rake cyborg:watch"
19
+ from_root { Cyborg.dispatch(:watch, options) }
20
20
  when 'server'
21
- from_rails "rake cyborg:server"
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."
@@ -19,16 +19,16 @@ Options:
19
19
 
20
20
  def commands
21
21
  {
22
- init: init,
22
+ new: new,
23
23
  npm: npm,
24
24
  build: build,
25
25
  watch: watch,
26
- help: help
26
+ help: help
27
27
  }
28
28
  end
29
29
 
30
- def init
31
- "cyborg init [path] # Write default config file"
30
+ def new
31
+ "cyborg new project_name # Create a new Cyborg based project"
32
32
  end
33
33
 
34
34
  def npm
@@ -142,6 +142,8 @@ pkg/
142
142
  node_modules
143
143
  site/log/*.log
144
144
  site/tmp/
145
+ /public/
146
+ _svg.js
145
147
  .sass-cache}
146
148
  end
147
149
  action_log "update", "#{name}/.gitignore"
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
- [@svgs, @stylesheets, @javascripts]
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
- Command.from_root {
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)
@@ -1,3 +1,3 @@
1
1
  module Cyborg
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
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.5
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-18 00:00:00.000000000 Z
11
+ date: 2016-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sass