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.
Files changed (143) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +56 -1
  3. data/CONTRIBUTING.md +11 -23
  4. data/README.md +1 -2
  5. data/exe/aruba +2 -2
  6. data/lib/aruba.rb +1 -1
  7. data/lib/aruba/api.rb +11 -12
  8. data/lib/aruba/api/bundler.rb +18 -3
  9. data/lib/aruba/api/commands.rb +11 -11
  10. data/lib/aruba/api/core.rb +27 -25
  11. data/lib/aruba/api/environment.rb +2 -2
  12. data/lib/aruba/api/filesystem.rb +42 -16
  13. data/lib/aruba/api/text.rb +4 -4
  14. data/lib/aruba/aruba_path.rb +3 -4
  15. data/lib/aruba/basic_configuration.rb +51 -69
  16. data/lib/aruba/cli.rb +7 -7
  17. data/lib/aruba/command.rb +4 -4
  18. data/lib/aruba/config/jruby.rb +9 -9
  19. data/lib/aruba/config_wrapper.rb +2 -2
  20. data/lib/aruba/configuration.rb +36 -46
  21. data/lib/aruba/console.rb +11 -11
  22. data/lib/aruba/console/help.rb +7 -7
  23. data/lib/aruba/contracts/absolute_path.rb +1 -1
  24. data/lib/aruba/contracts/enum.rb +1 -1
  25. data/lib/aruba/contracts/is_power_of_two.rb +1 -1
  26. data/lib/aruba/contracts/relative_path.rb +1 -1
  27. data/lib/aruba/cucumber.rb +7 -7
  28. data/lib/aruba/cucumber/command.rb +41 -49
  29. data/lib/aruba/cucumber/environment.rb +7 -7
  30. data/lib/aruba/cucumber/file.rb +8 -4
  31. data/lib/aruba/cucumber/hooks.rb +29 -29
  32. data/lib/aruba/cucumber/testing_frameworks.rb +18 -18
  33. data/lib/aruba/event_bus.rb +4 -4
  34. data/lib/aruba/event_bus/name_resolver.rb +4 -4
  35. data/lib/aruba/file_size.rb +1 -1
  36. data/lib/aruba/generators/script_file.rb +2 -2
  37. data/lib/aruba/in_config_wrapper.rb +1 -1
  38. data/lib/aruba/initializer.rb +10 -10
  39. data/lib/aruba/matchers/base/base_matcher.rb +1 -1
  40. data/lib/aruba/matchers/base/message_indenter.rb +2 -2
  41. data/lib/aruba/matchers/base/object_formatter.rb +2 -2
  42. data/lib/aruba/matchers/collection.rb +1 -1
  43. data/lib/aruba/matchers/collection/all.rb +1 -1
  44. data/lib/aruba/matchers/collection/include_an_object.rb +2 -2
  45. data/lib/aruba/matchers/command.rb +1 -1
  46. data/lib/aruba/matchers/command/be_successfully_executed.rb +4 -4
  47. data/lib/aruba/matchers/command/have_finished_in_time.rb +1 -1
  48. data/lib/aruba/matchers/command/have_output.rb +1 -1
  49. data/lib/aruba/matchers/directory.rb +1 -1
  50. data/lib/aruba/matchers/directory/be_an_existing_directory.rb +2 -2
  51. data/lib/aruba/matchers/directory/have_sub_directory.rb +3 -3
  52. data/lib/aruba/matchers/environment.rb +1 -1
  53. data/lib/aruba/matchers/file.rb +1 -1
  54. data/lib/aruba/matchers/file/be_a_command_found_in_path.rb +1 -1
  55. data/lib/aruba/matchers/file/be_an_existing_executable.rb +2 -2
  56. data/lib/aruba/matchers/file/be_an_existing_file.rb +2 -2
  57. data/lib/aruba/matchers/file/have_file_content.rb +1 -1
  58. data/lib/aruba/matchers/file/have_file_size.rb +1 -1
  59. data/lib/aruba/matchers/file/have_same_file_content.rb +2 -2
  60. data/lib/aruba/matchers/path.rb +1 -1
  61. data/lib/aruba/matchers/path/a_path_matching_pattern.rb +1 -1
  62. data/lib/aruba/matchers/path/be_an_absolute_path.rb +1 -1
  63. data/lib/aruba/matchers/path/be_an_existing_path.rb +1 -1
  64. data/lib/aruba/matchers/path/have_permissions.rb +5 -4
  65. data/lib/aruba/matchers/string.rb +1 -1
  66. data/lib/aruba/matchers/string/include_output_string.rb +1 -1
  67. data/lib/aruba/matchers/string/match_output_string.rb +1 -1
  68. data/lib/aruba/matchers/string/output_string_eq.rb +1 -1
  69. data/lib/aruba/platform.rb +2 -2
  70. data/lib/aruba/platforms/announcer.rb +15 -15
  71. data/lib/aruba/platforms/aruba_fixed_size_file_creator.rb +1 -1
  72. data/lib/aruba/platforms/aruba_logger.rb +11 -10
  73. data/lib/aruba/platforms/command_monitor.rb +6 -8
  74. data/lib/aruba/platforms/determine_disk_usage.rb +2 -4
  75. data/lib/aruba/platforms/filesystem_status.rb +20 -14
  76. data/lib/aruba/platforms/simple_table.rb +3 -3
  77. data/lib/aruba/platforms/unix_command_string.rb +2 -2
  78. data/lib/aruba/platforms/unix_environment_variables.rb +1 -1
  79. data/lib/aruba/platforms/unix_platform.rb +23 -23
  80. data/lib/aruba/platforms/unix_which.rb +1 -1
  81. data/lib/aruba/platforms/windows_command_string.rb +2 -2
  82. data/lib/aruba/platforms/windows_environment_variables.rb +1 -1
  83. data/lib/aruba/platforms/windows_platform.rb +7 -7
  84. data/lib/aruba/platforms/windows_which.rb +5 -5
  85. data/lib/aruba/processes/basic_process.rb +4 -4
  86. data/lib/aruba/processes/debug_process.rb +5 -5
  87. data/lib/aruba/processes/in_process.rb +8 -8
  88. data/lib/aruba/processes/spawn_process.rb +18 -23
  89. data/lib/aruba/rspec.rb +6 -6
  90. data/lib/aruba/runtime.rb +6 -6
  91. data/lib/aruba/setup.rb +3 -3
  92. data/lib/aruba/version.rb +1 -1
  93. metadata +75 -94
  94. data/.cucumberproignore +0 -3
  95. data/.document +0 -5
  96. data/.github/ISSUE_TEMPLATE.md +0 -48
  97. data/.github/PULL_REQUEST_TEMPLATE.md +0 -41
  98. data/.gitignore +0 -38
  99. data/.rspec +0 -3
  100. data/.rubocop.yml +0 -52
  101. data/.rubocop_todo.yml +0 -216
  102. data/.simplecov +0 -36
  103. data/.travis.yml +0 -62
  104. data/.yardopts +0 -11
  105. data/Dockerfile +0 -67
  106. data/Gemfile +0 -14
  107. data/Rakefile +0 -82
  108. data/TODO.md +0 -13
  109. data/appveyor.yml +0 -28
  110. data/aruba.gemspec +0 -57
  111. data/bin/console +0 -7
  112. data/bin/test +0 -9
  113. data/config/.gitignore +0 -1
  114. data/cucumber.yml +0 -6
  115. data/docker-compose.yml +0 -26
  116. data/fixtures/cli-app/.gitignore +0 -9
  117. data/fixtures/cli-app/.rspec +0 -2
  118. data/fixtures/cli-app/README.md +0 -39
  119. data/fixtures/cli-app/Rakefile +0 -1
  120. data/fixtures/cli-app/bin/aruba-test-cli +0 -6
  121. data/fixtures/cli-app/cli-app.gemspec +0 -26
  122. data/fixtures/cli-app/features/support/aruba.rb +0 -1
  123. data/fixtures/cli-app/features/support/env.rb +0 -1
  124. data/fixtures/cli-app/lib/cli/app.rb +0 -9
  125. data/fixtures/cli-app/lib/cli/app/suppress_simple_cov_output.rb +0 -15
  126. data/fixtures/cli-app/lib/cli/app/version.rb +0 -5
  127. data/fixtures/cli-app/script/console +0 -14
  128. data/fixtures/cli-app/spec/spec_helper.rb +0 -8
  129. data/fixtures/cli-app/spec/support/aruba.rb +0 -1
  130. data/fixtures/copy/file.txt +0 -1
  131. data/fixtures/empty-app/.gitignore +0 -9
  132. data/fixtures/empty-app/.rspec +0 -2
  133. data/fixtures/empty-app/README.md +0 -24
  134. data/fixtures/empty-app/Rakefile +0 -1
  135. data/fixtures/empty-app/cli-app.gemspec +0 -26
  136. data/fixtures/empty-app/lib/cli/app.rb +0 -7
  137. data/fixtures/empty-app/lib/cli/app/version.rb +0 -5
  138. data/fixtures/getting-started-app/.gitignore +0 -4
  139. data/fixtures/getting-started-app/Gemfile +0 -4
  140. data/fixtures/getting-started-app/README.md +0 -3
  141. data/fixtures/getting-started-app/features/support/env.rb +0 -1
  142. data/lib/aruba/extensions/string/strip.rb +0 -25
  143. data/lib/aruba/tasks/docker_helpers.rb +0 -156
