-
-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #257 from dg-ratiodata/feature/use_current_working…
…_directory_for_process Cleanup "Process Management" #1
- Loading branch information
Showing
25 changed files
with
991 additions
and
339 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
<% | ||
java_version = (RUBY_DESCRIPTION.match(/.*?on.*?(1\.[\d]\..*? )/))[1] if defined?(JRUBY_VERSION) | ||
std_opts = "--color --tags ~@wip" | ||
std_opts << " --tags [email protected]" if defined?(JRUBY_VERSION) && (java_version < '1.7.0') | ||
wip_opts = "--color --tags @wip:3" | ||
wip_opts = "--color --tags @wip:3,@wip-jruby-java-1.6:3" if defined?(JRUBY_VERSION) && (java_version < '1.7.0') | ||
std_opts = "--color --exclude features/fixtures" | ||
java_default_opts = "--tags [email protected]" if defined?(JRUBY_VERSION) && (java_version < '1.7.0') | ||
java_wip_opts = "--tags @wip-jruby-java-1.6:3" if defined?(JRUBY_VERSION) && (java_version < '1.7.0') | ||
%> | ||
default: <%= std_opts %> | ||
wip: --wip <%= wip_opts %> | ||
default: <%= std_opts %> --tags ~@wip <%= java_default_opts %> | ||
wip: <%= std_opts %> --wip --tags @wip:3 <%= java_wip_opts %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Feature: Debug command execution | ||
|
||
As a developer | ||
I want to use some debugger in my code and therefor need system() to execute my program | ||
In order to find a bug | ||
|
||
@debug | ||
Scenario: Run program with debug code | ||
When I run `true` | ||
Then the exit status should be 0 | ||
|
||
@debug | ||
Scenario: Run failing program with debug code | ||
When I run `false` | ||
Then the exit status should be 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env bash | ||
|
||
echo $* >&2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
require 'aruba/spawn_process' | ||
require 'aruba/processes/spawn_process' | ||
|
||
module Aruba | ||
class << self | ||
attr_accessor :process | ||
end | ||
self.process = Aruba::SpawnProcess | ||
self.process = Aruba::Processes::SpawnProcess | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
module Aruba | ||
# Announcer | ||
# | ||
# @example Activate your you own channel in cucumber | ||
# | ||
# Before('@announce-my-channel') do | ||
# announcer.activate :my_channel | ||
# end | ||
# | ||
# @example Activate your you own channel in rspec > 3 | ||
# | ||
# before do | ||
# current_example = context.example | ||
# announcer.activate :my_channel if current_example.metadata[:announce_my_channel] | ||
# end | ||
# | ||
# Aruba.announcer.announce(:my_channel, 'my message') | ||
# | ||
class Announcer | ||
# Dev null | ||
class NullAnnouncer | ||
def announce(*) | ||
nil | ||
end | ||
|
||
def mode?(*) | ||
true | ||
end | ||
end | ||
|
||
# Announcer using Kernel.puts | ||
class KernelPutsAnnouncer | ||
def announce(message) | ||
Kernel.puts message | ||
end | ||
|
||
def mode?(m) | ||
:kernel_puts == m | ||
end | ||
end | ||
|
||
# Announcer using Main#puts | ||
class PutsAnnouncer | ||
def announce(message) | ||
Kernel.puts message | ||
end | ||
|
||
def mode?(m) | ||
:puts == m | ||
end | ||
end | ||
|
||
private | ||
|
||
attr_reader :announcers, :default_announcer, :announcer, :channels, :format_strings | ||
|
||
public | ||
|
||
def initialize(_, options) | ||
@announcers = [] | ||
@announcers << PutsAnnouncer.new | ||
@announcers << KernelPutsAnnouncer.new | ||
@announcers << NullAnnouncer.new | ||
|
||
@default_announcer = @announcers.last | ||
@announcer = @announcers.first | ||
@channels = {} | ||
@format_strings = {} | ||
|
||
@options = options | ||
|
||
after_init | ||
end | ||
|
||
# rubocop:disable Metrics/MethodLength | ||
def after_init | ||
format_string :directory, '$ cd %s' | ||
format_string :command, '$ %s' | ||
format_string :environment, '$ export %s=%s"' | ||
|
||
# rubocop:disable Metrics/LineLength | ||
if @options[:stdout] | ||
warn('The use of "@announce_stdout-instance" variable and "options[:stdout] = true" for Announcer.new is deprecated. Please use "announcer.activate(:stdout)" instead.') | ||
activate :stdout | ||
end | ||
if @options[:stderr] | ||
warn('The use of "@announce_stderr-instance" variable and "options[:stderr] = true" for Announcer.new is deprecated. Please use "announcer.activate(:stderr)" instead.') | ||
activate :stderr | ||
end | ||
if @options[:dir] | ||
warn('The use of "@announce_dir-instance" variable and "options[:dir] = true" for Announcer.new is deprecated. Please use "announcer.activate(:directory)" instead.') | ||
activate :directory | ||
end | ||
if @options[:cmd] | ||
warn('The use of "@announce_cmd-instance" variable and "options[:cmd] = true" for Announcer.new is deprecated. Please use "announcer.activate(:command)" instead.') | ||
activate :command | ||
end | ||
if @options[:env] | ||
warn('The use of "@announce_env-instance" variable and "options[:env] = true" for Announcer.new is deprecated. Please use "announcer.activate(:environment)" instead.') | ||
activate :enviroment | ||
end | ||
# rubocop:enable Metrics/LineLength | ||
end | ||
# rubocop:enable Metrics/MethodLength | ||
|
||
def reset | ||
@default_announcer = @announcers.last | ||
@announcer = @announcers.first | ||
end | ||
|
||
def format_string(channel, string) | ||
format_strings[channel] = string | ||
|
||
self | ||
end | ||
|
||
def mode=(m) | ||
@announcer = @announcers.find { |a| f.mode? m } | ||
|
||
self | ||
end | ||
|
||
def activate(channel) | ||
channels[channel] = true | ||
|
||
self | ||
end | ||
|
||
def announce(channel, *args) | ||
message = format(format_strings.fetch(channel, '%s'), *args) | ||
announcer.announce(message) if @channels[channel] | ||
|
||
default_announcer.announce message | ||
end | ||
|
||
def stdout(content) | ||
warn('The announcer now has a new api to activate channels. Please use this one: announce(:stdout, message)') | ||
announce :stdout, content | ||
end | ||
|
||
def stderr(content) | ||
warn('The announcer now has a new api to activate channels. Please use this one: announce(:stderr, message)') | ||
announce :stderr, content | ||
end | ||
|
||
def dir(dir) | ||
warn('The announcer now has a new api to activate channels. Please use this one announce(:directory, message)') | ||
announce :directory, dir | ||
end | ||
|
||
def cmd(cmd) | ||
warn('The announcer now has a new api to activate channels. Please use this one announce(:command, message)') | ||
announce :command, cmd | ||
end | ||
|
||
def env(key, value) | ||
warn('The announcer now has a new api to activate channels. Please use this one: announce(:environment, key, value)') | ||
announce :environment, key, value | ||
end | ||
end | ||
end |
Oops, something went wrong.