aruba 2.1.0 → 2.3.0

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 (102) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +90 -39
  3. data/CONTRIBUTING.md +0 -1
  4. data/LICENSE +19 -17
  5. data/README.md +5 -6
  6. data/exe/aruba +3 -2
  7. data/lib/aruba/api/bundler.rb +4 -2
  8. data/lib/aruba/api/commands.rb +10 -8
  9. data/lib/aruba/api/core.rb +34 -32
  10. data/lib/aruba/api/environment.rb +4 -2
  11. data/lib/aruba/api/filesystem.rb +17 -19
  12. data/lib/aruba/api/text.rb +5 -3
  13. data/lib/aruba/api.rb +13 -11
  14. data/lib/aruba/{platforms/aruba_logger.rb → aruba_logger.rb} +4 -2
  15. data/lib/aruba/aruba_path.rb +4 -2
  16. data/lib/aruba/basic_configuration/option.rb +2 -0
  17. data/lib/aruba/basic_configuration.rb +15 -13
  18. data/lib/aruba/cli.rb +10 -8
  19. data/lib/aruba/colorizer.rb +2 -0
  20. data/lib/aruba/command.rb +10 -6
  21. data/lib/aruba/{platforms/command_monitor.rb → command_monitor.rb} +7 -5
  22. data/lib/aruba/config/jruby.rb +11 -9
  23. data/lib/aruba/config_wrapper.rb +4 -2
  24. data/lib/aruba/configuration.rb +17 -15
  25. data/lib/aruba/console/help.rb +7 -5
  26. data/lib/aruba/console.rb +12 -11
  27. data/lib/aruba/contracts/absolute_path.rb +3 -1
  28. data/lib/aruba/contracts/enum.rb +3 -1
  29. data/lib/aruba/contracts/is_power_of_two.rb +4 -2
  30. data/lib/aruba/contracts/relative_path.rb +3 -1
  31. data/lib/aruba/cucumber/command.rb +108 -99
  32. data/lib/aruba/cucumber/environment.rb +9 -7
  33. data/lib/aruba/cucumber/file.rb +4 -2
  34. data/lib/aruba/cucumber/hooks.rb +31 -29
  35. data/lib/aruba/cucumber/parameter_types.rb +4 -1
  36. data/lib/aruba/cucumber/testing_frameworks.rb +20 -18
  37. data/lib/aruba/cucumber.rb +10 -8
  38. data/lib/aruba/errors.rb +2 -6
  39. data/lib/aruba/event_bus.rb +8 -47
  40. data/lib/aruba/events.rb +15 -7
  41. data/lib/aruba/file_size.rb +3 -1
  42. data/lib/aruba/generators/script_file.rb +4 -2
  43. data/lib/aruba/hooks.rb +2 -0
  44. data/lib/aruba/in_config_wrapper.rb +3 -1
  45. data/lib/aruba/initializer.rb +25 -42
  46. data/lib/aruba/matchers/base/message_indenter.rb +3 -1
  47. data/lib/aruba/matchers/command/be_successfully_executed.rb +6 -4
  48. data/lib/aruba/matchers/command/have_exit_status.rb +2 -0
  49. data/lib/aruba/matchers/command/have_finished_in_time.rb +2 -0
  50. data/lib/aruba/matchers/command/have_output.rb +3 -1
  51. data/lib/aruba/matchers/command/have_output_on_stderr.rb +2 -0
  52. data/lib/aruba/matchers/command/have_output_on_stdout.rb +2 -0
  53. data/lib/aruba/matchers/command/have_output_size.rb +21 -5
  54. data/lib/aruba/matchers/command.rb +3 -1
  55. data/lib/aruba/matchers/directory/be_an_existing_directory.rb +3 -1
  56. data/lib/aruba/matchers/directory/have_sub_directory.rb +4 -2
  57. data/lib/aruba/matchers/directory.rb +3 -1
  58. data/lib/aruba/matchers/environment.rb +3 -1
  59. data/lib/aruba/matchers/file/be_a_command_found_in_path.rb +7 -5
  60. data/lib/aruba/matchers/file/be_an_existing_executable.rb +3 -1
  61. data/lib/aruba/matchers/file/be_an_existing_file.rb +3 -1
  62. data/lib/aruba/matchers/file/have_file_content.rb +2 -0
  63. data/lib/aruba/matchers/file/have_file_size.rb +2 -0
  64. data/lib/aruba/matchers/file/have_same_file_content.rb +3 -1
  65. data/lib/aruba/matchers/file.rb +3 -1
  66. data/lib/aruba/matchers/path/a_path_matching_pattern.rb +2 -0
  67. data/lib/aruba/matchers/path/be_an_absolute_path.rb +2 -0
  68. data/lib/aruba/matchers/path/be_an_existing_path.rb +2 -0
  69. data/lib/aruba/matchers/path/have_permissions.rb +3 -1
  70. data/lib/aruba/matchers/path.rb +3 -1
  71. data/lib/aruba/matchers/string/include_output_string.rb +3 -1
  72. data/lib/aruba/matchers/string/match_output_string.rb +3 -1
  73. data/lib/aruba/matchers/string/output_string_eq.rb +3 -1
  74. data/lib/aruba/matchers/string.rb +3 -1
  75. data/lib/aruba/platform.rb +4 -2
  76. data/lib/aruba/platforms/announcer.rb +16 -14
  77. data/lib/aruba/platforms/aruba_file_creator.rb +2 -0
  78. data/lib/aruba/platforms/aruba_fixed_size_file_creator.rb +3 -1
  79. data/lib/aruba/platforms/determine_disk_usage.rb +3 -1
  80. data/lib/aruba/platforms/determine_file_size.rb +2 -0
  81. data/lib/aruba/platforms/filesystem_status.rb +3 -1
  82. data/lib/aruba/platforms/local_environment.rb +9 -1
  83. data/lib/aruba/platforms/simple_table.rb +4 -2
  84. data/lib/aruba/platforms/unix_command_string.rb +4 -2
  85. data/lib/aruba/platforms/unix_environment_variables.rb +4 -2
  86. data/lib/aruba/platforms/unix_platform.rb +32 -26
  87. data/lib/aruba/platforms/unix_which.rb +3 -1
  88. data/lib/aruba/platforms/windows_command_string.rb +3 -18
  89. data/lib/aruba/platforms/windows_environment_variables.rb +3 -1
  90. data/lib/aruba/platforms/windows_platform.rb +12 -6
  91. data/lib/aruba/platforms/windows_which.rb +7 -5
  92. data/lib/aruba/processes/basic_process.rb +5 -3
  93. data/lib/aruba/processes/debug_process.rb +8 -6
  94. data/lib/aruba/processes/in_process.rb +11 -8
  95. data/lib/aruba/processes/spawn_process.rb +110 -37
  96. data/lib/aruba/rspec.rb +8 -6
  97. data/lib/aruba/runtime.rb +9 -7
  98. data/lib/aruba/setup.rb +8 -6
  99. data/lib/aruba/version.rb +3 -1
  100. data/lib/aruba.rb +3 -1
  101. metadata +24 -99
  102. data/lib/aruba/event_bus/name_resolver.rb +0 -158