@@ -1,4 +1,4 @@
1
- require 'aruba/platform'
1
+ require "aruba/platform"
2
2
 
3
3
  # Aruba
4
4
  module Aruba
@@ -96,7 +96,7 @@ module Aruba
96
96
 
97
97
  environment_change = { old: old_environment,
98
98
  new: new_environment,
99
- changed: { name: name, value: '' } }
99
+ changed: { name: name, value: "" } }
100
100
  aruba.event_bus.notify Events::ChangedEnvironmentVariable.new(environment_change)
101
101
 
102
102
  self
@@ -1,11 +1,10 @@
1
- require 'pathname'
1
+ require "pathname"
2
2
 
3
- require 'aruba/platform'
4
- require 'aruba/extensions/string/strip'
3
+ require "aruba/platform"
5
4
 
6
- Aruba.platform.require_matching_files('../matchers/file/*.rb', __FILE__)
7
- Aruba.platform.require_matching_files('../matchers/directory/*.rb', __FILE__)
8
- Aruba.platform.require_matching_files('../matchers/path/*.rb', __FILE__)
5
+ Aruba.platform.require_matching_files("../matchers/file/*.rb", __FILE__)
6
+ Aruba.platform.require_matching_files("../matchers/directory/*.rb", __FILE__)
7
+ Aruba.platform.require_matching_files("../matchers/path/*.rb", __FILE__)
9
8
 
