fudge 0.3.8 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 47962ba246a2c124052d46a96a4f84b23cf4c4c7
4
+ data.tar.gz: 0f26cd2e11eabe39d93d447da4b3edcce29f56b3
5
+ SHA512:
6
+ metadata.gz: dfdac055c9af71a47c427d6f136c0aff6bc107e5dc9aadfcc9f1dbc8a0516a4a6bb6336e6565ed7bc98acfb006c964a7ecc59a1bed522839974fd22384debdc4
7
+ data.tar.gz: 3d46ce43acd4ce7d1e74bfc8439b63551e7f73c9128179a92aa387605728e4a23542ab0426ec30639c2f8198b4db33787096faff585ecabb82f8dd22156ba465
@@ -1,4 +1,3 @@
1
- require 'rainbow'
2
1
  require 'active_support/all'
3
2
 
4
3
  #This will fix errors: invalid byte sequence in US-ASCII (ArgumentError) when UTF-8 chars get
@@ -18,7 +17,8 @@ module Fudge
18
17
  autoload :Tasks, 'fudge/tasks'
19
18
  autoload :TaskDSL, 'fudge/task_dsl'
20
19
  autoload :WithDirectory, 'fudge/with_directory'
21
- autoload :OutputChecker, 'fudge/output_checker.rb'
22
- autoload :FileFinder, 'fudge/file_finder.rb'
20
+ autoload :OutputChecker, 'fudge/output_checker'
21
+ autoload :FileFinder, 'fudge/file_finder'
22
+ autoload :Formatters, 'fudge/formatters'
23
23
  end
24
24
 
@@ -12,18 +12,19 @@ module Fudge
12
12
  super
13
13
  end
14
14
 
15
+ # Run task
15
16
  def run(options={})
16
- output = options[:output] || $stdout
17
+ formatter = options[:formatter] || Fudge::Formatters::Simple.new
17
18
  success = super
18
19
  if callbacks
19
- message "Running #{success ? 'success' : 'failure'} callbacks...", output
20
+ message "Running #{success ? 'success' : 'failure'} callbacks...", formatter
20
21
  hooks = success ? @success_hooks : @failure_hooks
21
22
 
22
23
  hooks.each do |hook|
23
- return false unless hook.run :output => output
24
+ return false unless hook.run :formatter => formatter
24
25
  end
25
26
  else
26
- message "Skipping callbacks...", output
27
+ message "Skipping callbacks...", formatter
27
28
  end
28
29
 
29
30
  success
@@ -31,8 +32,8 @@ module Fudge
31
32
 
32
33
  private
33
34
 
34
- def message(message, output)
35
- output.puts message.foreground(:cyan).bright
35
+ def message(message, formatter)
36
+ formatter.write { |w| w.info(message) }
36
37
  end
37
38
  end
38
39
  end
@@ -8,7 +8,7 @@ module Fudge
8
8
  class BuildFailed < Base
9
9
  # error message
10
10
  def message
11
- "Build FAILED!".foreground(:red).bright
11
+ "Build FAILED!"
12
12
  end
13
13
  end
14
14
 
@@ -0,0 +1,6 @@
1
+ module Fudge
2
+ #Output formatting Handlers
3
+ module Formatters
4
+ autoload :Simple, 'fudge/formatters/simple'
5
+ end
6
+ end
@@ -0,0 +1,106 @@
1
+ module Fudge
2
+ module Formatters
3
+ # Simple coloured STDOUT/STDERR formatting
4
+ class Simple
5
+
6
+ # ASCII Color Codes
7
+ CODE = {
8
+ :off => 0,
9
+ :bright => 1,
10
+ :red => 31,
11
+ :green => 32,
12
+ :yellow => 33,
13
+ :cyan => 36
14
+ }
15
+
16
+ # Internal wrapper for output
17
+ class Writer
18
+ def initialize(formatter)
19
+ @parts = []
20
+ @formatter = formatter
21
+ end
22
+
23
+ # Writes the final message
24
+ def write(out)
25
+ out.puts @parts.join(' ')
26
+ end
27
+
28
+ # Determines which formatter methods to make available
29
+ def self.wrap(*methods)
30
+ methods.each do |m|
31
+ class_eval <<-RUBY
32
+ def #{m}(message)
33
+ @parts << @formatter.#{m}(message)
34
+ self
35
+ end
36
+ RUBY
37
+ end
38
+ end
39
+
40
+ wrap :normal, :notice, :info, :success, :error
41
+
42
+ end
43
+
44
+ attr_reader :stdout
45
+
46
+ def initialize(stdout=$stdout)
47
+ @stdout = stdout
48
+ end
49
+
50
+ # Report Error Message
51
+ def error(message)
52
+ ascii :red, message
53
+ end
54
+
55
+ # Report Success Message
56
+ def success(message)
57
+ ascii :bright, :green, message
58
+ end
59
+
60
+ # Report Information Message
61
+ def info(message)
62
+ ascii :cyan, message
63
+ end
64
+
65
+ # Report Notice Message
66
+ def notice(message)
67
+ ascii :yellow, message
68
+ end
69
+
70
+ # Normal information
71
+ def normal(message)
72
+ message
73
+ end
74
+
75
+ # Directly output
76
+ def puts(message)
77
+ stdout.puts message
78
+ end
79
+
80
+ # Yields a writer which can chain message types to output
81
+ def write
82
+ w = Writer.new(self)
83
+ yield w
84
+ w.write(stdout)
85
+ end
86
+
87
+ # Output a character
88
+ def putc(c)
89
+ stdout.putc(c)
90
+ end
91
+
92
+ private
93
+
94
+ def ascii(*args)
95
+ txt = args.pop
96
+ codes = args.map { |a| coded(a) }
97
+ codes << txt << coded(:off)
98
+ codes.join ''
99
+ end
100
+
101
+ def coded(code)
102
+ "\e[#{CODE[code]}m"
103
+ end
104
+ end
105
+ end
106
+ end
@@ -1,10 +1,10 @@
1
1
  #Task Output Checker
