build 1.0.0 → 1.0.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: ee861c5692f6b6afec96a8b96060141b8a36d96e
4
- data.tar.gz: 7b0ff0dc360903ede211632cd9a0e23d91949c01
3
+ metadata.gz: 0672d1e74b4a1753f505fe1caaf2f8af65d6852f
4
+ data.tar.gz: 469d82145d094b22728592dec37206a389eecb55
5
5
  SHA512:
6
- metadata.gz: bd215999b98b76f04aa2d0fc3388340c7c1d5907971315776e9953845ad06dfca29ff951ee460716356f99f22a407e3029a7e8599842fe0f44b2fac028396022
7
- data.tar.gz: 8b447b51fec6f690d596a4a86353463a679e1a0900425bb0ca059e472fd2683d83a091fa1b3b0f582e1bf5741c1b63f2e9bb6b512f7f2185febf55f4a1828e42
6
+ metadata.gz: 369f70d27a19a9d6baea48c338bab9452969cc1c74d5c358cf270b299be29a7f98e8a6212cd4c9c88e2c6310001b892216a0997814f3fd604badbccba54d65fe
7
+ data.tar.gz: 34847f234674d9327e337a92bd9e5774fea0ad628a9eb098f4c7b7aafb3facd30497d5d6ae33e43030cebd78c579c3ea89d0805d64f54c8383be8f01e69241b8
@@ -19,6 +19,7 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  require_relative 'rulebook'
22
+ require_relative 'name'
22
23
 
23
24
  require 'build/files'
24
25
  require 'build/graph'
@@ -82,6 +83,20 @@ module Build
82
83
 
83
84
  # This task class serves as the base class for the environment specific task classes genearted when adding targets.
84
85
  class Task < Graph::Task
86
+ class CommandFailure < StandardError
87
+ def initialize(task, arguments, status)
88
+ @task = task
89
+ @arguments = arguments
90
+ @status = status
91
+
92
+ super "#{@arguments.first} exited with status #{@status}"
93
+ end
94
+
95
+ attr :task
96
+ attr :arguments
97
+ attr :status
98
+ end
99
+
85
100
  def initialize(walker, node, group, logger: nil)
86
101
  super(walker, node)
87
102
 
@@ -100,7 +115,7 @@ module Build
100
115
  status = @group.spawn(*arguments)
101
116
 
102
117
  if status != 0
103
- raise CommandError.new(status)
118
+ raise CommandFailure.new(self, arguments, status)
104
119
  end
105
120
  end
106
121
  end
data/lib/build/logger.rb CHANGED
@@ -41,18 +41,24 @@ module Build
41
41
  end
42
42
  end
43
43
 
44
- def format_command(args)
45
- options = Hash === args.last ? args.pop : {}
46
- args = args.flatten.collect &:to_s
44
+ def format_command(arguments)
45
+ if arguments.last.is_a? Hash
46
+ options = arguments.last
47
+ arguments = arguments[0...-1]
48
+ else
49
+ options = {}
50
+ end
51
+
52
+ arguments = arguments.flatten.collect &:to_s
47
53
 
48
- Rainbow(args.join(' ')).blue + chdir_string(options)
54
+ Rainbow(arguments.join(' ')).blue + chdir_string(options)
49
55
  end
50
56
 
51
- def call(severity, datetime, progname, msg)
52
- if progname == 'shell' and Array === msg
53
- "#{time_offset_string}: #{format_command(msg)}\n"
57
+ def call(severity, datetime, progname, message)
58
+ if progname == 'shell' and Array === message
59
+ "#{time_offset_string}: #{format_command(message)}\n"
54
60
  else
55
- "#{time_offset_string}: #{msg}\n"
61
+ "#{time_offset_string}: #{message}\n"
56
62
  end
57
63
  end
58
64
  end
data/lib/build/version.rb CHANGED
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Build
22
- VERSION = "1.0.0"
22
+ VERSION = "1.0.1"
23
23
  end
@@ -1,3 +1,5 @@
1
+ #!/usr/bin/env rspec
2
+
1
3
  # Copyright, 2015, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
4
  #
3
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -38,6 +40,30 @@ module Build::ControllerSpec
38
40
  end
39
41
 
40
42
  describe Build::Controller do
43
+ it "should fail with exception" do
44
+ environment = Build::Environment.new do
45
+ define Build::Rule, "make.file" do
46
+ output :destination
47
+
48
+ apply do |parameters|
49
+ run "exit -1"
50
+ end
51
+ end
52
+ end
53
+
54
+ target = Target.new('fail')
55
+ target.build do
56
+ foo_path = Build::Files::Path['foo']
57
+ make destination: foo_path
58
+ end
59
+
60
+ controller = Build::Controller.new do |controller|
61
+ controller.add_target(target, environment)
62
+ end
63
+
64
+ expect{controller.update}.to raise_error(Build::Task::CommandFailure)
65
+ end
66
+
41
67
  it "should execute the build graph" do
42
68
  environment = Build::Environment.new do
43
69
  define Build::Rule, "make.file" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: build
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-28 00:00:00.000000000 Z
11
+ date: 2015-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: build-graph