fedux_org-stdlib 0.7.21 → 0.7.22

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +3 -0
  3. data/Gemfile +1 -1
  4. data/Gemfile.lock +23 -19
  5. data/Rakefile +16 -0
  6. data/config/rubocop/exclude.yml +44 -0
  7. data/config/rubocop/include.yml +0 -0
  8. data/fedux_org-stdlib.gemspec +9 -9
  9. data/fixtures/plugin-load-app/fedux_org_stdlib-fixtures-plugin_manager-plugin-load.gemspec +11 -11
  10. data/fixtures/plugin-no_load-app/fedux_org_stdlib-fixtures-plugin_manager-plugin-no_load.gemspec +11 -11
  11. data/lib/fedux_org_stdlib.rb +2 -1
  12. data/lib/fedux_org_stdlib/app_config.rb +22 -21
  13. data/lib/fedux_org_stdlib/colors/html_color.rb +8 -2
  14. data/lib/fedux_org_stdlib/command.rb +1 -0
  15. data/lib/fedux_org_stdlib/command/command_result.rb +1 -0
  16. data/lib/fedux_org_stdlib/command/run_command.rb +6 -5
  17. data/lib/fedux_org_stdlib/command/which.rb +17 -17
  18. data/lib/fedux_org_stdlib/core_ext/array/list.rb +6 -1
  19. data/lib/fedux_org_stdlib/core_ext/hash/list.rb +6 -1
  20. data/lib/fedux_org_stdlib/core_ext/hash/options.rb +1 -0
  21. data/lib/fedux_org_stdlib/core_ext/shellwords/clean.rb +8 -0
  22. data/lib/fedux_org_stdlib/core_ext/string/underline.rb +9 -1
  23. data/lib/fedux_org_stdlib/environment.rb +6 -4
  24. data/lib/fedux_org_stdlib/file_template.rb +8 -10
  25. data/lib/fedux_org_stdlib/filesystem.rb +30 -29
  26. data/lib/fedux_org_stdlib/filesystem/exceptions.rb +1 -1
  27. data/lib/fedux_org_stdlib/gem_plugins/exceptions.rb +1 -0
  28. data/lib/fedux_org_stdlib/gem_plugins/no_plugin.rb +1 -2
  29. data/lib/fedux_org_stdlib/gem_plugins/plugin.rb +6 -6
  30. data/lib/fedux_org_stdlib/gem_plugins/plugin_manager.rb +6 -7
  31. data/lib/fedux_org_stdlib/list.rb +24 -2
  32. data/lib/fedux_org_stdlib/logging.rb +3 -2
  33. data/lib/fedux_org_stdlib/logging/logger.rb +7 -7
  34. data/lib/fedux_org_stdlib/logging/severity.rb +3 -0
  35. data/lib/fedux_org_stdlib/logic_converters.rb +1 -0
  36. data/lib/fedux_org_stdlib/logic_converters/exceptions.rb +2 -2
  37. data/lib/fedux_org_stdlib/logic_converters/logic_converter.rb +9 -8
  38. data/lib/fedux_org_stdlib/logic_converters/on_off_converter.rb +5 -4
  39. data/lib/fedux_org_stdlib/logic_converters/true_false_converter.rb +3 -3
  40. data/lib/fedux_org_stdlib/logic_converters/y_n_converter.rb +3 -3
  41. data/lib/fedux_org_stdlib/logic_converters/yes_no_converter.rb +4 -3
  42. data/lib/fedux_org_stdlib/models/base_model.rb +24 -25
  43. data/lib/fedux_org_stdlib/models/class_based_model.rb +15 -14
  44. data/lib/fedux_org_stdlib/models/exceptions.rb +14 -15
  45. data/lib/fedux_org_stdlib/models/filesystem_based_model.rb +12 -15
  46. data/lib/fedux_org_stdlib/process_environment.rb +11 -1
  47. data/lib/fedux_org_stdlib/project.rb +0 -1
  48. data/lib/fedux_org_stdlib/project/generators/taskjuggler.rb +11 -10
  49. data/lib/fedux_org_stdlib/project/logger.rb +1 -0
  50. data/lib/fedux_org_stdlib/project/plan.rb +1 -1
  51. data/lib/fedux_org_stdlib/project/report.rb +8 -9
  52. data/lib/fedux_org_stdlib/rake/project.rb +4 -4
  53. data/lib/fedux_org_stdlib/rake/project_task.rb +2 -3
  54. data/lib/fedux_org_stdlib/rake/shell_task.rb +7 -7
  55. data/lib/fedux_org_stdlib/rake/sub_task.rb +2 -2
  56. data/lib/fedux_org_stdlib/rake/task.rb +7 -6
  57. data/lib/fedux_org_stdlib/rake/version_bump_task.rb +6 -7
  58. data/lib/fedux_org_stdlib/rake_tasks/console.rb +0 -1
  59. data/lib/fedux_org_stdlib/rake_tasks/documentation/yard.rb +2 -2
  60. data/lib/fedux_org_stdlib/rake_tasks/gems/bundler.rb +1 -1
  61. data/lib/fedux_org_stdlib/rake_tasks/gems/package.rb +1 -1
  62. data/lib/fedux_org_stdlib/rake_tasks/project/report/generate.rb +1 -2
  63. data/lib/fedux_org_stdlib/rake_tasks/project/report/open.rb +1 -2
  64. data/lib/fedux_org_stdlib/rake_tasks/project/report/open_shortcut.rb +1 -1
  65. data/lib/fedux_org_stdlib/rake_tasks/qa/rubocop.rb +1 -1
  66. data/lib/fedux_org_stdlib/rake_tasks/qa/travis.rb +1 -1
  67. data/lib/fedux_org_stdlib/rake_tasks/software_version/bump.rb +1 -1
  68. data/lib/fedux_org_stdlib/rake_tasks/software_version/restore.rb +1 -1
  69. data/lib/fedux_org_stdlib/rake_tasks/software_version/show.rb +2 -3
  70. data/lib/fedux_org_stdlib/rake_tasks/software_version/show_shortcut.rb +1 -1
  71. data/lib/fedux_org_stdlib/rake_tasks/tests/cucumber.rb +0 -1
  72. data/lib/fedux_org_stdlib/rake_tasks/tests/travis.rb +1 -1
  73. data/lib/fedux_org_stdlib/require_files.rb +5 -4
  74. data/lib/fedux_org_stdlib/roles/typable.rb +2 -3
  75. data/lib/fedux_org_stdlib/roles/versionable.rb +3 -2
  76. data/lib/fedux_org_stdlib/shell_language_detector.rb +21 -2
  77. data/lib/fedux_org_stdlib/shell_language_detector/language.rb +9 -1
  78. data/lib/fedux_org_stdlib/support_information.rb +60 -55
  79. data/lib/fedux_org_stdlib/template_directory.rb +8 -11
  80. data/lib/fedux_org_stdlib/version.rb +1 -1
  81. data/lib/fedux_org_stdlib/version_management/library_builder.rb +3 -2
  82. data/lib/fedux_org_stdlib/version_management/ruby_library.rb +2 -2
  83. data/lib/fedux_org_stdlib/version_management/rubygem_version_file.rb +3 -3
  84. data/lib/fedux_org_stdlib/version_management/rubygem_version_file_parser.rb +5 -5
  85. data/lib/fedux_org_stdlib/version_management/software_version.rb +4 -3
  86. data/lib/fedux_org_stdlib/version_management/version_builder.rb +1 -0
  87. data/rakefiles/default.rake +16 -0
  88. data/script/terminal +5 -5
  89. data/spec/app_config_spec.rb +6 -6
  90. data/spec/colors/html_color_spec.rb +1 -1
  91. data/spec/core_ext/array/list_spec.rb +8 -8
  92. data/spec/core_ext/hash/options_spec.rb +17 -17
  93. data/spec/core_ext/shellwords/clean_spec.rb +1 -1
  94. data/spec/environment_spec.rb +7 -5
  95. data/spec/examples/models/class_based/invalid_2.rb +1 -1
  96. data/spec/examples/models/class_based/valid_2.rb +1 -0
  97. data/spec/gem_plugins/plugin_manager_spec.rb +1 -1
  98. data/spec/logger/logger_spec.rb +1 -1
  99. data/spec/models/base_model_spec.rb +22 -22
  100. data/spec/models/class_based_model_spec.rb +66 -66
  101. data/spec/models/filesystem_based_model_spec.rb +28 -28
  102. data/spec/project/plan_spec.rb +1 -1
  103. data/spec/project/report_spec.rb +2 -2
  104. data/spec/project/taskjuggler_spec.rb +4 -4
  105. data/spec/spec_helper.rb +1 -3
  106. data/spec/support/rspec.rb +1 -1
  107. data/spec/version_management/library_builder_spec.rb +2 -2
  108. data/spec/version_management/ruby_library_spec.rb +2 -2
  109. data/spec/version_management/rubygem_version_file_parser_spec.rb +8 -8
  110. data/spec/version_management/rubygem_version_file_spec.rb +8 -8
  111. data/spec/version_management/software_version_spec.rb +1 -1
  112. metadata +5 -2