2
2
  class Fudge::OutputChecker
3
- attr_reader :checker, :regex, :pass_block, :match, :output_io
3
+ attr_reader :checker, :regex, :pass_block, :match, :formatter
4
4
 
5
- def initialize(checker, output_io)
5
+ def initialize(checker, formatter)
6
6
  @checker = checker
7
- @output_io = output_io
7
+ @formatter = formatter
8
8
  end
9
9
 
10
10
  #Validates output against initialized checker
@@ -24,7 +24,7 @@ class Fudge::OutputChecker
24
24
  if success?(result)
25
25
  true
26
26
  else
27
- output_io.puts error_message(result)
27
+ formatter.write {|w| w.error(error_message(result)) }
28
28
  end
29
29
  end
30
30
 
@@ -48,7 +48,7 @@ class Fudge::OutputChecker
48
48
  def matches?(output)
49
49
  # Do regex match and fail if no match
50
50
  return true if (@match = output.match(regex))
51
- output_io.puts "Output didn't match #{regex}."
51
+ formatter.write { |w| w.error( "Output didn't match #{regex}.") }
52
52
  end
53
53
 
54
54
  end
@@ -13,7 +13,7 @@ module FudgeMatchers
13
13
  def initialize(expected, args={})
14
14
  @expected = expected
15
15
  @args = args
16
- @args[:output] ||= $stdout
16
+ @args[:formatter] ||= Fudge::Formatters::Simple.new
17
17
  end
18
18
 
19
19
  def matches?(task)
@@ -27,8 +27,8 @@ module FudgeMatchers
27
27
  Fudge::Tasks::Shell.any_instance
28
28
  end
29
29
 
30
- to_stub.stub(:run_command) do |cmd, outputio|
31
- raise "Run Command requires an output IOStream" unless outputio
30
+ to_stub.stub(:run_command) do |cmd, formatter|
31
+ raise "Run Command requires a formatter" unless formatter
32
32
  ran.push(cmd)
33
33
  ['dummy output', true]
34
34
  end
@@ -9,30 +9,30 @@ module Fudge
9
9
  #
10
10
  # @param [String] which_build Defaults to 'default'
11
11
  def run_build(which_build='default', options={})
12
- output = options[:output] || $stdout
13
- output_start(which_build, output)
12
+ formatter = options[:formatter] || Fudge::Formatters::Simple.new
13
+ output_start(which_build, formatter)
14
14
  status = run(which_build, options)
15
- output_status(status, output)
15
+ output_status(status, formatter)
16
16
  end
17
17
 
18
18
  private
19
19
 
20
- def output_start(which, output)
20
+ def output_start(which, formatter)
21
21
  which_build = String.new(which)