10
9
  # Aruba
11
10
  module Aruba
@@ -68,7 +67,7 @@ module Aruba
68
67
  # @return [Array]
69
68
  # List of files and directories
70
69
  def all_paths
71
- list('.').map { |path| expand_path(path) }
70
+ list(".").map { |path| expand_path(path) }
72
71
  end
73
72
 
74
73
  # Return all existing files in current directory
@@ -76,7 +75,7 @@ module Aruba
76
75
  # @return [Array]
77
76
  # List of files
78
77
  def all_files
79
- list('.').select { |p| file? p }.map { |p| expand_path(p) }
78
+ list(".").select { |p| file? p }.map { |p| expand_path(p) }
80
79
  end
81
80
 
82
81
  # Return all existing directories in current directory
@@ -84,7 +83,7 @@ module Aruba
84
83
  # @return [Array]
85
84
  # List of files
86
85
  def all_directories
87
- list('.').select { |p| directory? p }.map { |p| expand_path(p) }
86
+ list(".").select { |p| directory? p }.map { |p| expand_path(p) }
88
87
  end
89
88
 
90
89
  # Create directory object
@@ -109,8 +108,8 @@ module Aruba
109
108
  %(Only directories are supported. Path "#{name}" is not a directory.)
110
109
  end
111
110
 