data/lib/aruba/api.rb CHANGED
@@ -1,18 +1,20 @@
1
- require "rspec/expectations"
2
- require "shellwords"
1
+ # frozen_string_literal: true
3
2
 
4
- require "aruba/version"
3
+ require 'rspec/expectations'
4
+ require 'shellwords'
5
5
 
6
- require "aruba/platform"
7
- require "aruba/api/core"
8
- require "aruba/api/commands"
6
+ require 'aruba/version'
9
7
 
10
- require "aruba/api/environment"
11
- require "aruba/api/filesystem"
12
- require "aruba/api/text"
13
- require "aruba/api/bundler"
8
+ require 'aruba/platform'
9
+ require 'aruba/api/core'
10
+ require 'aruba/api/commands'
14
11
 
15
- Aruba.platform.require_matching_files("../matchers/**/*.rb", __FILE__)
12
+ require 'aruba/api/environment'
13
+ require 'aruba/api/filesystem'
14
+ require 'aruba/api/text'
15
+ require 'aruba/api/bundler'
16
+
17
+ Aruba.platform.require_matching_files('../matchers/**/*.rb', __FILE__)
16
18
 
17
19
  # Aruba
18
20
  module Aruba
@@ -1,4 +1,6 @@
1
- require "logger"
1
+ # frozen_string_literal: true
2
+
3
+ require 'logger'
2
4
 