@@ -3,7 +3,7 @@ require 'fedux_org_stdlib/require_files'
3
3
  require 'fedux_org_stdlib/template_directory/exceptions'
4
4
  require 'fedux_org_stdlib/core_ext/array/list'
5
5
  require 'fedux_org_stdlib/logging/logger'
6
- require_library %w{ json active_support/core_ext/string/inflections }
6
+ require_library %w(json active_support/core_ext/string/inflections)
7
7
 
8
8
  module FeduxOrgStdlib
9
9
  # This class makes a template file available as an object. You can use
@@ -25,7 +25,7 @@ module FeduxOrgStdlib
25
25
  # off, e.g "ClientTemplateDirectory" becomes "clients.d"
26
26
  #
27
27
  # Most conventions defined by me are implemented as separate methods. If one convention
28
- # is not suitable for your use case, just overwrite the method.
28
+ # is not suitable for your use case, just overwrite the method.
29
29
  #
30
30
  # If you prefer to use a different path to the template file or name of the
31
31
  # template file one of the following methods needs to be overwritten:
@@ -47,7 +47,6 @@ module FeduxOrgStdlib
47
47
  # end
48
48
  # end
49
49
  class TemplateDirectory
50
-
51
50
  attr_reader :working_directory, :logger, :directory, :template_files