112
- existing_files = Dir.glob(expand_path(File.join(name, '**', '*')))
113
- current_working_directory = Pathname.new(expand_path('.'))
111
+ existing_files = Dir.glob(expand_path(File.join(name, "**", "*")))
112
+ current_working_directory = Pathname.new(expand_path("."))
114
113
 
115
114
  existing_files.map do |d|
116
115
  Pathname.new(d).relative_path_from(current_working_directory).to_s
@@ -192,7 +191,7 @@ module Aruba
192
191
  end
193
192
 
194
193
  if source.count > 1 && exist?(destination) && !directory?(destination)
195
- raise ArgumentError, 'Multiples sources can only be copied to a directory'
194
+ raise ArgumentError, "Multiples sources can only be copied to a directory"
196
195
  end
197
196
 
198
197
  source_paths = source.map { |f| expand_path(f) }
@@ -241,7 +240,7 @@ module Aruba
241
240
  end
242
241
 
243
242
  if source.count > 1 && exist?(destination) && !directory?(destination)
244
- raise ArgumentError, 'Multiple sources can only be copied to a directory'
243
+ raise ArgumentError, "Multiple sources can only be copied to a directory"
245
244
  end
246
245
 
247
246
  source_paths = source.map { |f| expand_path(f) }
@@ -289,7 +288,7 @@ module Aruba
289
288
  # Change file system permissions of file
290
289
  #
291
290
  # @param [Octal] mode
292
- # File system mode, eg. 0755
291
+ # File system mode, eg. 0o755
293
292
  #
294
293
  # @param [String] file_name
295
294
  # Name of file to be modified. This file needs to be present to succeed
@@ -327,8 +326,35 @@ module Aruba
327
326
  def append_to_file(file_name, file_content)
328
327
  file_name = expand_path(file_name)
329
328
 
330
- Aruba.platform.mkdir(File.dirname(file_name))
331
- File.open(file_name, 'a') { |f| f << file_content }
329
+ unless File.exist? file_name
330
+ Aruba.platform.deprecated("The ability to call #append_to_file with a file that" \
331
+ " does not exist is deprecated and will be removed in" \
332
+ " Aruba 2.0.")
333
+ Aruba.platform.mkdir(File.dirname(file_name))
334
+ end
335
+ File.open(file_name, "a") { |f| f << file_content }
336
+ end
337
+
338
+ # Append lines to a (text) file. This will make sure a newline is present
339
+ # between the old content and the new.
340
+ #
341
+ # @param [String] file_name
342
+ # The name of the file to be used
343
+ #
344
+ # @param [String] file_content
345
+ # The lines which should be appended to file
346
+ def append_lines_to_file(file_name, file_content)
347
+ file_name = expand_path(file_name)
348
+
349
+ last = File.open(file_name) do |f|
350
+ f.seek(-3, IO::SEEK_END)
351
+ f.read
352
+ end
353
+
354
+ File.open(file_name, "a") do |f|
355
+ f << "\n" unless last.end_with? "\n"
356
+ f << file_content
357
+ end
332
358
  end
333
359
 
334
360
  # Create a directory in current directory
@@ -30,9 +30,9 @@ module Aruba
30
30
  # Input
31
31
  def extract_text(text)
32
32
  text