3
5
  # Aruba
4
6
  module Aruba
@@ -36,7 +38,7 @@ module Aruba
36
38
  # @!method unknown(msg)
37
39
  # Log an unknown level log message
38
40
 
39
- [:fatal, :warn, :debug, :info, :error, :unknown].each do |m|
41
+ %i[fatal warn debug info error unknown].each do |m|
40
42
  define_method m do |msg|
41
43
  logger.public_send m, msg
42
44
  end
@@ -1,4 +1,6 @@
1
- require "pathname"
1
+ # frozen_string_literal: true
2
+
3
+ require 'pathname'
2
4
 
3
5
  # Aruba
4
6
  module Aruba
@@ -57,7 +59,7 @@ module Aruba
57
59
  # Get path
58
60
  def to_pathname
59
61
  current_path = @obj.inject do |path, element|
60
- if element.start_with?("~") ||
62
+ if element.start_with?('~') ||
61
63
  Aruba.platform.absolute_path?(element)
62
64
  element
63
65
  else
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Aruba
2
4
  module Aruba
3
5
  # Basic Configuration
@@ -1,6 +1,8 @@
1
- require "contracts"
2
- require "aruba/basic_configuration/option"
3
- require "aruba/in_config_wrapper"
1
+ # frozen_string_literal: true
2
+
3
+ require 'contracts'
4
+ require 'aruba/basic_configuration/option'
5
+ require 'aruba/in_config_wrapper'
4
6
 
5
7
  # Aruba
6
8
  module Aruba
@@ -26,7 +28,7 @@ module Aruba
26
28
  # @option [Object] default
27
29
  # The default value
28
30
  def option_reader(name, type:, default: nil)
29
- raise ArgumentError, "Either use block or default value" if block_given? && default
31
+ raise ArgumentError, 'Either use block or default value' if block_given? && default
30
32
 
31
33
  add_option(name, block_given? ? yield(InConfigWrapper.new(known_options)) : default)
32
34
 
@@ -46,13 +48,13 @@ module Aruba
46
48
  # The default value
47
49
  #
48
50
  def option_accessor(name, type:, default: nil)
49
- raise ArgumentError, "Either use block or default value" if block_given? && default
51
+ raise ArgumentError, 'Either use block or default value' if block_given? && default
50
52
 
51
53
  # Add writer
52
54
  add_option(name, block_given? ? yield(InConfigWrapper.new(known_options)) : default)
53
55
 
54
56
  Contract type => type
55
- define_method("#{name}=") { |v| find_option(name).value = v }
57
+ define_method(:"#{name}=") { |v| find_option(name).value = v }
56
58
 
57
59
  # Add reader
58
60
  option_reader name, type: type
@@ -110,8 +112,8 @@ module Aruba
110
112
  # @yield
111
113
  # The code block which should be run. This is a configure time only option
112
114
  def before(name, &block)
113
- name = format("%s_%s", "before_", name.to_s).to_sym
114
- raise ArgumentError, "A block is required" unless block
115
+ name = format('%s_%s', 'before_', name.to_s).to_sym
116
+ raise ArgumentError, 'A block is required' unless block
115
117
 
116
118
  @hooks.append(name, block)
117
119
 
@@ -129,7 +131,7 @@ module Aruba
129
131
  # @param [Array] args
130
132
  # Arguments for the run of hook
131
133
  def run_before_hook(name, context, *args)
132
- name = format("%s_%s", "before_", name.to_s).to_sym
134
+ name = format('%s_%s', 'before_', name.to_s).to_sym
133
135
 
134
136
  @hooks.execute(name, context, *args)
135
137
  end
@@ -142,8 +144,8 @@ module Aruba
142
144
  # @yield
143
145
  # The code block which should be run. This is a configure time only option