52
51
 
53
52
  # Create a new instance of template
@@ -64,24 +63,23 @@ module FeduxOrgStdlib
64
63
  # @return [AppTemplate]
65
64
  # The template instance. If the resulting data structure created by the
66
65
  # template_engine does not respond to `:[]` an empty template object will be
67
- # created.
66
+ # created.
68
67
  def initialize(
69
68
  directory: nil,
70
69
  logger: FeduxOrgStdlib::Logging::Logger.new,
71
- working_directory: Dir.getwd,
72
- output_directory: nil
70
+ working_directory: Dir.getwd
73
71
  )
74
72
  @logger = logger
75
73
  @working_directory = working_directory
76
74
 
77
- @directory ||= available_template_directory
78
-
75
+ @directory ||= (directory || available_template_directory)
76
+
79
77
  fail Exceptions::NoTemplateDirectoryFound, "No template directory found at #{allowed_template_directory_paths.to_list}, therefor I'm stop working as there are methods which depend on an available template directory path." unless @directory
80
78
 
81
79
  begin
82
80
  @template_files = Dir.glob(File.join(@directory, '**', '*')).keep_if { |o| FileTest.file? o }
83
81
  rescue StandardError => e
84
- fail Exceptions::TemplateDirectoryNotReadable, JSON.dump(message: e.message, file: @directory)
82
+ raise Exceptions::TemplateDirectoryNotReadable, JSON.dump(message: e.message, file: @directory)
85
83
  end
86
84
  end
87
85
 
@@ -169,7 +167,6 @@ module FeduxOrgStdlib
169
167
  ::File.expand_path(::File.join(*path))
170
168
  end
171
169
 
172
-
173
170
  # Use this path as fall back path
174
171
  def fallback_template_directory; end
175
172
 
@@ -191,7 +188,7 @@ module FeduxOrgStdlib
191
188
  end