22
- output.puts %Q(#{'Running build'.foreground(:cyan)} #{which_build.bright.foreground(:yellow)})
22
+ formatter.write { |w| w.info('Running build').notice(which_build) }
23
23
  end
24
24
 
25
25
  def run(which, options)
26
26
  # Run the build
27
27
  build = @description.builds[which.to_sym]
28
28
  build.callbacks = options[:callbacks]
29
- build.run :output => options[:output]
29
+ build.run :formatter => options[:formatter]
30
30
  end
31
31
 
32
- def output_status(success, output)
32
+ def output_status(success, formatter)
33
33
  # Output status
34
34
  if success
35
- output.puts "Build SUCCEEDED!".foreground(:green).bright
35
+ formatter.write { |w| w.success('Build SUCCEEDED!') }
36
36
  else
37
37
  raise Exceptions::BuildFailed
38
38
  end
@@ -2,6 +2,7 @@ module Fudge
2
2
  module Tasks
3
3
  # Provides a sanitized running environment for Bundler
4
4
  class CleanBundlerEnv < CompositeTask
5
+ # Run task
5
6
  def run(options={})
6
7
  Bundler.with_clean_env do
7
8
  super(options.merge(:bundler => true))
@@ -11,10 +11,10 @@ module Fudge
11
11
 
12
12
  # Runs the task (by default running all other tasks in order)
13
13
  def run(options={})
14
- output = options[:output] || $stdout
14
+ formatter = options[:formatter] || Fudge::Formatters::Simple.new
15
15
  tasks.each do |t|
16
16
  apply_directory_settings(t)
17
- output_message(t, output)
17
+ output_message(t, formatter)
18
18
  return unless t.run(options)
19
19
  end
20
20
  end
@@ -42,27 +42,20 @@ module Fudge
42
42
  {}
43
43
  end
44
44
 
45
- def join_arguments(t)
46
- t.respond_to?(:args) && t.args ? t.args.join(', ') : ''
47
- end
48
-
49
- def output_message(t, output)
50
- message = "#{running_coloured} #{task_name_coloured(t)} #{args_coloured(t)}"
51
- output.puts message
45
+ def task_name(t)
46
+ t.class.name.to_s
52
47
  end
53
48
 
54
- def running_coloured
55
- "Running task".foreground(:blue)
49
+ def args_s(t)
50
+ t.respond_to?(:args) && t.args ? t.args.join(', ') : ''
56
51
  end
57
52
 
58
- def task_name_coloured(t)
59
- t.class.name.to_s.foreground(:yellow).bright
53
+ def output_message(t, formatter)
54
+ formatter.write do |w|
55
+ w.info("Running task").notice(task_name(t)).notice(args_s(t))
56
+ end
60
57
  end
61
58
 
62
- def args_coloured(t)
63
- args_text = join_arguments(t)
64
- args_text.foreground(:yellow).bright
65
- end
66
59
  end
67
60
  end
68
61
  end
@@ -11,11 +11,12 @@ module Fudge
11
11
  @pattern = pattern
12
12
  end
13
13
 
14
+ # Run task
14
15
  def run(options={})
15
- output = options[:output] || $stdout
16
+ formatter = options[:formatter] || Fudge::Formatters::Simple.new
16
17
  directories.all? do |dir|
17
18
  skip_directory?(dir) ||
18
- WithDirectory.new(dir, output).inside do
19
+ WithDirectory.new(dir, formatter).inside do
19
20
  super
20
21
  end
21
22
  end
@@ -66,11 +66,15 @@ module Fudge
66
66
  end
67
67
 
68
68
  def extract_scores(matches)
69
- values = extract_lines(matches).take(3).map(&:first)
69
+ values = top_3_lines(matches)
70
70
  total, average, max = values.map(&:to_f)
71
71
  [average, (max || 0.0), total]
72
72
  end
73
73
 
74
+ def top_3_lines(matches)
75
+ extract_lines(matches).take(3).map(&:first)
76
+ end
77
+
74
78
  def extract_lines(matches)
75
79
  output = matches.string
76
80
  output.scan(check_regex)
@@ -9,9 +9,10 @@ module Fudge
9
9
  @directory = directory
10
10
  end
11
11
 
12
+ # Run task
12
13
  def run(options={})
13
- output = options[:output] || $stdout
14
- WithDirectory.new(@directory, output).inside do
14
+ formatter = options[:formatter] || Fudge::Formatters::Simple.new
15
+ WithDirectory.new(@directory, formatter).inside do
15
16
  super
16
17
  end
17
18
  end
@@ -12,30 +12,30 @@ module Fudge
12
12
  #
13
13
  # @param [Hash] options Any options to pass to the shell
14
14
  def run(options={})
15
- output_io = options[:output] || $stdout
16
- @output, success = run_command(cmd(options), output_io)
15
+ formatter = options[:formatter] || Fudge::Formatters::Simple.new
16
+ @output, success = run_command(cmd(options), formatter)
17
17
 
18
18
  return false unless success
19
- return check_for_output(output_io)
19
+ return check_for_output(formatter)
20
20
  end
21
21
 
22
22
  private
23
23
 
24
- def run_command(cmd, output_io)
24
+ def run_command(cmd, formatter)
25
25
  output = ''
26
26
  IO.popen(cmd) do |f|
27
27
  until f.eof?
28
28
  bit = f.getc
29
29
  output << bit
30
- output_io.putc bit
30
+ formatter.putc bit
31
31
  end
32
32
  end
33
33
 
34
34
  [output, $?.success?]
35
35
  end
36
36
 
37
- def check_for_output(output_io)
38
- checker = OutputChecker.new(check_for, output_io)
37
+ def check_for_output(formatter)
38
+ checker = OutputChecker.new(check_for, formatter)
39
39
  checker.check(@output)
40
40
  end
41
41
 
@@ -1,4 +1,4 @@
1
1
  module Fudge
2
2
  # Define gem version
3
- VERSION = '0.3.8'
3
+ VERSION = '0.4.0'
4
4
  end
@@ -1,10 +1,10 @@
1
1
  #Directory helpers methods
2
2
  class Fudge::WithDirectory
3
- attr_reader :dir, :output
3
+ attr_reader :dir, :formatter
4
4
 
5
- def initialize(dir, output)
5
+ def initialize(dir, formatter)
6
6
  @dir = dir
7
- @output = output
7
+ @formatter = formatter
8
8
  end
9
9
 
10
10
  # Executes a block inside the directory
@@ -18,7 +18,6 @@ class Fudge::WithDirectory
18
18
  private
19
19
 
20
20
  def output_message
21
- message = %Q(#{'--> In directory'.foreground(:cyan)} #{"#{dir}:".foreground(:cyan).bright})
22
- output.puts message
21
+ formatter.write { |w| w.info('--> In directory').notice(dir) }
23
22
  end
24
23
  end
@@ -6,13 +6,14 @@ describe Fudge::Build do
6
6
  describe "#run" do
7
7
 
8
8
  context "when provided an output" do
9
- let(:output) { StringIO.new }
9
+ let(:stdout) { StringIO.new }
10
+ let(:formatter) { Fudge::Formatters::Simple.new(stdout) }
10
11
 
11
- it "prints messages to the output instead of stdout" do
12
- subject.run :output => output
12
+ it "prints messages to the formatter instead of default" do
13
+ subject.run :formatter => formatter
13
14
 
14
- output.string.should_not be_empty
15
- output.string.should include "Skipping callbacks..."
15
+ stdout.string.should_not be_empty
16
+ stdout.string.should include "Skipping callbacks..."
16
17
  end
17
18
 
18
19
  context "when there are callback hooks" do
@@ -23,9 +24,9 @@ describe Fudge::Build do
23
24
  subject.success_hooks << hook
24
25
  end
25
26
 
26
- it "passes output down to the hook run" do
27
- hook.should_receive(:run).with(:output => output).and_return(true)
28
- subject.run :output => output
27
+ it "passesformatter down to the hook run" do
28
+ hook.should_receive(:run).with(:formatter =>formatter).and_return(true)
29
+ subject.run :formatter => formatter
29
30
  end
30
31
  end
31
32
  end
@@ -0,0 +1,68 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fudge::Formatters::Simple do
4
+ let(:stdout) { StringIO.new }
5
+
6
+ subject { described_class.new(stdout) }
7
+
8
+ describe :error do
9
+ it "returns message in RED" do
10
+ string = subject.error "a message"
11
+ string.should == "\e[31ma message\e[0m"
12
+ end
13
+ end
14
+
15
+ describe :success do
16
+ it "returns message in BRIGHT GREEN" do
17
+ string = subject.success "a message"
18
+ string.should == "\e[1m\e[32ma message\e[0m"
19
+ end
20
+ end
21
+
22
+ describe :info do
23
+ it "returns message in CYAN" do
24
+ string = subject.info "a message"
25
+ string.should == "\e[36ma message\e[0m"
26
+ end
27
+ end
28
+
29
+ describe :notice do
30
+ it "returns message in YELLOW" do
31
+ string = subject.notice "a message"
32
+ string.should == "\e[33ma message\e[0m"
33
+ end
34
+ end
35
+
36
+ describe :normal do
37
+ it "returns unchanged message" do
38
+ string = subject.normal "a message"
39
+ string.should == "a message"
40
+ end
41
+ end
42
+
43
+ describe :puts do
44
+ it "outputs message on stdout" do
45
+ subject.puts "a message"
46
+ stdout.string.should == "a message" + "\n"
47
+ end
48
+ end
49
+
50
+ describe :write do
51
+ it "supports chaining types to stdout" do
52
+ subject.write do |w|
53
+ w.normal('normal').
54
+ notice('notice').
55
+ info('info').
56
+ success('success').
57
+ error('error')
58
+ end
59
+
60
+ stdout.string.should == 'normal' + ' ' +
61
+ "\e[33mnotice\e[0m" + ' ' +
62
+ "\e[36minfo\e[0m" + ' ' +
63
+ "\e[1m\e[32msuccess\e[0m" + ' ' +
64
+ "\e[31merror\e[0m" + "\n"
65
+
66
+ end
67
+ end
68
+ end
@@ -1,10 +1,11 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Fudge::OutputChecker do
4
- let (:output_io) { StringIO.new }
4
+ let(:output_io) { StringIO.new }
5
+ let(:formatter) { Fudge::Formatters::Simple.new(output_io) }
5
6
 
6
7
  describe "#check" do
7
- subject { described_class.new /foo/, output_io }
8
+ subject { described_class.new(/foo/, formatter) }
8
9
 
9
10
  context "when the output does not match the check" do
10
11
  it 'send a mismatch message to the output io' do
@@ -19,7 +20,7 @@ describe Fudge::OutputChecker do
19
20
  false
20
21
  end
21
22
  end
22
- subject { described_class.new [/foo/, callable], output_io }
23
+ subject { described_class.new [/foo/, callable], formatter }
23
24
 
24
25
  it 'sends error mesage to the output io' do
25
26
  subject.check('foo')
@@ -22,22 +22,23 @@ describe Fudge::Runner do
22
22
  expect { subject.run_build }.to raise_error Fudge::Exceptions::BuildFailed
23
23
  end
24
24
 
25
- context "when an output is provided" do
26
- let(:output) { StringIO.new }
25
+ context "when an formatter is provided" do
26
+ let(:stdout) { StringIO.new }
27
+ let(:formatter) { Fudge::Formatters::Simple.new(stdout) }
27
28
 
28
29
  before :each do
29
- subject.run_build 'default', :output => output
30
+ subject.run_build 'default', :formatter => formatter
30
31
  end
31
32
 
32
- it "puts all output to given output instead stdout" do
33
- output.string.should_not be_empty
34
- output.string.should include "Running build"
35
- output.string.should include "default"
36
- output.string.should include "Build SUCCEEDED!"
33
+ it "puts all output to given formatter instead stdout" do
34
+ stdout.string.should_not be_empty
35
+ stdout.string.should include "Running build"
36
+ stdout.string.should include "default"
37
+ stdout.string.should include "Build SUCCEEDED!"
37
38
  end
38
39
 
39
- it "runs the task passing the output down" do
40
- DummyTask.run_options.should == {:output => output}
40
+ it "runs the task passing the formatter down" do
41
+ DummyTask.run_options.should == {:formatter => formatter}
41
42
  end
42
43
  end
43
44
  end
@@ -58,13 +58,14 @@ describe Fudge::Tasks::CompositeTask do
58
58
 
59
59
  context "when provided an output" do
60
60
  let(:output) { StringIO.new }
61
+ let(:formatter) { Fudge::Formatters::Simple.new(output) }
61
62
 
62
63
  before :each do
63
64
  Fudge::Tasks::Shell.any_instance.stub(:run)
64
65
  end
65
66
 
66
67
  it "prints messages to the output instead of stdout" do
67
- subject.run :output => output
68
+ subject.run :formatter => formatter
68
69
 
69
70
  output.string.should_not be_empty
70
71
  output.string.should match /Running task.*shell.*foo, bar/
@@ -18,23 +18,24 @@ describe Fudge::Tasks::Shell do
18
18
  described_class.new(:ls).run.should be_true
19
19
  end
20
20
 
21
- context "when there is an output passed to run" do
21
+ context "when there is an formatter passed to run" do
22
22
 
23
23
  let(:output) { StringIO.new }
24
+ let(:formatter) { Fudge::Formatters::Simple.new(output) }
24
25
  subject { described_class.new('echo foo') }
25
26
 
26
- it "prints messages to the output instead of stdout" do
27
+ it "prints messages to the formatter instead of default" do
27
28
 
28
- subject.run :output => output
29
+ subject.run :formatter => formatter
29
30
 
30
31
  output.string.should_not be_empty
31
32
  output.string.should include "foo"
32
33
  end
33
34
 
34
- it 'uses the output stream when reporting checks on build result' do
35
+ it 'uses the formatter when reporting checks on build result' do
35
36
  checker = double.as_null_object
36
- Fudge::OutputChecker.should_receive(:new).with(anything, output) { checker }
37
- subject.run :output => output
37
+ Fudge::OutputChecker.should_receive(:new).with(anything, formatter) { checker }
38
+ subject.run :formatter => formatter
38
39
  end
39
40
 
40
41
  end
@@ -3,6 +3,7 @@ require 'spec_helper'
3
3
 
4
4
  describe Fudge::Tasks::SubProcess do
5
5
  let(:output) { StringIO.new }
6
+ let(:formatter) { Fudge::Formatters::Simple.new(output) }
6
7
 
7
8
  describe :run do
8
9
  it "takes a command and runs it" do
@@ -26,7 +27,7 @@ describe Fudge::Tasks::SubProcess do
26
27
  it "passes the variables to the sub-process" do
27
28
  process = described_class.new(%(ruby -e "puts ENV['PATH'];puts ENV['FOO']"), environment: { 'FOO' => 'bar' })
28
29
 
29
- process.run(output: output)
30
+ process.run(formatter: formatter)
30
31
 
31
32
  expect(output.string).to eq "#{ENV['PATH']}\nbar\n"
32
33
  end
@@ -36,7 +37,7 @@ describe Fudge::Tasks::SubProcess do
36
37
  it "passes the variables to the sub-process" do
37
38
  process = described_class.new(%(ruby -e "puts ENV['PATH'];puts ENV['FOO']"))
38
39
 
39
- process.run(output: output, environment: { 'FOO' => 'bar' })
40
+ process.run(formatter: formatter, environment: { 'FOO' => 'bar' })
40
41
 
41
42
  expect(output.string).to eq "#{ENV['PATH']}\nbar\n"
42
43
  end
@@ -47,7 +48,7 @@ describe Fudge::Tasks::SubProcess do
47
48
  process = described_class.new(%(ruby -e "puts ENV['FOO'];puts ENV['BAZ']"),
48
49
  environment: { 'FOO' => 'bar', 'BAZ' => 'quux' })
49
50
 
50
- process.run(output: output, environment: { 'FOO' => 'codfanglers' })
51
+ process.run(formatter: formatter, environment: { 'FOO' => 'codfanglers' })
51
52
 
52
53
  expect(output.string).to eq "codfanglers\nquux\n"
53
54
  end
@@ -58,7 +59,7 @@ describe Fudge::Tasks::SubProcess do
58
59
  it "does not make that variable available to the sub-process" do
59
60
  process = described_class.new(%(ruby -e "puts ENV['FOO']"))
60
61
 
61
- process.run(output: output)
62
+ process.run(formatter: formatter)
62
63
 
63
64
  expect(output.string).to eq "\n"
64
65
  end
@@ -71,7 +72,7 @@ describe Fudge::Tasks::SubProcess do
71
72
  environment: { 'FOO' => 'bar' },
72
73
  spawn_options: { unsetenv_others: true }) # Should clear environment variables
73
74
 
74
- process.run(output: output)
75
+ process.run(formatter: formatter)
75
76
 
76
77
  expect(output.string).to match /\A(nil)?\nbar\n\z/
77
78
  end
@@ -82,7 +83,7 @@ describe Fudge::Tasks::SubProcess do
82
83
  process = described_class.new(%(ruby -e "puts ENV['PATH'];puts ENV['FOO']"),
83
84
  environment: { 'FOO' => 'bar' })
84
85
 
85
- process.run(output: output, spawn_options: { unsetenv_others: true })
86
+ process.run(formatter: formatter, spawn_options: { unsetenv_others: true })
86
87
 
87
88
  expect(output.string).to match /\A(nil)?\nbar\n\z/
88
89
  end
@@ -94,7 +95,7 @@ describe Fudge::Tasks::SubProcess do
94
95
  environment: { 'FOO' => 'bar' },
95
96
  spawn_options: { unsetenv_others: true }) # Clear environment variables
