cyborg 0.5.13 → 0.5.14

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: 0b0851af7cad7b42dd8e77bf692c873a77d7ee4d
4
- data.tar.gz: ddfe4f98d2f5b52f3ffcef4aa90bfa60ccb8a209
3
+ metadata.gz: d2d1dc919350c58e8dba2e60bef24090a5bfb07e
4
+ data.tar.gz: 4b1c0545b4ab96eedf7b55806f947111352a701f
5
5
  SHA512:
6
- metadata.gz: dd581ed3b2fbf085420e0ba71a5e8e62661166fe6b927ead010c0063c3a7c090cc347c33ccaf1b7de01d9fb48e702368067dc1ee4179fed16d810195698fe72f
7
- data.tar.gz: 8e6163b7d32c9d65e0e1bac4d9e84620cb3da604a9cbf3e8cd654b9a5336412a79aa8d979bfde2d9fb09e2d8bb6bab56f467c1b0cdd3a8e09fed08d30c3e9395
6
+ metadata.gz: b2fcb930d1a8b88ea653523519a3eea3e4fc09b0e95845699207688772b8ff47f41f7211f1598d9c4e3d7bdb172473b55463df7559aa6848a5c104454ff50ee6
7
+ data.tar.gz: 09e5f45fb099313c0f5bd48d1acfccc2fbfd1ff613b0e27d73d63cc2deb6593e7f851b2f6b261bb1dd8051e88c2869499b5c18a31616818ce745d7ef7b50ff6b
data/lib/cyborg.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require "open3"
2
2
  require "json"
3
- require 'colorize'
3
+ require "colorize"
4
4
 
5
5
  require "cyborg/command"
6
6
  require "cyborg/version"
@@ -40,8 +40,22 @@ module Cyborg
40
40
  File.basename(path).sub(/(\.\w+)$/, '-'+plugin.version+'\1')
41
41
  end
42
42
 
43
- def build_msg(file)
44
- "Built: #{destination(file).sub(plugin.root+'/','')}"
43
+ def build_success(file)
44
+ log_success "Built: #{destination(file).sub(plugin.root+'/','')}"
45
+ end
46
+
47
+ def build_failure(file)
48
+ msg = "FAILED TO BUILD"
49
+ msg += ": #{destination(file).sub(plugin.root+'/','')}" if file
50
+ log_error msg
51
+ end
52
+
53
+ def log_success( msg )
54
+ STDOUT.print msg.to_s.strip.colorize(:green)
55
+ end
56
+
57
+ def log_error( msg )
58
+ STDERR.puts msg.to_s.strip.colorize(:red)
45
59
  end
46
60
 
47
61
  # Determine if an NPM module is installed by checking paths with `npm ls`
@@ -124,7 +138,6 @@ module Cyborg
124
138
 
125
139
  File.utime(mtime, mtime, gz_file)
126
140
  end
127
-
128
141
  end
129
142
  end
130
143
  end
@@ -19,20 +19,20 @@ module Cyborg
19
19
 
20
20
  if Open3.capture3("npm ls browserify-incremental")[1].empty?
21
21
  files.each do |file|
22
- system build_command(file)
22
+ begin
23
+ system build_command(file)
24
+ compress(destination(file)) if Cyborg.production?
23
25
 
24
- if Cyborg.production?
25
- compress(destination(file))
26
- end
26
+ puts build_success(file)
27
27
 
28
- if File.exist? destination(file)
29
- puts build_msg(file)
30
- else
31
- puts "FAILED TO WRITE: #{file}."
28
+ rescue => bang
29
+ build_failure file
30
+ log_error bang
32
31
  end
33
32
  end
34
33
  else
35
- abort "JS BUILD FAILED: browserifyinc NPM module not found.\n" << "Please add browserifyinc to your package.json and run `npm install`"
34
+ log_error "JS BUILD FAILED: browserifyinc NPM module not found.\n" << "Please add browserifyinc to your package.json and run `npm install`"
35
+ abort
36
36
  end
37
37
  end
38
38
 
@@ -26,10 +26,10 @@ module Cyborg
26
26
  build_sass(file)
27
27
  end
28
28
 
29
- puts build_msg(file)
30
- rescue => bang
31
- STDERR.puts "FAILED TO WRITE: #{destination(file).sub(plugin.root+'/','')}"
32
- STDERR.puts bang
29
+ puts build_success(file)
30
+ rescue => bang
31
+ build_failure file
32
+ log_error bang
33
33
  end
34
34
  end
35
35
  end
@@ -29,12 +29,17 @@ module Cyborg
29
29
  def build
30
30
  return if find_files.empty?
31
31
 
32
- @svg.read_files
33
-
34
- if write_path = @svg.write
35
- puts "Built: #{write_path.sub(plugin.root+'/','')}"
36
- else
37
- puts "FAILED TO WRITE: #{write_path.sub(plugin.root+'/','')}"
32
+ begin
33
+ @svg.read_files
34
+
35
+ if file = @svg.write
36
+ puts build_success(file)
37
+ else
38
+ log_error "FAILED TO BUILD SVGs"
39
+ end
40
+ rescue => bang
41
+ log_error "FAILED TO BUILD SVGs"
42
+ log_error bang
38
43
  end
39
44
  end
40
45
  end
@@ -1,3 +1,3 @@
1
1
  module Cyborg
2
- VERSION = "0.5.13"
2
+ VERSION = "0.5.14"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cyborg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.13
4
+ version: 0.5.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Mathis