192
189
 
193
190
  def self.reserved_key_words
194
- (methods | instance_methods | private_methods | private_instance_methods ) - (Class.methods | Class.private_methods ) | [:to_s]
191
+ (methods | instance_methods | private_methods | private_instance_methods) - (Class.methods | Class.private_methods) | [:to_s]
195
192
  end
196
193
  end
197
194
  end
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
  # FeduxOrgStdlib
3
3
  module FeduxOrgStdlib
4
- VERSION = '0.7.21'
4
+ VERSION = '0.7.22'
5
5
  end
@@ -3,9 +3,10 @@ require 'fedux_org_stdlib/version_management/ruby_library'
3
3
 
4
4
  module FeduxOrgStdlib
5
5
  module VersionManagement
6
+ # Build library object
6
7
  class LibraryBuilder
7
- def build_from( *args )
8
- RubyLibrary.new( *args )
8
+ def build_from(*args)
9
+ RubyLibrary.new(*args)
9
10
  end
10
11
  end
11
12
  end
@@ -1,11 +1,11 @@
1
1
  # encoding: utf-8
2
2
  module FeduxOrgStdlib
3
3
  module VersionManagement
4
+ # A ruby library
4
5
  class RubyLibrary
5
-
6
6
  attr_reader :module_names
7
7
 
8
- def initialize( module_names )
8
+ def initialize(module_names)
9
9
  @module_names = module_names
10
10
  end
11
11
  end
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  require 'fedux_org_stdlib/require_files'
3
- require_library %w{ erubis forwardable active_support/core_ext/string/strip active_support/core_ext/object/blank }
3
+ require_library %w(erubis forwardable active_support/core_ext/string/strip active_support/core_ext/object/blank)
4
4
 
5
5
  require 'fedux_org_stdlib/version_management/rubygem_version_file_parser'
6
6
  require 'fedux_org_stdlib/version_management/version_builder'
@@ -9,6 +9,7 @@ require 'fedux_org_stdlib/version_management/exceptions'
9
9
 
10
10
  module FeduxOrgStdlib
11
11
  module VersionManagement
12
+ # Ruby version file
12
13
  class RubygemVersionFile
13
14
  extend Forwardable
14
15
 
@@ -41,7 +42,7 @@ module FeduxOrgStdlib
41
42
  end
42
43
 
43
44
  def to_s
44
- klass = Class.new do
45
+ klass = Class.new do
45
46
  attr_reader :version, :library
46
47
 
47
48
  def initialize(version, module_names)
@@ -72,7 +73,6 @@ module FeduxOrgStdlib
72
73
  <% end -%>
73
74
  EOF
74
75
  end
75
-
76
76
  end
77
77
  end
78
78
  end
@@ -3,20 +3,20 @@ require 'json'
3
3
  require 'fedux_org_stdlib/version_management/exceptions'
4
4
 
5
5
  module FeduxOrgStdlib
6
+ # Version management
6
7
  module VersionManagement
8
+ # Ruby version file parser
7
9
  class RubygemVersionFileParser
8
-
9
10
  attr_reader :version, :modules
10
11
 
11
12
  def parse(file)
12
13
  data = File.read(file)
13
14
 