96
97
 
97
- process.run(output: output, spawn_options: { unsetenv_others: false }) # Actually, don't!
98
+ process.run(formatter: formatter, spawn_options: { unsetenv_others: false }) # Actually, don't!
98
99
 
99
100
  expect(output.string).to eq "#{ENV['PATH']}\nbar\n"
100
101
  end
@@ -2,8 +2,9 @@ require 'spec_helper'
2
2
 
3
3
  describe Fudge::WithDirectory do
4
4
  let(:output) { StringIO.new }
5
+ let(:formatter) { Fudge::Formatters::Simple.new(output) }
5
6
 
6
- subject { described_class.new '/some/dir', output }
7
+ subject { described_class.new '/some/dir', formatter }
7
8
 
8
9
  describe "#inside" do
9
10
  it "outputs the directory change, yielding the block" do
metadata CHANGED
@@ -1,318 +1,265 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fudge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.8
5
- prerelease:
4
+ version: 0.4.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Sage One team
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-03-13 00:00:00.000000000 Z
11
+ date: 2014-03-23 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: thor
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
- - !ruby/object:Gem::Dependency
31
- name: rainbow
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - ~>
36
- - !ruby/object:Gem::Version
37
- version: 1.1.4
38
- type: :runtime
39
- prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ~>
44
- - !ruby/object:Gem::Version
45
- version: 1.1.4
46
27
  - !ruby/object:Gem::Dependency
