cyborg 0.5.14 → 0.5.15

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: d2d1dc919350c58e8dba2e60bef24090a5bfb07e
4
- data.tar.gz: 4b1c0545b4ab96eedf7b55806f947111352a701f
3
+ metadata.gz: deaac461b4f0974e0ad9a1f51439096dd087329c
4
+ data.tar.gz: dd7093d99a3c253c06f24d0939c5dac99e584a60
5
5
  SHA512:
6
- metadata.gz: b2fcb930d1a8b88ea653523519a3eea3e4fc09b0e95845699207688772b8ff47f41f7211f1598d9c4e3d7bdb172473b55463df7559aa6848a5c104454ff50ee6
7
- data.tar.gz: 09e5f45fb099313c0f5bd48d1acfccc2fbfd1ff613b0e27d73d63cc2deb6593e7f851b2f6b261bb1dd8051e88c2869499b5c18a31616818ce745d7ef7b50ff6b
6
+ metadata.gz: 7471921a487d3b2bef35e63d157f5c9d8fc82558a0e660beffdb45eefb68beef9547da36725b64b7fd34f169cde54a7911d0f422a58923fcdf29feaf8aad3879
7
+ data.tar.gz: c657b4e2d50285d5cff98bdef05841b43a44db12ab36b4d059c9237dd05331cc540e00b64cc18cbcb38c418bfdd322dc5b7cab90548d751c6dffe69147cb4dd3
@@ -40,22 +40,26 @@ module Cyborg
40
40
  File.basename(path).sub(/(\.\w+)$/, '-'+plugin.version+'\1')
41
41
  end
42
42
 
43
+ def local_path(file)
44
+ destination(file).sub(plugin.root+'/','')
45
+ end
46
+
43
47
  def build_success(file)
44
- log_success "Built: #{destination(file).sub(plugin.root+'/','')}"
48
+ log_success "Built: #{local_path(file)}"
45
49
  end
46
50
 
47
51
  def build_failure(file)
48
- msg = "FAILED TO BUILD"
49
- msg += ": #{destination(file).sub(plugin.root+'/','')}" if file
52
+ msg = "\nFAILED TO BUILD"
53
+ msg += ": #{local_path(file)}" if file
50
54
  log_error msg
51
55
  end
52
56
 
53
57
  def log_success( msg )
54
- STDOUT.print msg.to_s.strip.colorize(:green)
58
+ STDOUT.puts msg.to_s.colorize(:green)
55
59
  end
56
60
 
57
61
  def log_error( msg )
58
- STDERR.puts msg.to_s.strip.colorize(:red)
62
+ STDERR.puts msg.to_s.colorize(:red)
59
63
  end
60
64
 
61
65
  # Determine if an NPM module is installed by checking paths with `npm ls`
@@ -95,7 +99,7 @@ module Cyborg
95
99
  end
96
100
 
97
101
  def watch
98
- puts "Watching for changes to #{base.sub(plugin.root+'/', '')}..."
102
+ puts "Watching for changes to #{base.sub(plugin.root+'/', '')}...".colorize(:light_yellow)
99
103
 
100
104
  Thread.new {
101
105
  listener = Listen.to(base) do |modified, added, removed|
@@ -108,9 +112,9 @@ module Cyborg
108
112
  end
109
113
 
110
114
  def change(modified, added, removed)
111
- puts "Added: #{file_event(added)}" unless added.empty?
112
- puts "Removed: #{file_event(removed)}" unless removed.empty?
113
- puts "Modified: #{file_event(modified)}" unless modified.empty?
115
+ puts "Added: #{file_event(added)}".colorize(:light_green) unless added.empty?
116
+ puts "Removed: #{file_event(removed)}".colorize(:light_red) unless removed.empty?
117
+ puts "Modified: #{file_event(modified)}".colorize(:light_yellow) unless modified.empty?
114
118
 
115
119
  build
116
120
  end
@@ -19,15 +19,31 @@ module Cyborg
19
19
 
20
20
  if Open3.capture3("npm ls browserify-incremental")[1].empty?
21
21
  files.each do |file|
22
- begin
23
- system build_command(file)
24
- compress(destination(file)) if Cyborg.production?
25
22
 
26
- puts build_success(file)
23
+ dest = destination(file)
27
24
 
28
- rescue => bang
25
+ FileUtils.rm dest
26
+
27
+ response = Open3.capture3(build_command(file))
28
+
29
+ if File.exist?(dest) && !File.read(dest).strip.empty?
30
+ compress(dest) if Cyborg.production?
31
+ build_success file
32
+ else
29
33
  build_failure file
30
- log_error bang
34
+
35
+ response = response.map { |l| l.to_s.split("\n") }.flatten
36
+
37
+ response.each do |line|
38
+ if !line.empty? &&
39
+ !line.match(/node_modules/i) &&
40
+ !line.match(/pid (\d+?) exit/i) &&
41
+ !line.match(/\[BABEL\] Note:/i)
42
+ log_error line.gsub(plugin.root+'/','')
43
+ end
44
+ end
45
+
46
+ puts ""
31
47
  end
32
48
  end
33
49
  else
@@ -27,9 +27,15 @@ module Cyborg
27
27
  end
28
28
 
29
29
  puts build_success(file)
30
- rescue => bang
30
+
31
+ rescue Exception => e
31
32
  build_failure file
32
- log_error bang
33
+
34
+ if e.backtrace.is_a? Array
35
+ log_error "Error in file: #{local_path(e.backtrace[0])}"
36
+ end
37
+
38
+ log_error " #{e.message}\n" if e.message
33
39
  end
34
40
  end
35
41
  end
@@ -37,9 +37,19 @@ module Cyborg
37
37
  else
38
38
  log_error "FAILED TO BUILD SVGs"
39
39
  end
40
- rescue => bang
41
- log_error "FAILED TO BUILD SVGs"
42
- log_error bang
40
+ rescue Exception => e
41
+ log_error "\nFAILED TO BUILD SVGs"
42
+
43
+ if e.backtrace && e.backtrace.is_a?(Array)
44
+ log_error "Error in file: #{local_path(e.backtrace.shift)}"
45
+
46
+ e.backtrace.each do |line|
47
+ log_error local_path(line)
48
+ end
49
+ end
50
+
51
+ log_error(" #{e.message}\n") if e.message
52
+
43
53
  end
44
54
  end
45
55
  end
@@ -1,3 +1,3 @@
1
1
  module Cyborg
2
- VERSION = "0.5.14"
2
+ VERSION = "0.5.15"
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.14
4
+ version: 0.5.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Mathis