14
- @version = data.match(/(?:VERSION|Version)\s+=\s+["']([^'"]+)["']/) { $1 }
15
- @modules = data.scan( /^\s*module\s+([A-Z][A-Za-z0-9]+(?:::[A-Z][A-Z0-9a-z]+)*)$/x ).flatten
15
+ @version = data.match(/(?:VERSION|Version)\s+=\s+["']([^'"]+)["']/) { Regexp.last_match[1] }
16
+ @modules = data.scan(/^\s*module\s+([A-Z][A-Za-z0-9]+(?:::[A-Z][A-Z0-9a-z]+)*)$/x).flatten
16
17
 
17
- raise Exceptions::VersionFileInvalid, JSON.dump(file: file) if self.version.blank?
18
+ fail Exceptions::VersionFileInvalid, JSON.dump(file: file) if version.blank?
18
19
  end
19
-
20
20
  end
21
21
  end
22
22
  end
@@ -1,9 +1,10 @@
1
1
  # encoding: utf-8
2
2
  require 'fedux_org_stdlib/require_files'
3
- require_library %w{ versionomy forwardable }
3
+ require_library %w(versionomy forwardable)
4
4
 
5
5
  module FeduxOrgStdlib
6
6
  module VersionManagement
7
+ # Software version
7
8
  class SoftwareVersion
8
9
  extend Forwardable
9
10
 
@@ -13,8 +14,8 @@ module FeduxOrgStdlib
13
14
  @version = Versionomy.parse(version)
14
15
  end
15
16
 
16
- def update( *args )
17
- initialize( *args )
17
+ def update(*args)
18
+ initialize(*args)
18
19
  end
19
20
 
20
21
  def bump(type)
@@ -3,6 +3,7 @@ require 'fedux_org_stdlib/version_management/software_version'
3
3
 
4
4
  module FeduxOrgStdlib
5
5
  module VersionManagement
6
+ # Build version
6
7
  class VersionBuilder
7
8
  def build_from(*args)
8
9
  SoftwareVersion.new(*args)
@@ -8,3 +8,19 @@ desc 'Show help for rake'
8
8
  task :default do
9
9
  sh 'bundle exec rake -T'
10
10
  end
11
+
12
+ desc 'Run test suite'
13
+ task test: ['test:rubocop', 'test:rspec']
14
+
15
+ namespace :test do
16
+ desc 'Test with coveralls'
17
+ task coveralls: ['test', 'coveralls:push']
18
+
19
+ require 'rubocop/rake_task'
20
+ RuboCop::RakeTask.new
21
+
22
+ desc 'Run rspec'
23
+ task :rspec do
24
+ sh 'bundle exec rspec'
25
+ end
26
+ end
data/script/terminal CHANGED
@@ -4,10 +4,10 @@
4
4
  require 'tmrb'
5
5
 
6
6
  tmux = TmRb::Multiplexer.new
7
- #creates an empty window
8
- tmux.new_session(:session_name => "fedux_org-stdlib")
7
+ # creates an empty window
8
+ tmux.new_session(session_name: 'fedux_org-stdlib')
9
9
 
10
- tmux.new_window(:name => 'models', :command => 'vim -c \"NERDTree lib/fedux_org_stdlib/models\"')
11
- tmux.new_window(:name => 'logging', :command => 'vim -c \"NERDTree lib/fedux_org_stdlib/logging\"')
12
- tmux.new_window(:name => 'spec', :command => 'vim -c \"NERDTree spec\"')
10
+ tmux.new_window(name: 'models', command: 'vim -c \"NERDTree lib/fedux_org_stdlib/models\"')
11
+ tmux.new_window(name: 'logging', command: 'vim -c \"NERDTree lib/fedux_org_stdlib/logging\"')
12
+ tmux.new_window(name: 'spec', command: 'vim -c \"NERDTree spec\"')
13
13
  tmux.start
@@ -45,9 +45,9 @@ RSpec.describe AppConfig do
45
45
  expect(config.opt1).to be_nil
46
46
 
47
47
  silence :stderr do
48
- expect {
48
+ expect do
49
49
  config.opt1 = 'blub'
50
- }.to raise_error NoMethodError
50
+ end.to raise_error NoMethodError
51
51
  end
52
52
  end
53
53
  end
@@ -329,10 +329,10 @@ RSpec.describe AppConfig do
329
329
  end
330
330
 
331
331
  result = capture :stderr do
332
- config_klass.new
332
+ config_klass.new
333
333
  end
334
334
 
335
- expect(result).to include "There seems"
335
+ expect(result).to include 'There seems'
336
336
  end
337
337
  end
338
338
  end
@@ -343,7 +343,7 @@ RSpec.describe AppConfig do
343
343
  config_klass = Class.new(AppConfig) do
344
344
  option :opt1, 'test1'
345
345
  option :opt2, 'test2'
346
- option :opt3, { opt1: 'test1', opt2: 'test2' }
346
+ option :opt3, opt1: 'test1', opt2: 'test2'
347
347
 
348
348
  def _class_name
349
349
  'TestConfig'
@@ -401,7 +401,7 @@ RSpec.describe AppConfig do
401
401
  config_klass = Class.new(AppConfig) do
402
402
  option :opt1, 'test1'
403
403
  option :opt2, 'test2'
404
- option :opt3, { opt1: 'test1', opt2: 'test2' }
404
+ option :opt3, opt1: 'test1', opt2: 'test2'
405
405
 
406
406
  def _class_name
407
407
  'TestConfig'
@@ -20,6 +20,6 @@ RSpec.describe FeduxOrgStdlib::Colors::HtmlColor do
20
20
  it 'fails if no hex number is given' do
21
21
  expect(FeduxOrgStdlib::Colors::HtmlColor.new('#ZZAAZZ')).not_to be_valid
22
22
  end
23
-
23
+
24
24
  end
25
25
  end
@@ -5,49 +5,49 @@ require 'fedux_org_stdlib/core_ext/array/list'
5
5
  RSpec.describe Array do
6
6
  context '#to_list' do
7
7
  it 'handles single value' do
8
- input = %w{ test }
8
+ input = %w(test)
9
9
 
10
10
  expect(input.to_list).to eq '"test"'
11
11
  end
12
12
 
13
13
  it 'handles two values' do
14
- input = %w{ test1 test2 }
14
+ input = %w(test1 test2)
15
15
 
16
16
  expect(input.to_list).to eq '"test1", "test2"'
17
17
  end
18
18
 
19
19
  it 'converts array to a list of values' do
20
- input = %w{ test1 test2 test3 }
20
+ input = %w(test1 test2 test3)
21
21
 
22
22
  expect(input.to_list).to eq '"test1", "test2", "test3"'
23
23
  end
24
24
 
25
25
  it 'converts array to a list of values' do
26
- input = %w{ test1 test2 test3 test4 }
26
+ input = %w(test1 test2 test3 test4)
27
27
 
28
28
  expect(input.to_list).to eq '"test1", "test2", "test3", "test4"'
29
29
  end
30
30
 
31
31
  it 'supports to change the last separator' do
32
- input = %w{ test1 test2 test3}
32
+ input = %w(test1 test2 test3)
33
33
 
34
34
  expect(input.to_list(last_separator: ' or ')).to eq '"test1", "test2" or "test3"'
35
35
  end
36
36
 
37
37
  it 'supports to change the separator' do
38
- input = %w{ test1 test2 test3}
38
+ input = %w(test1 test2 test3)
39
39
 
40
40
  expect(input.to_list(separator: ':')).to eq '"test1":"test2":"test3"'
41
41
  end
42
42
 
43
43
  it 'change multiple things' do
44
- input = %w{ test1 test2 test3}
44
+ input = %w(test1 test2 test3)
45
45
 
46
46
  expect(input.to_list(around: '', separator: ':')).to eq 'test1:test2:test3'
47
47
  end
48
48
 
49
49
  it 'supports to change the string to surround items' do
50
- input = %w{ test1 test2 test3}
50
+ input = %w(test1 test2 test3)
51
51
 
52
52
  expect(input.to_list(around: '$')).to eq '$test1$, $test2$, $test3$'
53
53
  end
@@ -4,69 +4,69 @@ require 'fedux_org_stdlib/core_ext/hash/options'
4
4
 
5
5
  RSpec.describe '#to_options' do
6
6
  it 'converts hash to array of command line options' do
7
- hash = { }
7
+ hash = {}
8
8
 
9
9
  expect(hash.to_options).to be_kind_of Array
10
10
  end
11
11
 
12
12
  it 'converts true value' do
13
- hash = {
13
+ hash = {
14
14
  opt1: true
15
15
  }
16
16
 
17
- expect(hash.to_options).to eq %w{ --opt1 }
17
+ expect(hash.to_options).to eq %w(--opt1)
18
18
  end
19
19
 
20
20
  it 'converts false value' do
21
- hash = {
21
+ hash = {
22
22
  opt1: false
23
23
  }
24
24
 
25
- expect(hash.to_options).to eq %w{ --no-opt1 }
25
+ expect(hash.to_options).to eq %w(--no-opt1)
26
26
  end
27
27
 
28
28
  it 'converts integervalue' do
29
- hash = {
29
+ hash = {
30
30
  opt1: 1
31
31
  }
32
32
 
33
- expect(hash.to_options).to eq %w{ --opt1 1 }
33
+ expect(hash.to_options).to eq %w(--opt1 1)
34
34
  end
35
35
 
36
36
  it 'converts string value' do
37
- hash = {
37
+ hash = {
38
38
  opt1: 'string'
39
39
  }
40
40
 
41
- expect(hash.to_options).to eq %w{ --opt1 string }
41
+ expect(hash.to_options).to eq %w(--opt1 string)
42
42
  end
43
43
 
44
44
  it 'converts symbol value' do
45
- hash = {
45
+ hash = {
46
46
  opt1: :string
47
47
  }
48
48
 
49
- expect(hash.to_options).to eq %w{ --opt1 string }
49
+ expect(hash.to_options).to eq %w(--opt1 string)
50
50
  end
51
51
 
52
52
  it 'handles umlauts as well' do
53
- hash = {
54
- "öäopt1" => 'string'
53
+ hash = {
54
+ 'öäopt1' => 'string'
55
55
  }
56
56
 
57
- expect(hash.to_options).to eq %w{ --opt1 string }
57
+ expect(hash.to_options).to eq %w(--opt1 string)
58
58
  end
59
59
 
60
60
  it 'handles special characters as well' do
61
- hash = {
61
+ hash = {
62
62
  "$o p\tt1" => 'string'
63
63
  }
64
64
 
65
- expect(hash.to_options).to eq %w{ --opt1 string }
65
+ expect(hash.to_options).to eq %w(--opt1 string)
66
66
  end
67
67
 
68
68
  it 'handles special characters in value as well' do
69
- hash = {
69
+ hash = {
70
70
  opt1: 'string$string string'
71
71
  }
72
72
 
@@ -16,7 +16,7 @@ RSpec.describe '.shellclean' do
16
16
  end
17
17
 
18
18
  it 'removes $' do
19
- result = Shellwords.clean("asdf$asdf")
19
+ result = Shellwords.clean('asdf$asdf')
20
20
 
21
21
  expect(result).to eq 'asdfasdf'
22
22
  end
@@ -5,7 +5,7 @@ RSpec.describe FeduxOrgStdlib::Environment do
5
5
  context '#isolated_environment' do
6
6
  it 'runs command in isolated environment' do
7
7
  klass = Class.new do
8
- include FeduxOrgStdlib::Environment
8
+ include FeduxOrgStdlib::Environment
9
9
 
10
10
  def test_env
11
11
  isolated_environment 'TEST_VAR' => 'this is a test' do
@@ -19,12 +19,12 @@ RSpec.describe FeduxOrgStdlib::Environment do
19
19
 
20
20
  it 'let you define an environment before running a command' do
21
21
  klass = Class.new do
22
- include FeduxOrgStdlib::Environment
22
+ include FeduxOrgStdlib::Environment
23
23
 
24
24
  def test_env
25
25
  isolated_environment({}, { clear: true }) do
26
26
 
27
- #are set by the terminal and can hardly be cleared
27
+ # are set by the terminal and can hardly be cleared
28
28
  ENV.delete('COLUMNS')
29
29
  ENV.delete('LINES')
30
30
 
@@ -38,17 +38,19 @@ RSpec.describe FeduxOrgStdlib::Environment do
38
38
 
39
39
  it 'restores environment although an exception occured' do
40
40
  klass = Class.new do
41
- include FeduxOrgStdlib::Environment
41
+ include FeduxOrgStdlib::Environment
42
42
 
43
43
  def test_env
44
44
  ENV['TEST_VAR'] = 'TEST'
45
45
 
46
+ # rubocop:disable Lint/HandleExceptions
46
47
  begin
47
48
  isolated_environment({}, { clear: true }) do
48
- raise
49
+ fail
49
50
  end
50
51
  rescue
51
52
  end
53
+ # rubocop:enable Lint/HandleExceptions
52
54
 
53
55
  ENV['TEST_VAR']
54
56
  end