47
28
  name: activesupport
48
29
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
30
  requirements:
51
- - - ! '>='
31
+ - - ">="
52
32
  - !ruby/object:Gem::Version
53
33
  version: '0'
54
34
  type: :runtime
55
35
  prerelease: false
56
36
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
37
  requirements:
59
- - - ! '>='
38
+ - - ">="
60
39
  - !ruby/object:Gem::Version
61
40
  version: '0'
62
41
  - !ruby/object:Gem::Dependency
63
42
  name: json
64
43
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
44
  requirements:
67
- - - ~>
45
+ - - ">="
68
46
  - !ruby/object:Gem::Version
69
- version: 1.8.0
47
+ version: '0'
70
48
  type: :runtime
71
49
  prerelease: false
72
50
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
51
  requirements:
75
- - - ~>
52
+ - - ">="
76
53
  - !ruby/object:Gem::Version
77
- version: 1.8.0
54
+ version: '0'
78
55
  - !ruby/object:Gem::Dependency
79
56
  name: redcarpet
80
57
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
58
  requirements:
83
- - - ! '>='
59
+ - - ">="
84
60
  - !ruby/object:Gem::Version
85
61
  version: '0'
86
62
  type: :development
87
63
  prerelease: false
88
64
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
65
  requirements:
91
- - - ! '>='
66
+ - - ">="
92
67
  - !ruby/object:Gem::Version
93
68
  version: '0'
94
69
  - !ruby/object:Gem::Dependency
95
70
  name: rspec
96
71
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
72
  requirements:
99
- - - ! '>='
73
+ - - ">="
100
74
  - !ruby/object:Gem::Version
101
75
  version: 2.8.0
102
76
  type: :development
103
77
  prerelease: false
104
78
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
79
  requirements:
107
- - - ! '>='
80
+ - - ">="
108
81
  - !ruby/object:Gem::Version
