cyborg 0.3.0 → 0.3.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8d2f44ea7c9403815f3e2e5e02ba3804bdf1e4e1
4
- data.tar.gz: 9d74c36a6640a2410c1365040a0b43dd1d873cf7
3
+ metadata.gz: 1965c5ca512f92930d8e71545a5cde4f7dd4f5cb
4
+ data.tar.gz: 6e471c42e47edc6f1204fd4d5afd1315b103bd28
5
5
  SHA512:
6
- metadata.gz: a43f7b67340a52f143d2cd8bfe03391465faf139d449913d14082b05cdb6cb76f0006dcd935ba8a760619708e7572139b8ed7ef22222463489ea8770b06d953c
7
- data.tar.gz: 01af22afd859ca34cff2e6c9637555ae56431a09794bb1176805f8bbb35165d5d22fea38944139fcdbc67673154b55ab381840da1b1f749bb8b1f0f0b5189d9e
6
+ metadata.gz: fdd2bb3447a147dbe12d2832d39fe1f83c8607057a57619affbd30296e0bd0d980062e28259f14e2bec5a2402bd178207e1c58e36f08f2558b9af1a56c771868
7
+ data.tar.gz: e7beb9c432de50056b47f383216da79fb9b7b53eb252b0934296d8cf3a7e48cad3d2ac2b5af483e5ae682e648500c90a182c169d2135eca8d6afac581137297f
data/bin/cyborg CHANGED
@@ -18,7 +18,7 @@ OptionParser.new do |opts|
18
18
  options[:help] = ARGV.shift if %w(help h).include?(ARGV.first)
19
19
 
20
20
  if ARGV.empty?
21
- options[:help] = 'help' # show help as default subcommand
21
+ options[:help] = true
22
22
  else
23
23
  options[:command] = next_arg
24
24
  end
@@ -68,15 +68,14 @@ OptionParser.new do |opts|
68
68
  end
69
69
 
70
70
  opts.on("-v", "--version", "Print version") do |version|
71
- options[:version] = true
71
+ options[:command] = 'version'
72
72
  end
73
73
 
74
74
  opts.on("-h", "--help", "Print this message") do |version|
75
75
  options[:help] = opts
76
- options[:command] = 'help'
77
76
  end
78
77
 
79
- if options[:help] == 'help'
78
+ if options[:help]
80
79
  options[:help] = opts
81
80
  end
82
81
  end.parse!
@@ -23,6 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.add_runtime_dependency "listen", "~> 3.0"
24
24
  spec.add_runtime_dependency 'block_helpers', '~> 0.3.3'
25
25
  spec.add_runtime_dependency 'colorize'
26
+ spec.add_runtime_dependency "bundler", "~> 1.11"
26
27
 
27
28
  spec.add_runtime_dependency "rails", "~> 4"
28
29
  spec.add_dependency 'rack-cors'
@@ -7,7 +7,13 @@ module Cyborg
7
7
  extend self
8
8
 
9
9
  def run(options)
10
- @production = options[:production] || !!options[:command].match(/gem/)
10
+ @production = options[:production]
11
+
12
+ if options[:help]
13
+ version
14
+ puts options[:help]
15
+ return
16
+ end
11
17
 
12
18
  case options[:command]
13
19
  when 'new', 'n'
@@ -20,9 +26,6 @@ module Cyborg
20
26
  from_root { dispatch(:server, options) }
21
27
  when 'clean', 'c'
22
28
  from_root { clean }
23
- when 'help', 'h'
24
- version
25
- puts options[:help]
26
29
  when 'version'
27
30
  version
28
31
  when 'gem:build'
@@ -14,7 +14,7 @@ module Cyborg
14
14
  puts "Creating new plugin #{@namespace}".bold
15
15
  engine_site_scaffold
16
16
 
17
- @gemspec_path = create_gem
17
+ @gemspec_path = new_gem
18
18
  @path = File.expand_path(File.dirname(@gemspec_path))
19
19
 
20
20
  fix_gemspec_files
@@ -31,17 +31,9 @@ module Cyborg
31
31
 
32
32
  # Create a new gem with Bundle's gem command
33
33
  #
