aruba 1.0.1 → 1.1.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 +4 -4
- data/CHANGELOG.md +56 -1
- data/CONTRIBUTING.md +11 -23
- data/README.md +1 -2
- data/exe/aruba +2 -2
- data/lib/aruba.rb +1 -1
- data/lib/aruba/api.rb +11 -12
- data/lib/aruba/api/bundler.rb +18 -3
- data/lib/aruba/api/commands.rb +11 -11
- data/lib/aruba/api/core.rb +27 -25
- data/lib/aruba/api/environment.rb +2 -2
- data/lib/aruba/api/filesystem.rb +42 -16
- data/lib/aruba/api/text.rb +4 -4
- data/lib/aruba/aruba_path.rb +3 -4
- data/lib/aruba/basic_configuration.rb +51 -69
- data/lib/aruba/cli.rb +7 -7
- data/lib/aruba/command.rb +4 -4
- data/lib/aruba/config/jruby.rb +9 -9
- data/lib/aruba/config_wrapper.rb +2 -2
- data/lib/aruba/configuration.rb +36 -46
- data/lib/aruba/console.rb +11 -11
- data/lib/aruba/console/help.rb +7 -7
- data/lib/aruba/contracts/absolute_path.rb +1 -1
- data/lib/aruba/contracts/enum.rb +1 -1
- data/lib/aruba/contracts/is_power_of_two.rb +1 -1
- data/lib/aruba/contracts/relative_path.rb +1 -1
- data/lib/aruba/cucumber.rb +7 -7
- data/lib/aruba/cucumber/command.rb +41 -49
- data/lib/aruba/cucumber/environment.rb +7 -7
- data/lib/aruba/cucumber/file.rb +8 -4
- data/lib/aruba/cucumber/hooks.rb +29 -29
- data/lib/aruba/cucumber/testing_frameworks.rb +18 -18
- data/lib/aruba/event_bus.rb +4 -4
- data/lib/aruba/event_bus/name_resolver.rb +4 -4
- data/lib/aruba/file_size.rb +1 -1
- data/lib/aruba/generators/script_file.rb +2 -2
- data/lib/aruba/in_config_wrapper.rb +1 -1
- data/lib/aruba/initializer.rb +10 -10
- data/lib/aruba/matchers/base/base_matcher.rb +1 -1
- data/lib/aruba/matchers/base/message_indenter.rb +2 -2
- data/lib/aruba/matchers/base/object_formatter.rb +2 -2
- data/lib/aruba/matchers/collection.rb +1 -1
- data/lib/aruba/matchers/collection/all.rb +1 -1
- data/lib/aruba/matchers/collection/include_an_object.rb +2 -2
- data/lib/aruba/matchers/command.rb +1 -1
- data/lib/aruba/matchers/command/be_successfully_executed.rb +4 -4
- data/lib/aruba/matchers/command/have_finished_in_time.rb +1 -1
- data/lib/aruba/matchers/command/have_output.rb +1 -1
- data/lib/aruba/matchers/directory.rb +1 -1
- data/lib/aruba/matchers/directory/be_an_existing_directory.rb +2 -2
- data/lib/aruba/matchers/directory/have_sub_directory.rb +3 -3
- data/lib/aruba/matchers/environment.rb +1 -1
- data/lib/aruba/matchers/file.rb +1 -1
- data/lib/aruba/matchers/file/be_a_command_found_in_path.rb +1 -1
- data/lib/aruba/matchers/file/be_an_existing_executable.rb +2 -2
- data/lib/aruba/matchers/file/be_an_existing_file.rb +2 -2
- data/lib/aruba/matchers/file/have_file_content.rb +1 -1
- data/lib/aruba/matchers/file/have_file_size.rb +1 -1
- data/lib/aruba/matchers/file/have_same_file_content.rb +2 -2
- data/lib/aruba/matchers/path.rb +1 -1
- data/lib/aruba/matchers/path/a_path_matching_pattern.rb +1 -1
- data/lib/aruba/matchers/path/be_an_absolute_path.rb +1 -1
- data/lib/aruba/matchers/path/be_an_existing_path.rb +1 -1
- data/lib/aruba/matchers/path/have_permissions.rb +5 -4
- data/lib/aruba/matchers/string.rb +1 -1
- data/lib/aruba/matchers/string/include_output_string.rb +1 -1
- data/lib/aruba/matchers/string/match_output_string.rb +1 -1
- data/lib/aruba/matchers/string/output_string_eq.rb +1 -1
- data/lib/aruba/platform.rb +2 -2
- data/lib/aruba/platforms/announcer.rb +15 -15
- data/lib/aruba/platforms/aruba_fixed_size_file_creator.rb +1 -1
- data/lib/aruba/platforms/aruba_logger.rb +11 -10
- data/lib/aruba/platforms/command_monitor.rb +6 -8
- data/lib/aruba/platforms/determine_disk_usage.rb +2 -4
- data/lib/aruba/platforms/filesystem_status.rb +20 -14
- data/lib/aruba/platforms/simple_table.rb +3 -3
- data/lib/aruba/platforms/unix_command_string.rb +2 -2
- data/lib/aruba/platforms/unix_environment_variables.rb +1 -1
- data/lib/aruba/platforms/unix_platform.rb +23 -23
- data/lib/aruba/platforms/unix_which.rb +1 -1
- data/lib/aruba/platforms/windows_command_string.rb +2 -2
- data/lib/aruba/platforms/windows_environment_variables.rb +1 -1
- data/lib/aruba/platforms/windows_platform.rb +7 -7
- data/lib/aruba/platforms/windows_which.rb +5 -5
- data/lib/aruba/processes/basic_process.rb +4 -4
- data/lib/aruba/processes/debug_process.rb +5 -5
- data/lib/aruba/processes/in_process.rb +8 -8
- data/lib/aruba/processes/spawn_process.rb +18 -23
- data/lib/aruba/rspec.rb +6 -6
- data/lib/aruba/runtime.rb +6 -6
- data/lib/aruba/setup.rb +3 -3
- data/lib/aruba/version.rb +1 -1
- metadata +75 -94
- data/.cucumberproignore +0 -3
- data/.document +0 -5
- data/.github/ISSUE_TEMPLATE.md +0 -48
- data/.github/PULL_REQUEST_TEMPLATE.md +0 -41
- data/.gitignore +0 -38
- data/.rspec +0 -3
- data/.rubocop.yml +0 -52
- data/.rubocop_todo.yml +0 -216
- data/.simplecov +0 -36
- data/.travis.yml +0 -62
- data/.yardopts +0 -11
- data/Dockerfile +0 -67
- data/Gemfile +0 -14
- data/Rakefile +0 -82
- data/TODO.md +0 -13
- data/appveyor.yml +0 -28
- data/aruba.gemspec +0 -57
- data/bin/console +0 -7
- data/bin/test +0 -9
- data/config/.gitignore +0 -1
- data/cucumber.yml +0 -6
- data/docker-compose.yml +0 -26
- data/fixtures/cli-app/.gitignore +0 -9
- data/fixtures/cli-app/.rspec +0 -2
- data/fixtures/cli-app/README.md +0 -39
- data/fixtures/cli-app/Rakefile +0 -1
- data/fixtures/cli-app/bin/aruba-test-cli +0 -6
- data/fixtures/cli-app/cli-app.gemspec +0 -26
- data/fixtures/cli-app/features/support/aruba.rb +0 -1
- data/fixtures/cli-app/features/support/env.rb +0 -1
- data/fixtures/cli-app/lib/cli/app.rb +0 -9
- data/fixtures/cli-app/lib/cli/app/suppress_simple_cov_output.rb +0 -15
- data/fixtures/cli-app/lib/cli/app/version.rb +0 -5
- data/fixtures/cli-app/script/console +0 -14
- data/fixtures/cli-app/spec/spec_helper.rb +0 -8
- data/fixtures/cli-app/spec/support/aruba.rb +0 -1
- data/fixtures/copy/file.txt +0 -1
- data/fixtures/empty-app/.gitignore +0 -9
- data/fixtures/empty-app/.rspec +0 -2
- data/fixtures/empty-app/README.md +0 -24
- data/fixtures/empty-app/Rakefile +0 -1
- data/fixtures/empty-app/cli-app.gemspec +0 -26
- data/fixtures/empty-app/lib/cli/app.rb +0 -7
- data/fixtures/empty-app/lib/cli/app/version.rb +0 -5
- data/fixtures/getting-started-app/.gitignore +0 -4
- data/fixtures/getting-started-app/Gemfile +0 -4
- data/fixtures/getting-started-app/README.md +0 -3
- data/fixtures/getting-started-app/features/support/env.rb +0 -1
- data/lib/aruba/extensions/string/strip.rb +0 -25
- data/lib/aruba/tasks/docker_helpers.rb +0 -156
@@ -1,5 +1,5 @@
|
|
1
1
|
Given(/^a mocked home directory$/) do
|
2
|
-
set_environment_variable
|
2
|
+
set_environment_variable "HOME", expand_path(".")
|
3
3
|
end
|
4
4
|
|
5
5
|
Given(/^I set the environment variable "(.*)" to "(.*)"/) do |variable, value|
|
@@ -16,8 +16,8 @@ end
|
|
16
16
|
|
17
17
|
Given(/^I set the environment variables? to:/) do |table|
|
18
18
|
table.hashes.each do |row|
|
19
|
-
variable = row[
|
20
|
-
value = row[
|
19
|
+
variable = row["variable"].to_s
|
20
|
+
value = row["value"].to_s
|
21
21
|
|
22
22
|
set_environment_variable(variable, value)
|
23
23
|
end
|
@@ -25,8 +25,8 @@ end
|
|
25
25
|
|
26
26
|
Given(/^I append the values? to the environment variables?:/) do |table|
|
27
27
|
table.hashes.each do |row|
|
28
|
-
variable = row[
|
29
|
-
value = row[
|
28
|
+
variable = row["variable"].to_s
|
29
|
+
value = row["value"].to_s
|
30
30
|
|
31
31
|
append_environment_variable(variable, value)
|
32
32
|
end
|
@@ -34,8 +34,8 @@ end
|
|
34
34
|
|
35
35
|
Given(/^I prepend the values? to the environment variables?:/) do |table|
|
36
36
|
table.hashes.each do |row|
|
37
|
-
variable = row[
|
38
|
-
value = row[
|
37
|
+
variable = row["variable"].to_s
|
38
|
+
value = row["value"].to_s
|
39
39
|
|
40
40
|
prepend_environment_variable(variable, value)
|
41
41
|
end
|
data/lib/aruba/cucumber/file.rb
CHANGED
@@ -28,7 +28,7 @@ Given(/^(?:a|the) file(?: named)? "([^"]*)" with:$/) do |file_name, file_content
|
|
28
28
|
end
|
29
29
|
|
30
30
|
Given(/^(?:an|the) executable(?: named)? "([^"]*)" with:$/) do |file_name, file_content|
|
31
|
-
step %(a file named "#{file_name}" with mode "
|
31
|
+
step %(a file named "#{file_name}" with mode "0o755" and with:), file_content
|
32
32
|
end
|
33
33
|
|
34
34
|
Given(/^(?:a|the) file(?: named)? "([^"]*)" with "([^"]*)"$/) do |file_name, file_content|
|
@@ -46,12 +46,12 @@ Given(/^(?:a|the) (\d+) byte file(?: named)? "([^"]*)"$/) do |file_size, file_na
|
|
46
46
|
end
|
47
47
|
|
48
48
|
Given(/^(?:an|the) empty file(?: named)? "([^"]*)"$/) do |file_name|
|
49
|
-
write_file(file_name,
|
49
|
+
write_file(file_name, "")
|
50
50
|
end
|
51
51
|
|
52
52
|
Given(/^(?:an|the) empty file(?: named)? "([^"]*)" with mode "([^"]*)"$/) \
|
53
53
|
do |file_name, file_mode|
|
54
|
-
write_file(file_name,
|
54
|
+
write_file(file_name, "")
|
55
55
|
chmod(file_mode, file_name)
|
56
56
|
end
|
57
57
|
|
@@ -68,13 +68,17 @@ When(/^I append to "([^"]*)" with:$/) do |file_name, file_content|
|
|
68
68
|
append_to_file(file_name, file_content)
|
69
69
|
end
|
70
70
|
|
71
|
+
When(/^I append the following lines to "([^"]*)":$/) do |file_name, file_content|
|
72
|
+
append_lines_to_file(file_name, file_content)
|
73
|
+
end
|
74
|
+
|
71
75
|
When(/^I append to "([^"]*)" with "([^"]*)"$/) do |file_name, file_content|
|
72
76
|
append_to_file(file_name, file_content)
|
73
77
|
end
|
74
78
|
|
75
79
|
When(/^I remove (?:a|the) (?:file|directory)(?: named)? "([^"]*)"( with full force)?$/) \
|
76
80
|
do |name, force_remove|
|
77
|
-
remove(name, force: force_remove.nil?
|
81
|
+
remove(name, force: !force_remove.nil?)
|
78
82
|
end
|
79
83
|
|
80
84
|
Given(/^(?:a|the) (?:file|directory)(?: named)? "([^"]*)" does not exist$/) do |name|
|
data/lib/aruba/cucumber/hooks.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require "aruba/aruba_path"
|
2
|
+
require "aruba/api"
|
3
|
+
require "aruba/platform"
|
4
4
|
World(Aruba::Api)
|
5
5
|
|
6
6
|
Around do |_, block|
|
@@ -10,10 +10,10 @@ end
|
|
10
10
|
Before do
|
11
11
|
# ... so every change needs to be done later
|
12
12
|
prepend_environment_variable(
|
13
|
-
|
13
|
+
"PATH",
|
14
14
|
aruba.config.command_search_paths.join(File::PATH_SEPARATOR) + File::PATH_SEPARATOR
|
15
15
|
)
|
16
|
-
set_environment_variable
|
16
|
+
set_environment_variable "HOME", aruba.config.home_directory
|
17
17
|
end
|
18
18
|
|
19
19
|
After do
|
@@ -21,68 +21,68 @@ After do
|
|
21
21
|
aruba.command_monitor.clear
|
22
22
|
end
|
23
23
|
|
24
|
-
Before(
|
24
|
+
Before("@no-clobber") do
|
25
25
|
setup_aruba(false)
|
26
26
|
end
|
27
27
|
|
28
|
-
Before(
|
28
|
+
Before("~@no-clobber") do
|
29
29
|
setup_aruba
|
30
30
|
end
|
31
31
|
|
32
|
-
Before(
|
32
|
+
Before("@puts") do
|
33
33
|
aruba.announcer.mode = :puts
|
34
34
|
end
|
35
35
|
|
36
|
-
Before(
|
36
|
+
Before("@announce-command") do
|
37
37
|
aruba.announcer.activate :command
|
38
38
|
end
|
39
39
|
|
40
|
-
Before(
|
40
|
+
Before("@announce-command-content") do
|
41
41
|
aruba.announcer.activate :command_content
|
42
42
|
end
|
43
43
|
|
44
|
-
Before(
|
44
|
+
Before("@announce-command-filesystem-status") do
|
45
45
|
aruba.announcer.activate :command_filesystem_status
|
46
46
|
end
|
47
47
|
|
48
|
-
Before(
|
48
|
+
Before("@announce-output") do
|
49
49
|
aruba.announcer.activate :stdout
|
50
50
|
aruba.announcer.activate :stderr
|
51
51
|
end
|
52
52
|
|
53
|
-
Before(
|
53
|
+
Before("@announce-stdout") do
|
54
54
|
aruba.announcer.activate :stdout
|
55
55
|
end
|
56
56
|
|
57
|
-
Before(
|
57
|
+
Before("@announce-stderr") do
|
58
58
|
aruba.announcer.activate :stderr
|
59
59
|
end
|
60
60
|
|
61
|
-
Before(
|
61
|
+
Before("@announce-directory") do
|
62
62
|
aruba.announcer.activate :directory
|
63
63
|
end
|
64
64
|
|
65
|
-
Before(
|
65
|
+
Before("@announce-stop-signal") do
|
66
66
|
aruba.announcer.activate :stop_signal
|
67
67
|
end
|
68
68
|
|
69
|
-
Before(
|
69
|
+
Before("@announce-full-environment") do
|
70
70
|
aruba.announcer.activate :full_environment
|
71
71
|
end
|
72
72
|
|
73
|
-
Before(
|
73
|
+
Before("@announce-changed-environment") do
|
74
74
|
aruba.announcer.activate :changed_environment
|
75
75
|
end
|
76
76
|
|
77
|
-
Before(
|
77
|
+
Before("@announce-timeout") do
|
78
78
|
aruba.announcer.activate :timeout
|
79
79
|
end
|
80
80
|
|
81
|
-
Before(
|
81
|
+
Before("@announce-wait-time") do
|
82
82
|
aruba.announcer.activate :wait_time
|
83
83
|
end
|
84
84
|
|
85
|
-
Before(
|
85
|
+
Before("@announce") do
|
86
86
|
aruba.announcer.activate :changed_environment
|
87
87
|
aruba.announcer.activate :command
|
88
88
|
aruba.announcer.activate :directory
|
@@ -98,30 +98,30 @@ Before('@announce') do
|
|
98
98
|
aruba.announcer.activate :command_filesystem_status
|
99
99
|
end
|
100
100
|
|
101
|
-
Before(
|
101
|
+
Before("@keep-ansi-escape-sequences") do
|
102
102
|
aruba.config.remove_ansi_escape_sequences = false
|
103
103
|
end
|
104
104
|
|
105
|
-
Before
|
106
|
-
set_environment_variable
|
105
|
+
Before "@mocked-home-directory" do
|
106
|
+
set_environment_variable "HOME", expand_path(".")
|
107
107
|
end
|
108
108
|
|
109
|
-
Before(
|
109
|
+
Before("@disable-bundler") do
|
110
110
|
unset_bundler_env_vars
|
111
111
|
end
|
112
112
|
|
113
|
-
Before(
|
113
|
+
Before("@debug") do
|
114
114
|
aruba.config.command_launcher = :debug
|
115
115
|
end
|
116
116
|
|
117
|
-
Before(
|
117
|
+
Before("@command-launcher-spawn") do
|
118
118
|
aruba.config.command_launcher = :spawn
|
119
119
|
end
|
120
120
|
|
121
|
-
Before(
|
121
|
+
Before("@command-launcher-in-process") do
|
122
122
|
aruba.config.command_launcher = :in_process
|
123
123
|
end
|
124
124
|
|
125
|
-
Before(
|
125
|
+
Before("@command-launcher-debug") do
|
126
126
|
aruba.config.command_launcher = :debug
|
127
127
|
end
|
@@ -1,25 +1,25 @@
|
|
1
1
|
# Cucumber
|
2
2
|
Then(/^the feature(?:s)? should not(?: all)? pass$/) do
|
3
3
|
step 'the output should contain " failed)"'
|
4
|
-
step
|
4
|
+
step "the exit status should be 1"
|
5
5
|
end
|
6
6
|
|
7
7
|
# Cucumber
|
8
8
|
Then(/^the feature(?:s)? should(?: all)? pass$/) do
|
9
9
|
step 'the output should not contain " failed)"'
|
10
10
|
step 'the output should not contain " undefined)"'
|
11
|
-
step
|
11
|
+
step "the exit status should be 0"
|
12
12
|
end
|
13
13
|
|
14
14
|
# Cucumber
|
15
15
|
Then(/^the feature(?:s)? should not(?: all)? pass with( regex)?:$/) do |regex, string|
|
16
16
|
step 'the output should contain " failed)"'
|
17
|
-
step
|
17
|
+
step "the exit status should be 1"
|
18
18
|
|
19
19
|
if regex
|
20
20
|
step "the output should match %r<#{string}>"
|
21
21
|
else
|
22
|
-
step
|
22
|
+
step "the output should contain:", string
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -27,12 +27,12 @@ end
|
|
27
27
|
Then(/^the feature(?:s)? should(?: all)? pass with( regex)?:$/) do |regex, string|
|
28
28
|
step 'the output should not contain " failed)"'
|
29
29
|
step 'the output should not contain " undefined)"'
|
30
|
-
step
|
30
|
+
step "the exit status should be 0"
|
31
31
|
|
32
32
|
if regex
|
33
33
|
step "the output should match %r<#{string}>"
|
34
34
|
else
|
35
|
-
step
|
35
|
+
step "the output should contain:", string
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
@@ -45,36 +45,36 @@ Then(/^the spec(?:s)? should not(?: all)? pass(?: with (\d+) failures?)?$/) \
|
|
45
45
|
step %(the output should contain "#{count_failures} failures")
|
46
46
|
end
|
47
47
|
|
48
|
-
step
|
48
|
+
step "the exit status should be 1"
|
49
49
|
end
|
50
50
|
|
51
51
|
# RSpec
|
52
52
|
Then(/^the spec(?:s)? should all pass$/) do
|
53
53
|
step 'the output should contain "0 failures"'
|
54
|
-
step
|
54
|
+
step "the exit status should be 0"
|
55
55
|
end
|
56
56
|
|
57
57
|
# RSpec
|
58
58
|
Then(/^the spec(?:s)? should not(?: all)? pass with( regex)?:$/) do |regex, string|
|
59
59
|
step 'the output should not contain "0 failures"'
|
60
|
-
step
|
60
|
+
step "the exit status should be 1"
|
61
61
|
|
62
62
|
if regex
|
63
63
|
step "the output should match %r<#{string}>"
|
64
64
|
else
|
65
|
-
step
|
65
|
+
step "the output should contain:", string
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
69
|
# RSpec
|
70
70
|
Then(/^the spec(?:s)? should(?: all)? pass with( regex)?:$/) do |regex, string|
|
71
71
|
step 'the output should contain "0 failures"'
|
72
|
-
step
|
72
|
+
step "the exit status should be 0"
|
73
73
|
|
74
74
|
if regex
|
75
75
|
step "the output should match %r<#{string}>"
|
76
76
|
else
|
77
|
-
step
|
77
|
+
step "the output should contain:", string
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
@@ -87,35 +87,35 @@ Then(/^the tests(?:s)? should not(?: all)? pass(?: with (\d+) failures?)?$/) \
|
|
87
87
|
step %(the output should contain "#{count_failures} errors")
|
88
88
|
end
|
89
89
|
|
90
|
-
step
|
90
|
+
step "the exit status should be 1"
|
91
91
|
end
|
92
92
|
|
93
93
|
# Minitest
|
94
94
|
Then(/^the tests(?:s)? should all pass$/) do
|
95
95
|
step 'the output should contain "0 errors"'
|
96
|
-
step
|
96
|
+
step "the exit status should be 0"
|
97
97
|
end
|
98
98
|
|
99
99
|
# Minitest
|
100
100
|
Then(/^the test(?:s)? should not(?: all)? pass with( regex)?:$/) do |regex, string|
|
101
101
|
step 'the output should contain "0 errors"'
|
102
|
-
step
|
102
|
+
step "the exit status should be 1"
|
103
103
|
|
104
104
|
if regex
|
105
105
|
step "the output should match %r<#{string}>"
|
106
106
|
else
|
107
|
-
step
|
107
|
+
step "the output should contain:", string
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
111
111
|
# Minitest
|
112
112
|
Then(/^the test(?:s)? should(?: all)? pass with( regex)?:$/) do |regex, string|
|
113
113
|
step 'the output should not contain "0 errors"'
|
114
|
-
step
|
114
|
+
step "the exit status should be 0"
|
115
115
|
|
116
116
|
if regex
|
117
117
|
step "the output should match %r<#{string}>"
|
118
118
|
else
|
119
|
-
step
|
119
|
+
step "the output should contain:", string
|
120
120
|
end
|
121
121
|
end
|
data/lib/aruba/event_bus.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "aruba/event_bus/name_resolver"
|
2
|
+
require "aruba/errors"
|
3
3
|
|
4
4
|
module Aruba
|
5
5
|
# Event bus
|
@@ -34,7 +34,7 @@ module Aruba
|
|
34
34
|
handler = handler_proc || handler_object
|
35
35
|
|
36
36
|
if handler.nil? || !handler.respond_to?(:call)
|
37
|
-
raise ArgumentError,
|
37
|
+
raise ArgumentError, "Please pass either an object#call or a handler block"
|
38
38
|
end
|
39
39
|
|
40
40
|
Array(event_ids).flatten.each do |id|
|
@@ -53,7 +53,7 @@ module Aruba
|
|
53
53
|
# handler.
|
54
54
|
#
|
55
55
|
def notify(event)
|
56
|
-
raise NoEventError,
|
56
|
+
raise NoEventError, "Please pass an event object, not a class" if event.is_a?(Class)
|
57
57
|
|
58
58
|
@handlers[event.class.to_s].each { |handler| handler.call(event) }
|
59
59
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "aruba/errors"
|
2
2
|
|
3
3
|
# Event notification library
|
4
4
|
module Aruba
|
@@ -10,13 +10,13 @@ module Aruba
|
|
10
10
|
# Helpers for Resolvers
|
11
11
|
module ResolveHelpers
|
12
12
|
def camel_case(underscored_name)
|
13
|
-
underscored_name.to_s.split(
|
13
|
+
underscored_name.to_s.split("_").map { |word| word.upcase[0] + word[1..-1] }.join
|
14
14
|
end
|
15
15
|
|
16
16
|
# Thanks ActiveSupport
|
17
17
|
# (Only needed to support Ruby 1.9.3 and JRuby)
|
18
18
|
def constantize(camel_cased_word)
|
19
|
-
names = camel_cased_word.split(
|
19
|
+
names = camel_cased_word.split("::")
|
20
20
|
|
21
21
|
# Trigger a built-in NameError exception including the ill-formed
|
22
22
|
# constant in the message.
|
@@ -148,7 +148,7 @@ module Aruba
|
|
148
148
|
def transform(event_id)
|
149
149
|
resolvers.find { |r| r.match? event_id }.new.transform(default_namespace, event_id)
|
150
150
|
rescue StandardError => e
|
151
|
-
types = @resolvers.map(&:supports).flatten.join(
|
151
|
+
types = @resolvers.map(&:supports).flatten.join(", ")
|
152
152
|
message = "Transforming \"#{event_id}\" into an event class failed." \
|
153
153
|
" Supported types are: #{types}. #{e.message}."
|
154
154
|
raise EventNameResolveError, message, cause: e
|
data/lib/aruba/file_size.rb
CHANGED
@@ -23,7 +23,7 @@ module Aruba
|
|
23
23
|
|
24
24
|
def header
|
25
25
|
if script_starts_with_shebang?
|
26
|
-
|
26
|
+
""
|
27
27
|
elsif interpreter_is_absolute_path?
|
28
28
|
format("#!%s\n", interpreter)
|
29
29
|
elsif interpreter_is_just_the_name_of_shell?
|
@@ -40,7 +40,7 @@ module Aruba
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def script_starts_with_shebang?
|
43
|
-
content.start_with?
|
43
|
+
content.start_with? "#!"
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|