109
82
  version: 2.8.0
110
83
  - !ruby/object:Gem::Dependency
111
84
  name: guard-rspec
112
85
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
86
  requirements:
115
- - - ! '>='
87
+ - - ">="
116
88
  - !ruby/object:Gem::Version
117
89
  version: '0'
118
90
  type: :development
119
91
  prerelease: false
120
92
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
93
  requirements:
123
- - - ! '>='
94
+ - - ">="
124
95
  - !ruby/object:Gem::Version
125
96
  version: '0'
126
97
  - !ruby/object:Gem::Dependency
127
98
  name: rb-fsevent
128
99
  requirement: !ruby/object:Gem::Requirement
129
- none: false
130
100
  requirements:
131
- - - ! '>='
101
+ - - ">="
132
102
  - !ruby/object:Gem::Version
133
103
  version: '0'
134
104
  type: :development
135
105
  prerelease: false
136
106
  version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
107
  requirements:
139
- - - ! '>='
108
+ - - ">="
140
109
  - !ruby/object:Gem::Version
141
110
  version: '0'
142
111
  - !ruby/object:Gem::Dependency
143
112
  name: yard
144
113
  requirement: !ruby/object:Gem::Requirement
145
- none: false
146
114
  requirements:
147
- - - ! '>='
115
+ - - ">="
148
116
  - !ruby/object:Gem::Version
149
117
  version: '0'
150
118
  type: :development
151
119
  prerelease: false
152
120
  version_requirements: !ruby/object:Gem::Requirement
153
- none: false
154
121
  requirements:
155
- - - ! '>='
122
+ - - ">="
156
123
  - !ruby/object:Gem::Version
157
124
  version: '0'
158
125
  - !ruby/object:Gem::Dependency
159
126
  name: cane
160
127
  requirement: !ruby/object:Gem::Requirement
161
- none: false
162
128
  requirements:
163
- - - ! '>='
129
+ - - ">="
164
130
  - !ruby/object:Gem::Version
165
131
  version: '0'
166
132
  type: :development
167
133
  prerelease: false
168
134
  version_requirements: !ruby/object:Gem::Requirement
169
- none: false
170
135
  requirements:
171
- - - ! '>='
136
+ - - ">="
172
137
  - !ruby/object:Gem::Version
173
138
  version: '0'
174
139
  - !ruby/object:Gem::Dependency
175
140
  name: flog
176
141
  requirement: !ruby/object:Gem::Requirement
177
- none: false
178
142
  requirements:
179
- - - ! '>='
143
+ - - ">="
180
144
  - !ruby/object:Gem::Version
181
145
  version: '0'
182
146
  type: :development
183
147
  prerelease: false
184
148
  version_requirements: !ruby/object:Gem::Requirement
185
- none: false
186
149
  requirements:
187
- - - ! '>='
150
+ - - ">="
188
151
  - !ruby/object:Gem::Version
189
152
  version: '0'
190
153
  - !ruby/object:Gem::Dependency
191
154
  name: flay
192
155
  requirement: !ruby/object:Gem::Requirement
193
- none: false
194
156
  requirements:
195
- - - ! '>='
157
+ - - ">="
196
158
  - !ruby/object:Gem::Version
197
159
  version: '0'
198
160
  type: :development
199
161
  prerelease: false
200
162
  version_requirements: !ruby/object:Gem::Requirement
201
- none: false
202
163
  requirements:
203
- - - ! '>='
164
+ - - ">="
204
165
  - !ruby/object:Gem::Version
205
166
  version: '0'
206
167
  - !ruby/object:Gem::Dependency
207
168
  name: ruby2ruby
208
169
  requirement: !ruby/object:Gem::Requirement
209
- none: false
210
170
  requirements:
211
- - - ! '>='
171
+ - - ">="
212
172
  - !ruby/object:Gem::Version
213
173
  version: '0'
214
174
  type: :development
215
175
  prerelease: false
216
176
  version_requirements: !ruby/object:Gem::Requirement
217
- none: false
218
177
  requirements:
219
- - - ! '>='
178
+ - - ">="
220
179
  - !ruby/object:Gem::Version
221
180
  version: '0'
222
181
  - !ruby/object:Gem::Dependency
223
182
  name: RedCloth
224
183
  requirement: !ruby/object:Gem::Requirement
225
- none: false
226
184
  requirements:
227
- - - ! '>='
185
+ - - ">="
228
186
  - !ruby/object:Gem::Version
229
187
  version: '0'
230
188
  type: :development
231
189
  prerelease: false
232
190
  version_requirements: !ruby/object:Gem::Requirement
233
- none: false
234
191
  requirements:
235
- - - ! '>='
192
+ - - ">="
236
193
  - !ruby/object:Gem::Version
237
194
  version: '0'
238
195
  - !ruby/object:Gem::Dependency
239
196
  name: simplecov
240
197
  requirement: !ruby/object:Gem::Requirement
241
- none: false
242
198
  requirements:
243
- - - ! '>='
199
+ - - ">="
244
200
  - !ruby/object:Gem::Version
245
201
  version: '0'
246
202
  type: :development
247
203
  prerelease: false
248
204
  version_requirements: !ruby/object:Gem::Requirement
249
- none: false
250
205
  requirements:
251
- - - ! '>='
206
+ - - ">="
252
207
  - !ruby/object:Gem::Version
253
208
  version: '0'
254
209
  - !ruby/object:Gem::Dependency
255
210
  name: rb-inotify
256
211
  requirement: !ruby/object:Gem::Requirement
257
- none: false
258
212
  requirements:
259
- - - ! '>='
213
+ - - ">="
260
214
  - !ruby/object:Gem::Version
261
215
  version: '0'
262
216
  type: :development
263
217
  prerelease: false
264
218
  version_requirements: !ruby/object:Gem::Requirement
265
- none: false
266
219
  requirements:
267
- - - ! '>='
220
+ - - ">="
268
221
  - !ruby/object:Gem::Version
269
222
  version: '0'