144
146
  def after(name, &block)
145
- name = format("%s_%s", "after_", name.to_s).to_sym
146
- raise ArgumentError, "A block is required" unless block
147
+ name = format('%s_%s', 'after_', name.to_s).to_sym
148
+ raise ArgumentError, 'A block is required' unless block
147
149
 
148
150
  @hooks.append(name, block)
149
151
 
@@ -161,7 +163,7 @@ module Aruba
161
163
  # @param [Array] args
162
164
  # Arguments for the run of hook
163
165
  def run_after_hook(name, context, *args)
164
- name = format("%s_%s", "after_", name.to_s).to_sym
166
+ name = format('%s_%s', 'after_', name.to_s).to_sym
165
167
 
166
168
  @hooks.execute(name, context, *args)
167
169
  end
@@ -180,7 +182,7 @@ module Aruba
180
182
 
181
183
  # Set if name is option
182
184
  def set_if_option(name, *args)
183
- public_send("#{name}=".to_sym, *args) if option? name
185
+ public_send(:"#{name}=", *args) if option? name
184
186
  end
185
187
 
186
188
  private
data/lib/aruba/cli.rb CHANGED
@@ -1,6 +1,8 @@
1
- require "thor"
2
- require "aruba/console"
3
- require "aruba/initializer"
1
+ # frozen_string_literal: true
2
+
3
+ require 'thor'
4
+ require 'aruba/console'
5
+ require 'aruba/initializer'
4
6
 
5
7
  # Aruba
6
8
  module Aruba
@@ -12,16 +14,16 @@ module Aruba
12
14
  true
13
15
  end
14
16
 
15
- desc "console", "Start aruba's console"
17
+ desc 'console', "Start aruba's console"
16
18
  def console
17
19
  Aruba::Console.new.start
18
20
  end
19
21
 
20
- desc "init", "Initialize aruba"
22
+ desc 'init', 'Initialize aruba'
21
23
  option :test_framework,
22
- default: "cucumber",
23
- enum: %w(cucumber rspec minitest),
24
- desc: "Choose which test framework to use"
24
+ default: 'cucumber',
25
+ enum: %w[cucumber rspec minitest],
26
+ desc: 'Choose which test framework to use'
25
27
  def init
26
28
  Aruba::Initializer.new.call(options[:test_framework])
27
29
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Aruba
2
4
  module Aruba
3
5
  # Simple colorizer class. Only supports the color cyan
data/lib/aruba/command.rb CHANGED
@@ -1,7 +1,9 @@
1
- require "delegate"
2
- require "aruba/processes/spawn_process"
3
- require "aruba/processes/in_process"
4
- require "aruba/processes/debug_process"
1
+ # frozen_string_literal: true
2
+
3
+ require 'delegate'
4
+ require 'aruba/processes/spawn_process'
5
+ require 'aruba/processes/in_process'
6
+ require 'aruba/processes/debug_process'
5
7
 
6
8
  # Aruba
7
9
  module Aruba
@@ -28,9 +30,9 @@ module Aruba
28
30
  launchers << Processes::InProcess
29
31
  launchers << Processes::SpawnProcess
30
32
 
31
- launcher = launchers.find { |l| l.match? opts[:mode] }
33
+ klass = launchers.find { |l| l.match? opts[:mode] }
32
34
 