34
- def create_gem
35
- begin
36
- require 'bundler'
37
- require 'bundler/cli'
38
- Bundler::CLI.start(['gem', gem])
39
-
40
- Dir.glob(File.join(gem, "/*.gemspec")).first
41
-
42
- rescue LoadError
43
- raise "To use this feature you'll need to install the bundler gem with `gem install bundler`."
44
- end
34
+ def new_gem
35
+ system "bundler gem #{gem}"
36
+ Dir.glob(File.join(gem, "/*.gemspec")).first
45
37
  end
46
38
 
47
39
  def install_npm_modules
@@ -2,6 +2,10 @@ module Cyborg
2
2
  module Helpers
3
3
  module AssetsHelper
4
4
 
5
+ def cyborg_asset_url(file)
6
+ Cyborg.plugin.asset_url(file)
7
+ end
8
+
5
9
  def stylesheet_tag(*args)
6
10
  options = args.last.is_a?(Hash) ? args.pop : {}
7
11
  tags = ''
@@ -39,8 +43,16 @@ module Cyborg
39
43
  stylesheet_tag + javascript_tag
40
44
  end
41
45
 
42
- def pin_tab_icon(path)
43
- %Q{<link rel="mask-icon" mask href="#{path}" color="black">}.html_safe
46
+ def pin_tab_icon_tag(path, color="black")
47
+ %Q{<link rel="mask-icon" mask href="#{cyborg_asset_url(path)}" color="#{color}">}.html_safe
48
+ end
49
+
50
+ def favicon_tag(source='favicon.ico', options={})
51
+ tag('link', {
52
+ :rel => 'shortcut icon',
53
+ :type => 'image/x-icon',
54
+ :href => cyborg_asset_url(source)
55
+ }.merge!(options.symbolize_keys))
44
56
  end
45
57
  end
46
58
  end
@@ -76,9 +76,9 @@ module Cyborg
76
76
 
77
77
  def build(options={})
78
78
  @maps = options[:maps] || Cyborg.production?
79
- root = File.join(destination, asset_root)
80
- FileUtils.rm_rf(root) if Cyborg.production?
81
- FileUtils.mkdir_p(root)
79
+ # TODO: be sure gem builds use a clean asset_path
80
+ #FileUtils.rm_rf(root) if Cyborg.production?
81
+ FileUtils.mkdir_p(asset_path)
82
82
  threads = []
83
83
  assets(options).each do |asset|
84
84
  threads << Thread.new { asset.build }
@@ -117,7 +117,6 @@ module Cyborg
117
117
  end
118
118
  end
119
119
 
120
-
121
120
  def expand_asset_paths
122
121
  @paths.each do |type, path|
123
122
  @paths[type] = File.join(root, path)
@@ -125,12 +124,20 @@ module Cyborg
125
124
  @destination = File.join(root, @destination)
126
125
  end
127
126
 
128
- def asset_root
129
- if Cyborg.production?
130
- plugin.production_asset_root
127
+ def asset_path(file=nil)
128
+ dest = File.join(destination, asset_root)
129
+ dest = File.join(dest, file) if file
130
+ dest
131
+ end
132
+
133
+ def asset_url(file=nil)
134
+ path = if Cyborg.production?
135
+ production_asset_root
131
136
  else
132
- plugin.asset_root
137
+ asset_root
133
138
  end
139
+ path = File.join(path, file) if file
140
+ path
134
141
  end
135
142
 
136
143
  private
@@ -69,11 +69,11 @@ module Cyborg
69
69
  end
70
70
 
71
71
  def destination(path)
72
- File.join(plugin.destination, plugin.asset_root, versioned(path))
72
+ plugin.asset_path(versioned(path))
73
73
  end
74
74
 
75
75
  def url(path)
76
- File.join(plugin.asset_root, versioned(path))
76
+ plugin.asset_url(versioned(path))
77
77
  end
78
78
 
79
79
  def urls(names=nil)
@@ -1,3 +1,3 @@
1
1
  module Cyborg
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
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.3.0
4
+ version: 0.3.1
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-27 00:00:00.000000000 Z
11
+ date: 2016-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sass
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: bundler
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.11'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.11'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: rails
85
99
  requirement: !ruby/object:Gem::Requirement