270
223
  - !ruby/object:Gem::Dependency
271
224
  name: libnotify
272
225
  requirement: !ruby/object:Gem::Requirement
273
- none: false
274
226
  requirements:
275
- - - ! '>='
227
+ - - ">="
276
228
  - !ruby/object:Gem::Version
277
229
  version: '0'
278
230
  type: :development
279
231
  prerelease: false
280
232
  version_requirements: !ruby/object:Gem::Requirement
281
- none: false
282
233
  requirements:
283
- - - ! '>='
234
+ - - ">="
284
235
  - !ruby/object:Gem::Version
285
236
  version: '0'
286
237
  - !ruby/object:Gem::Dependency
287
238
  name: pry
288
239
  requirement: !ruby/object:Gem::Requirement
289
- none: false
290
240
  requirements:
291
- - - ! '>='
241
+ - - ">="
292
242
  - !ruby/object:Gem::Version
293
243
  version: '0'
294
244
  type: :development
295
245
  prerelease: false
296
246
  version_requirements: !ruby/object:Gem::Requirement
297
- none: false
298
247
  requirements:
299
- - - ! '>='
248
+ - - ">="
300
249
  - !ruby/object:Gem::Version
301
250
  version: '0'
302
251
  - !ruby/object:Gem::Dependency
303
252
  name: rake
304
253
  requirement: !ruby/object:Gem::Requirement
305
- none: false
306
254
  requirements:
307
- - - ! '>='
255
+ - - ">="
308
256
  - !ruby/object:Gem::Version
309
257
  version: '0'
310
258
  type: :development
311
259
  prerelease: false
312
260
  version_requirements: !ruby/object:Gem::Requirement
313
- none: false
314
261
  requirements:
315
- - - ! '>='
262
+ - - ">="
316
263
  - !ruby/object:Gem::Version
317
264
  version: '0'
318
265
  description: Fudge Continuous Integration Server
@@ -322,122 +269,119 @@ executables:
322
269
  extensions: []
323
270
  extra_rdoc_files: []
324
271
  files:
272
+ - bin/fudge
325
273
  - lib/fudge.rb
326
- - lib/fudge/cli.rb
327
- - lib/fudge/output_checker.rb
328
274
  - lib/fudge/build.rb
329
- - lib/fudge/version.rb
275
+ - lib/fudge/cli.rb
276
+ - lib/fudge/description.rb
277
+ - lib/fudge/exceptions.rb
278
+ - lib/fudge/file_finder.rb
279
+ - lib/fudge/formatters.rb
280
+ - lib/fudge/formatters/simple.rb
281
+ - lib/fudge/generator.rb
330
282
  - lib/fudge/helpers.rb
331
- - lib/fudge/tasks/rake.rb
283
+ - lib/fudge/helpers/bundle_aware.rb
284
+ - lib/fudge/output_checker.rb
285
+ - lib/fudge/parser.rb
286
+ - lib/fudge/rspec/matchers.rb
287
+ - lib/fudge/runner.rb
288
+ - lib/fudge/task_dsl.rb
289
+ - lib/fudge/tasks.rb
332
290
  - lib/fudge/tasks/brakeman.rb
291
+ - lib/fudge/tasks/cane.rb
292
+ - lib/fudge/tasks/clean_bundler_env.rb
293
+ - lib/fudge/tasks/composite_task.rb
294
+ - lib/fudge/tasks/each_directory.rb
295
+ - lib/fudge/tasks/flay.rb
296
+ - lib/fudge/tasks/flog.rb
297
+ - lib/fudge/tasks/in_directory.rb
298
+ - lib/fudge/tasks/rake.rb
333
299
  - lib/fudge/tasks/rspec.rb
334
300
  - lib/fudge/tasks/shell.rb
335
- - lib/fudge/tasks/each_directory.rb
336
301
  - lib/fudge/tasks/sub_process.rb
337
- - lib/fudge/tasks/clean_bundler_env.rb
338
- - lib/fudge/tasks/flog.rb
339
- - lib/fudge/tasks/yard.rb
340
302
  - lib/fudge/tasks/task.rb
341
- - lib/fudge/tasks/cane.rb
342
- - lib/fudge/tasks/flay.rb
343
- - lib/fudge/tasks/composite_task.rb
344
- - lib/fudge/tasks/in_directory.rb
345
- - lib/fudge/runner.rb
346
- - lib/fudge/parser.rb
347
- - lib/fudge/tasks.rb
348
- - lib/fudge/generator.rb
349
- - lib/fudge/description.rb
350
- - lib/fudge/helpers/bundle_aware.rb
351
- - lib/fudge/file_finder.rb
352
- - lib/fudge/exceptions.rb
353
- - lib/fudge/rspec/matchers.rb
303
+ - lib/fudge/tasks/yard.rb
304
+ - lib/fudge/version.rb
354
305
  - lib/fudge/with_directory.rb
355
- - lib/fudge/task_dsl.rb
356
- - spec/support/dummy_task.rb
357
- - spec/support/output.rb
358
- - spec/support/tmpdir.rb
359
- - spec/spec_helper.rb
360
- - spec/lib/fudge/exceptions_spec.rb
361
306
  - spec/lib/fudge/build_spec.rb
362
- - spec/lib/fudge/runner_spec.rb
307
+ - spec/lib/fudge/cli_spec.rb
308
+ - spec/lib/fudge/description_spec.rb
309
+ - spec/lib/fudge/exceptions_spec.rb
310
+ - spec/lib/fudge/formatters/simple_spec.rb
311
+ - spec/lib/fudge/output_checker_spec.rb
363
312
  - spec/lib/fudge/parser_spec.rb
364
- - spec/lib/fudge/tasks/flay_spec.rb
313
+ - spec/lib/fudge/runner_spec.rb
314
+ - spec/lib/fudge/tasks/brakeman_spec.rb
365
315
  - spec/lib/fudge/tasks/bundler_spec.rb