33
- super launcher.new(
35
+ launcher = klass.new(
34
36
  command,
35
37
  opts.fetch(:exit_timeout),
36
38
  opts.fetch(:io_wait_timeout),
@@ -41,6 +43,8 @@ module Aruba
41
43
  opts.fetch(:startup_wait_time)
42
44
  )
43
45
 
46
+ super(launcher)
47
+
44
48
  @event_bus = opts.fetch(:event_bus)
45
49
  rescue KeyError => e
46
50
  raise ArgumentError, e.message
@@ -1,4 +1,6 @@
1
- require "aruba/errors"
1
+ # frozen_string_literal: true
2
+
3
+ require 'aruba/errors'
2
4
 
3
5
  # Aruba
4
6
  module Aruba
@@ -20,7 +22,7 @@ module Aruba
20
22
  end
21
23
 
22
24
  def method_missing(*)
23
- raise NoCommandHasBeenStoppedError, "No last command stopped available"
25
+ raise NoCommandHasBeenStoppedError, 'No last command stopped available'
24
26
  end
25
27
 
26
28
  def respond_to_missing?(*)
@@ -34,7 +36,7 @@ module Aruba
34
36
  end
35
37
 
36
38
  def method_missing(*)
37
- raise NoCommandHasBeenStartedError, "No last command started available"
39
+ raise NoCommandHasBeenStartedError, 'No last command started available'
38
40
  end
39
41
 
40
42
  def respond_to_missing?(*)
@@ -96,7 +98,7 @@ module Aruba
96
98
  def all_stdout
97
99
  registered_commands.each(&:stop)
98
100
 
99
- registered_commands.each_with_object("") { |e, a| a << e.stdout }
101
+ registered_commands.map(&:stdout).join
100
102
  end
101
103
 
102
104
  # Get stderr of all commands
@@ -106,7 +108,7 @@ module Aruba
106
108
  def all_stderr
107
109
  registered_commands.each(&:stop)
108
110
 
109
- registered_commands.each_with_object("") { |e, a| a << e.stderr }
111
+ registered_commands.map(&:stderr).join
110
112
  end
111
113
 
112
114
  # Get stderr and stdout of all commands
@@ -1,27 +1,29 @@
1
- require "rbconfig"
1
+ # frozen_string_literal: true
2
+
3
+ require 'rbconfig'
2
4
 
3
5
  # ideas taken from: http://blog.headius.com/2010/03/jruby-startup-time-tips.html
4
6
  Aruba.configure do |config|
5
7
  config.before :command do |command|
6
- next unless RUBY_PLATFORM == "java"
8
+ next unless RUBY_PLATFORM == 'java'
7
9
 
8
10
  env = command.environment
9
11
 
10
- jruby_opts = env["JRUBY_OPTS"] || ""
12
+ jruby_opts = env['JRUBY_OPTS'] || ''
11
13
 
12
14
  # disable JIT since these processes are so short lived
13
- jruby_opts = "-X-C #{jruby_opts}" unless jruby_opts.include? "-X-C"
15
+ jruby_opts = "-X-C #{jruby_opts}" unless jruby_opts.include? '-X-C'
14
16
 
15
17
  # Faster startup for jruby
16
- jruby_opts = "--dev #{jruby_opts}" unless jruby_opts.include? "--dev"
18
+ jruby_opts = "--dev #{jruby_opts}" unless jruby_opts.include? '--dev'
17
19
 
18
- env["JRUBY_OPTS"] = jruby_opts
20
+ env['JRUBY_OPTS'] = jruby_opts
19
21
 
20
- if /solaris|sunos/i.match?(RbConfig::CONFIG["host_os"])
21
- java_opts = env["JAVA_OPTS"] || ""
22
+ if /solaris|sunos/i.match?(RbConfig::CONFIG['host_os'])
23
+ java_opts = env['JAVA_OPTS'] || ''
22
24
 
23
25
  # force jRuby to use client JVM for faster startup times
24
- env["JAVA_OPTS"] = "-d32 #{java_opts}" unless java_opts.include?("-d32")
26
+ env['JAVA_OPTS'] = "-d32 #{java_opts}" unless java_opts.include?('-d32')
25
27
  end
26
28
  end
27
29
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Aruba
2
4
  # This wraps the current runtime configuration of aruba.
3
5
  # If an option is changed, it notifies the event queue.
@@ -30,7 +32,7 @@ module Aruba
30
32
  # If one method ends with "=", e.g. ":option1=", then notify the event
31
33
  # queue, that the user changes the value of "option1"
32
34
  def method_missing(name, *args, &block)
33
- notify(name, args) if name.to_s.end_with?("=")
35
+ notify(name, args) if name.to_s.end_with?('=')
34
36
 
35
37
  return config.send(name, *args, &block) if config.respond_to? name
36
38
 
@@ -63,7 +65,7 @@ module Aruba
63
65
  event_bus.notify(
64
66
  Events::ChangedConfiguration.new(
65
67
  changed: {
66
- name: name.to_s.gsub(/=$/, ""),
68
+ name: name.to_s.gsub(/=$/, ''),
67
69
  value: args.first
68
70
  }
69
71
  )
@@ -1,15 +1,17 @@
1
- require "contracts"
1
+ # frozen_string_literal: true
2
2
 
3
- require "aruba/version"
4
- require "aruba/basic_configuration"
5
- require "aruba/in_config_wrapper"
6
- require "aruba/hooks"
3
+ require 'contracts'
7
4
 
8
- require "aruba/contracts/relative_path"
9
- require "aruba/contracts/absolute_path"
10
- require "aruba/contracts/enum"
5
+ require 'aruba/version'
6
+ require 'aruba/basic_configuration'
7
+ require 'aruba/in_config_wrapper'
8
+ require 'aruba/hooks'
11
9
 
12
- require "aruba/contracts/is_power_of_two"
10
+ require 'aruba/contracts/relative_path'
11
+ require 'aruba/contracts/absolute_path'
12
+ require 'aruba/contracts/enum'
13
+
14
+ require 'aruba/contracts/is_power_of_two'
13
15
 
14
16
  # Aruba
15
17
  module Aruba
@@ -21,9 +23,9 @@ module Aruba
21
23
 
22
24
  option_accessor :working_directory,
23
25
  type: Aruba::Contracts::RelativePath,
24
- default: "tmp/aruba"
26
+ default: 'tmp/aruba'
25
27
 
26
- option_reader :fixtures_path_prefix, type: String, default: "%"
28
+ option_reader :fixtures_path_prefix, type: String, default: '%'
27
29
 
28
30
  option_accessor :exit_timeout, type: Num, default: 15
29
31
  option_accessor :stop_signal, type: Maybe[String], default: nil
@@ -31,13 +33,13 @@ module Aruba
31
33
  option_accessor :startup_wait_time, type: Num, default: 0
32
34
  option_accessor :fixtures_directories,
33
35
  type: ArrayOf[String],
34
- default: %w(features/fixtures spec/fixtures test/fixtures fixtures)
36
+ default: %w[features/fixtures spec/fixtures test/fixtures fixtures]
35
37
 
36
38
  option_accessor :command_runtime_environment, type: Hash, default: {}
37
39
  option_accessor :command_search_paths,
38
40
  type: ArrayOf[String] do |config|
39
- [File.join(config.root_directory.value, "bin"),
40
- File.join(config.root_directory.value, "exe")]
41
+ [File.join(config.root_directory.value, 'bin'),
42
+ File.join(config.root_directory.value, 'exe')]
41
43
  end
42
44
  option_accessor :remove_ansi_escape_sequences, type: Bool, default: true
43
45
  option_accessor :command_launcher,
@@ -64,7 +66,7 @@ module Aruba
64
66
  type: Aruba::Contracts::IsPowerOfTwo,
65
67
  default: 512
66
68
  option_accessor :console_history_file, type: String,
67
- default: "~/.aruba_history"
69
+ default: '~/.aruba_history'
68
70
 
69
71
  option_accessor :activate_announcer_on_command_failure,
70
72
  type: ArrayOf[Symbol],
@@ -1,4 +1,6 @@
1
- require "aruba/api"
1
+ # frozen_string_literal: true
2
+
3
+ require 'aruba/api'
2
4
 
3
5
  # Aruba
4
6
  module Aruba
@@ -9,9 +11,9 @@ module Aruba
9
11
  # Output help information
10
12
  def aruba_help
11
13
  puts "Aruba Version: #{Aruba::VERSION}"
12
- puts "Issue Tracker: https://github.com/cucumber/aruba/issues"
13
- puts "Documentation:"
14
- puts "* http://www.rubydoc.info/gems/aruba"
14
+ puts 'Issue Tracker: https://github.com/cucumber/aruba/issues'
15
+ puts 'Documentation:'
16
+ puts '* http://www.rubydoc.info/gems/aruba'
15
17
  puts
16
18
 
17
19
  nil
@@ -20,7 +22,7 @@ module Aruba
20
22
  # List available methods in aruba
21
23
  def aruba_methods
22
24
  ms = (Aruba::Api.instance_methods - Module.instance_methods)
23
- .each_with_object([]) { |e, a| a << format("* %s", e) }
25
+ .each_with_object([]) { |e, a| a << format('* %s', e) }
24
26
  .sort
25
27
 
26
28
  puts "Available Methods:\n#{ms.join("\n")}"
data/lib/aruba/console.rb CHANGED
@@ -1,7 +1,9 @@
1
- require "irb"
1
+ # frozen_string_literal: true
2
2
 
3
- require "aruba/api"
4
- require "aruba/console/help"
3
+ require 'irb'
4
+
5
+ require 'aruba/api'
6
+ require 'aruba/console/help'
5
7
 
6
8
  # Aruba
7
9
  module Aruba
@@ -15,21 +17,20 @@ module Aruba
15
17
  ARGV.clear
16
18
  IRB.setup nil
17
19
 
18
- IRB.conf[:IRB_NAME] = "aruba"
20
+ IRB.conf[:IRB_NAME] = 'aruba'
19
21
 
20
22
  IRB.conf[:PROMPT] = {}
21
23
  IRB.conf[:PROMPT][:ARUBA] = {
22
- PROMPT_I: "%N:%03n:%i> ",
23
- PROMPT_S: "%N:%03n:%i%l ",
24
- PROMPT_C: "%N:%03n:%i* ",
24
+ PROMPT_I: '%N:%03n:%i> ',
25
+ PROMPT_S: '%N:%03n:%i%l ',
26
+ PROMPT_C: '%N:%03n:%i* ',
25
27
  RETURN: "# => %s\n"
26
28
  }
27
29
  IRB.conf[:PROMPT_MODE] = :ARUBA
28
30
 
29
31
  IRB.conf[:RC] = false
30
32
 
31
- require "irb/completion"
32
- require "irb/ext/save-history"
33
+ require 'irb/completion'
33
34
  IRB.conf[:READLINE] = true
34
35
  IRB.conf[:SAVE_HISTORY] = 1000
35
36
  IRB.conf[:HISTORY_FILE] = Aruba.config.console_history_file
@@ -43,14 +44,14 @@ module Aruba
43
44
  end
44
45
 
45
46
  def inspect
46
- "aruba console"
47
+ 'aruba console'
47
48
  end
48
49
  end
49
50
 
50
51
  irb = IRB::Irb.new(IRB::WorkSpace.new(context.new))
51
52
  IRB.conf[:MAIN_CONTEXT] = irb.context
52
53
 
53
- trap("SIGINT") do
54
+ trap('SIGINT') do
54
55
  irb.signal_handle
55
56
  end
56
57
 
@@ -1,4 +1,6 @@
1
- require "aruba/platform"
1
+ # frozen_string_literal: true
2
+
3
+ require 'aruba/platform'
2
4
 
3
5
  # Aruba
4
6
  module Aruba
@@ -1,4 +1,6 @@
1
- require "contracts"
1
+ # frozen_string_literal: true
2
+
3
+ require 'contracts'
2
4
 
3
5
  # Aruba
4
6
  module Aruba
@@ -1,4 +1,6 @@
1
- require "aruba/aruba_path"
1
+ # frozen_string_literal: true
2
+
3
+ require 'aruba/aruba_path'
2
4
 
3
5
  # Aruba
4
6
  module Aruba
@@ -13,7 +15,7 @@ module Aruba
13
15
  def self.valid?(value)
14
16
  # explanation for algorithm can be found here:
15
17
  # http://www.exploringbinary.com/ten-ways-to-check-if-an-integer-is-a-power-of-two-in-c/
16
- value.positive? && (value & (value - 1)).zero?
18
+ value.positive? && value.nobits?(value - 1)
17
19
  rescue StandardError
18
20
  false
19
21
  end
@@ -1,4 +1,6 @@
1
- require "aruba/platform"
1
+ # frozen_string_literal: true
2
+
3
+ require 'aruba/platform'
2
4
 
3
5
  # Aruba
4
6
  module Aruba