33
- .gsub(/(?:\e|\033)\[\d+(?>(;\d+)*)m/, '')
34
- .gsub(/\\\[|\\\]/, '')
35
- .gsub(/\007|\016|\017/, '')
33
+ .gsub(/(?:\e|\033)\[\d+(?>(;\d+)*)m/, "")
34
+ .gsub(/\\\[|\\\]/, "")
35
+ .gsub(/\007|\016|\017/, "")
36
36
  end
37
37
 
38
38
  # Unescape special characters and remove ANSI characters
@@ -51,7 +51,7 @@ module Aruba
51
51
  # @param [#to_s] text
52
52
  # The text to parse
53
53
  def replace_variables(text)
54
- if text.include? '<pid-last-command-started>'
54
+ if text.include? "<pid-last-command-started>"
55
55
  text = text.gsub(/<pid-last-command-started>/, last_command_started.pid.to_s)
56
56
  end
57
57
 
@@ -1,4 +1,4 @@
1
- require 'pathname'
1
+ require "pathname"
2
2
 
3
3
  # Aruba
4
4
  module Aruba
@@ -57,9 +57,8 @@ module Aruba
57
57
  # Get path
58
58
  def to_pathname
59
59
  current_path = @obj.inject do |path, element|
60
- if element.start_with? '~'
61
- element
62
- elsif Aruba.platform.absolute_path? element
60
+ if element.start_with?("~") ||
61
+ Aruba.platform.absolute_path?(element)
63
62
  element
64
63
  else
65
64
  File.join(path, element)
@@ -1,6 +1,6 @@
1
- require 'contracts'
2
- require 'aruba/basic_configuration/option'
3
- require 'aruba/in_config_wrapper'
1
+ require "contracts"
2
+ require "aruba/basic_configuration/option"
3
+ require "aruba/in_config_wrapper"
4
4
 
5
5
  # Aruba
6
6
  module Aruba
@@ -20,27 +20,18 @@ module Aruba
20
20
  # @param [Symbol] name
21
21
  # The name of the reader
22
22
  #
23
- # @param [Hash] opts
24
- # Options
25
- #
26
- # @option [Class, Module] contract
27
- # The contract for the option
23
+ # @option [Class, Module] type
24
+ # The type contract for the option
28
25
  #
29
26
  # @option [Object] default
30
27
  # The default value
31
- def option_reader(name, opts = {})
32
- contract = opts[:contract]
33
- default = opts[:default]
34
-
35
- raise ArgumentError, 'Either use block or default value' if block_given? && default
36
- raise ArgumentError, 'contract-options is required' if contract.nil?
28
+ def option_reader(name, type:, default: nil)
29
+ raise ArgumentError, "Either use block or default value" if block_given? && default
37
30
 
38
- Contract contract
39
31
  add_option(name, block_given? ? yield(InConfigWrapper.new(known_options)) : default)
40
32
 
33
+ Contract None => type
41
34
  define_method(name) { find_option(name).value }
42
-
43
- self
44
35
  end
45
36
 
46
37
  # Define an option reader and writer
@@ -48,30 +39,23 @@ module Aruba
48
39
  # @param [Symbol] name
49
40
  # The name of the reader
50
41
  #
51
- # @param [Hash] opts
52
- # Options
53
- #
54
- # @option [Class, Module] contract
55
- # The contract for the option
42
+ # @option [Class, Module] type
43
+ # The type contract for the option
56
44
  #
57
45
  # @option [Object] default
58
46
  # The default value
59
47
  #
60
- def option_accessor(name, opts = {})
61
- contract = opts[:contract]
62
- default = opts[:default]
63
-
64
- raise ArgumentError, 'Either use block or default value' if block_given? && default
65
- raise ArgumentError, 'contract-options is required' if contract.nil?
48
+ def option_accessor(name, type:, default: nil)
49
+ raise ArgumentError, "Either use block or default value" if block_given? && default
66
50
 
67
51
  # Add writer
68
52
  add_option(name, block_given? ? yield(InConfigWrapper.new(known_options)) : default)
69
53
 
70
- Contract contract
54
+ Contract type => type
71
55
  define_method("#{name}=") { |v| find_option(name).value = v }
72
56
 
73
57
  # Add reader
74
- option_reader name, contract: { None => contract.values.first }
58
+ option_reader name, type: type
75
59
  end
76
60
 
77
61
  private
@@ -90,8 +74,6 @@ module Aruba
90
74
  attr_accessor :local_options
91
75
  attr_writer :hooks
92
76
 
93
- # attr_reader :hooks
94
-
95
77
  public
96
78
 
97
79
  # Create configuration
@@ -120,68 +102,68 @@ module Aruba
120
102
  obj
121
103
  end
122
104
 
123
- # Define or run before-hook
105
+ # Define before-hook
124
106
  #
125
107
  # @param [Symbol, String] name
126
108
  # The name of the hook
127
109
  #
128
- # @param [Proc] context
129
- # The context a hook should run in. This is a runtime only option.
130
- #
131
- # @param [Array] args
132
- # Arguments for the run of hook. This is a runtime only option.
133
- #
134
110
  # @yield
135
111
  # The code block which should be run. This is a configure time only option
136
- def before(name, context = proc {}, *args, &block)
137
- name = format('%s_%s', 'before_', name.to_s).to_sym
112
+ def before(name, &block)
113
+ name = format("%s_%s", "before_", name.to_s).to_sym
114
+ raise ArgumentError, "A block is required" unless block
138
115
 
139
- if block_given?
140
- @hooks.append(name, block)
116
+ @hooks.append(name, block)
141
117
 
142
- self
143
- else
144
- @hooks.execute(name, context, *args)
145
- end
118
+ self
146
119
  end
147
120
 
148
- # Define or run after-hook
121
+ # Run before-hook
149
122
  #
150
123
  # @param [Symbol, String] name
151
124
  # The name of the hook
152
125
  #
153
126
  # @param [Proc] context
154
- # The context a hook should run in. This is a runtime only option.
127
+ # The context a hook should run in
155
128
  #
156
129
  # @param [Array] args
157
- # Arguments for the run of hook. This is a runtime only option.
130
+ # Arguments for the run of hook
131
+ def run_before_hook(name, context, *args)
132
+ name = format("%s_%s", "before_", name.to_s).to_sym
133
+
134
+ @hooks.execute(name, context, *args)
135
+ end
136
+
137
+ # Define after-hook
138
+ #
139
+ # @param [Symbol, String] name
140
+ # The name of the hook
158
141
  #
159
142
  # @yield
160
143
  # The code block which should be run. This is a configure time only option
161
- def after(name, context = proc {}, *args, &block)
162
- name = format('%s_%s', 'after_', name.to_s).to_sym
163
-
164
- if block_given?
165
- @hooks.append(name, block)
166
-
167
- self
168
- else
169
- @hooks.execute(name, context, *args)
170
- end
171
- end
144
+ def after(name, &block)
145
+ name = format("%s_%s", "after_", name.to_s).to_sym
146
+ raise ArgumentError, "A block is required" unless block
172
147
 
173
- # Check if before-hook <name> is defined
174
- def before?(name)
175
- name = format('%s_%s', 'before_', name.to_s).to_sym
148
+ @hooks.append(name, block)
176
149
 
177
- @hooks.exist? name
150
+ self
178
151
  end
179
152
 
180
- # Check if after-hook <name> is defined
181
- def after?(name)
182
- name = format('%s_%s', 'after_', name.to_s).to_sym
153
+ # Run after-hook
154
+ #
155
+ # @param [Symbol, String] name
156
+ # The name of the hook
157
+ #
158
+ # @param [Proc] context
159
+ # The context a hook should run in
160
+ #
161
+ # @param [Array] args
162
+ # Arguments for the run of hook
163
+ def run_after_hook(name, context, *args)
164
+ name = format("%s_%s", "after_", name.to_s).to_sym
183
165
 
184
- @hooks.exist? name
166
+ @hooks.execute(name, context, *args)
185
167
  end
186
168
 
187
169
  # Check if <name> is option
data/lib/aruba/cli.rb CHANGED
@@ -1,6 +1,6 @@
1
- require 'thor'
2
- require 'aruba/console'
3
- require 'aruba/initializer'
1
+ require "thor"
2
+ require "aruba/console"
3
+ require "aruba/initializer"
4
4
 
5
5
  # Aruba
6
6
  module Aruba
@@ -12,16 +12,16 @@ module Aruba
12
12
  true
13
13
  end
14
14
 
15
- desc 'console', "Start aruba's console"
15
+ desc "console", "Start aruba's console"
16
16
  def console
17
17
  Aruba::Console.new.start
18
18
  end
19
19
 
20
- desc 'init', 'Initialize aruba'
20
+ desc "init", "Initialize aruba"
21
21
  option :test_framework,
22
- default: 'cucumber',
22
+ default: "cucumber",
23
23
  enum: %w(cucumber rspec minitest),
24
- desc: 'Choose which test framework to use'
24
+ desc: "Choose which test framework to use"
25
25
  def init
26
26
  Aruba::Initializer.new.call(options[:test_framework])
27
27
  end
data/lib/aruba/command.rb CHANGED
@@ -1,7 +1,7 @@
1
- require 'delegate'
2
- require 'aruba/processes/spawn_process'
3
- require 'aruba/processes/in_process'
4
- require 'aruba/processes/debug_process'
1
+ require "delegate"
2
+ require "aruba/processes/spawn_process"
3
+ require "aruba/processes/in_process"
4
+ require "aruba/processes/debug_process"
5
5
 
6
6
  # Aruba
7
7
  module Aruba
@@ -1,27 +1,27 @@
1
- require 'rbconfig'
1
+ require "rbconfig"
2
2
 
3
3
  # ideas taken from: http://blog.headius.com/2010/03/jruby-startup-time-tips.html
4
4
  Aruba.configure do |config|
5
5
  config.before :command do |command|
6
- next unless RUBY_PLATFORM == 'java'
6
+ next unless RUBY_PLATFORM == "java"
7
7
 
8
8
  env = command.environment
9
9
 
10
- jruby_opts = env['JRUBY_OPTS'] || ''
10
+ jruby_opts = env["JRUBY_OPTS"] || ""
11
11
 
12
12
  # disable JIT since these processes are so short lived
13
- jruby_opts = "-X-C #{jruby_opts}" unless jruby_opts.include? '-X-C'
13
+ jruby_opts = "-X-C #{jruby_opts}" unless jruby_opts.include? "-X-C"
14
14
 
15
15
  # Faster startup for jruby
16
- jruby_opts = "--dev #{jruby_opts}" unless jruby_opts.include? '--dev'
16
+ jruby_opts = "--dev #{jruby_opts}" unless jruby_opts.include? "--dev"
17
17
 
18
- env['JRUBY_OPTS'] = jruby_opts
18
+ env["JRUBY_OPTS"] = jruby_opts
19
19
 
20
- if /solaris|sunos/i.match?(RbConfig::CONFIG['host_os'])
21
- java_opts = env['JAVA_OPTS'] || ''
20
+ if /solaris|sunos/i.match?(RbConfig::CONFIG["host_os"])
21
+ java_opts = env["JAVA_OPTS"] || ""
22
22
 
23
23
  # force jRuby to use client JVM for faster startup times
24
- env['JAVA_OPTS'] = "-d32 #{java_opts}" unless java_opts.include?('-d32')
24
+ env["JAVA_OPTS"] = "-d32 #{java_opts}" unless java_opts.include?("-d32")
25
25
  end
26
26
  end
27
27
  end
@@ -30,7 +30,7 @@ module Aruba
30
30
  # If one method ends with "=", e.g. ":option1=", then notify the event
31
31
  # queue, that the user changes the value of "option1"
32
32
  def method_missing(name, *args, &block)
33
- notify(name, args) if name.to_s.end_with?('=')
33
+ notify(name, args) if name.to_s.end_with?("=")
34
34
 
35
35
  return config.send(name, *args, &block) if config.respond_to? name
36
36
 
@@ -63,7 +63,7 @@ module Aruba
63
63
  event_bus.notify(
64
64
  Events::ChangedConfiguration.new(
65
65
  changed: {
66
- name: name.to_s.gsub(/=$/, ''),
66
+ name: name.to_s.gsub(/=$/, ""),
67
67
  value: args.first
68
68
  }
69
69
  )