366
- - spec/lib/fudge/tasks/flog_spec.rb
367
- - spec/lib/fudge/tasks/each_directory_spec.rb
368
316
  - spec/lib/fudge/tasks/cane_spec.rb
369
- - spec/lib/fudge/tasks/yard_spec.rb
370
- - spec/lib/fudge/tasks/shell_spec.rb
371
- - spec/lib/fudge/tasks/sub_process_spec.rb
372
- - spec/lib/fudge/tasks/brakeman_spec.rb
373
317
  - spec/lib/fudge/tasks/composite_task_spec.rb
318
+ - spec/lib/fudge/tasks/each_directory_spec.rb
319
+ - spec/lib/fudge/tasks/flay_spec.rb
320
+ - spec/lib/fudge/tasks/flog_spec.rb
321
+ - spec/lib/fudge/tasks/in_directory_spec.rb
322
+ - spec/lib/fudge/tasks/rake_spec.rb
374
323
  - spec/lib/fudge/tasks/rspec_spec.rb
324
+ - spec/lib/fudge/tasks/shell_spec.rb
325
+ - spec/lib/fudge/tasks/sub_process_spec.rb
375
326
  - spec/lib/fudge/tasks/task_spec.rb
376
- - spec/lib/fudge/tasks/rake_spec.rb
377
- - spec/lib/fudge/tasks/in_directory_spec.rb
378
- - spec/lib/fudge/cli_spec.rb
327
+ - spec/lib/fudge/tasks/yard_spec.rb
379
328
  - spec/lib/fudge/tasks_spec.rb
380
329
  - spec/lib/fudge/with_directory_spec.rb
381
- - spec/lib/fudge/output_checker_spec.rb
382
- - spec/lib/fudge/description_spec.rb
383
- - bin/fudge
330
+ - spec/spec_helper.rb
331
+ - spec/support/dummy_task.rb
332
+ - spec/support/output.rb
333
+ - spec/support/tmpdir.rb
384
334
  homepage: http://github.com/Sage/fudge
385
335
  licenses:
386
336
  - MIT
337
+ metadata: {}
387
338
  post_install_message:
388
339
  rdoc_options: []
389
340
  require_paths:
390
341
  - lib
391
342
  required_ruby_version: !ruby/object:Gem::Requirement
392
- none: false
393
343
  requirements:
394
- - - ! '>='
344
+ - - ">="
395
345
  - !ruby/object:Gem::Version
396
346
  version: '0'
397
- segments:
398
- - 0
399
- hash: -792395080375115495
400
347
  required_rubygems_version: !ruby/object:Gem::Requirement
401
- none: false
402
348
  requirements:
403
- - - ! '>='
349
+ - - ">="
404
350
  - !ruby/object:Gem::Version
405
351
  version: '0'
406
- segments:
407
- - 0
408
- hash: -792395080375115495
409
352
  requirements: []
410
353
  rubyforge_project:
411
- rubygems_version: 1.8.23
354
+ rubygems_version: 2.2.2
412
355
  signing_key:
413
- specification_version: 3
356
+ specification_version: 4
414
357
  summary: Fudge CI Server
415
358
  test_files:
416
- - spec/support/dummy_task.rb
417
359
  - spec/support/output.rb
418
360
  - spec/support/tmpdir.rb
419
- - spec/spec_helper.rb
420
- - spec/lib/fudge/exceptions_spec.rb
421
- - spec/lib/fudge/build_spec.rb
422
- - spec/lib/fudge/runner_spec.rb
423
- - spec/lib/fudge/parser_spec.rb
424
- - spec/lib/fudge/tasks/flay_spec.rb
425
- - spec/lib/fudge/tasks/bundler_spec.rb
426
- - spec/lib/fudge/tasks/flog_spec.rb
427
- - spec/lib/fudge/tasks/each_directory_spec.rb
361
+ - spec/support/dummy_task.rb
362
+ - spec/lib/fudge/cli_spec.rb
363
+ - spec/lib/fudge/formatters/simple_spec.rb
364
+ - spec/lib/fudge/tasks_spec.rb
365
+ - spec/lib/fudge/tasks/rake_spec.rb
366
+ - spec/lib/fudge/tasks/task_spec.rb
428
367
  - spec/lib/fudge/tasks/cane_spec.rb
429
- - spec/lib/fudge/tasks/yard_spec.rb
430
- - spec/lib/fudge/tasks/shell_spec.rb
431
- - spec/lib/fudge/tasks/sub_process_spec.rb
432
368
  - spec/lib/fudge/tasks/brakeman_spec.rb
369
+ - spec/lib/fudge/tasks/shell_spec.rb
433
370
  - spec/lib/fudge/tasks/composite_task_spec.rb
371
+ - spec/lib/fudge/tasks/each_directory_spec.rb
372
+ - spec/lib/fudge/tasks/yard_spec.rb
373
+ - spec/lib/fudge/tasks/flog_spec.rb
434
374
  - spec/lib/fudge/tasks/rspec_spec.rb
435
- - spec/lib/fudge/tasks/task_spec.rb
436
- - spec/lib/fudge/tasks/rake_spec.rb
437
375
  - spec/lib/fudge/tasks/in_directory_spec.rb
438
- - spec/lib/fudge/cli_spec.rb
439
- - spec/lib/fudge/tasks_spec.rb
376
+ - spec/lib/fudge/tasks/bundler_spec.rb
377
+ - spec/lib/fudge/tasks/flay_spec.rb
378
+ - spec/lib/fudge/tasks/sub_process_spec.rb
379
+ - spec/lib/fudge/build_spec.rb
380
+ - spec/lib/fudge/description_spec.rb
381
+ - spec/lib/fudge/parser_spec.rb
382
+ - spec/lib/fudge/exceptions_spec.rb
440
383
  - spec/lib/fudge/with_directory_spec.rb
441
384
  - spec/lib/fudge/output_checker_spec.rb
442
- - spec/lib/fudge/description_spec.rb
385
+ - spec/lib/fudge/runner_spec.rb
386
+ - spec/spec_helper.rb
443
387
  has_rdoc: