skippy 0.4.1.a → 0.5.1.a

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ce2b2452959a54d094d90bac57789f3738137f7d94ce844db4a6a2b08788925d
4
- data.tar.gz: f3984931967ac74cfb3d5c8c233855385e0bee8c046d4d8156c0fec1d503d320
3
+ metadata.gz: 4b5027ab23b2e38af2c0ac8fb2cc2f791e5719d25b5f2e3ea05ab90974a326f4
4
+ data.tar.gz: f4497bbd058f6478fbeb675921204f4ed635351a3fd2b3d01f5500ab1c872aee
5
5
  SHA512:
6
- metadata.gz: b18020a84524b9d4842e22939ada7fdf9f1edec500a4dce6d9ff6642ef47d335c46debb5c7933a4e504c191eb953af5a4654977787b9ce6e1734e408c1019f7f
7
- data.tar.gz: 1836e67a3a1a547b3f7f9caa96d729157246621df36045171920e234eeccc9224419730a53dddf6d17a603b6d1871135d2ad1dcd99472fd34dbc833c4d3f19a3
6
+ metadata.gz: 06f649ddef3a1cd1a8b21ed1a7ba9e1f518e03d491b5539bb1d0d0785a5016ec190a8b23f012928cd657beca2b11bfb114ceaa3b7e35bd414bbd9064140b4296
7
+ data.tar.gz: 3e50720776f25fc0a97ae4ca022cb039caf9d2d28acc81cd5b81edafd3d8d9b3119b0ef06c0d32530e96e874743479053f2ec1b8fe0704180d953d63ea30e954
data/.appveyor.yml ADDED
@@ -0,0 +1,35 @@
1
+ version: "{build}-{branch}"
2
+
3
+ branches:
4
+ only:
5
+ - master
6
+ - dev-appveyor
7
+
8
+ cache:
9
+ - vendor/bundle
10
+
11
+ environment:
12
+ matrix:
13
+ - RUBY_VERSION: 25
14
+ - RUBY_VERSION: 26
15
+
16
+ install:
17
+ - set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH%
18
+ # - gem update --no-document --system 2.7.8
19
+ # - gem install bundler --no-document --version="<3.0.0"
20
+ #
21
+ # https://github.com/ruby/psych/issues/519
22
+ - gem uninstall psych # Workaround bug. (https://stackoverflow.com/a/69088551)
23
+ - bundle config --local path vendor/bundle
24
+ - bundle install
25
+ - git submodule update --init --recursive
26
+
27
+ build: off
28
+
29
+ before_test:
30
+ - ruby -v
31
+ - gem -v
32
+ - bundle -v
33
+
34
+ test_script:
35
+ - bundle exec rake
data/.rubocop.yml CHANGED
@@ -1,5 +1,9 @@
1
1
  inherit_from: .rubocop_todo.yml
2
2
 
3
+ require:
4
+ - rubocop-minitest
5
+ - rubocop-rake
6
+
3
7
  AllCops:
4
8
  Exclude:
5
9
  - 'bin/**/*'
@@ -9,8 +13,10 @@ AllCops:
9
13
  - 'vendor/**/*'
10
14
  DisplayCopNames: true
11
15
 
12
- Layout/AlignParameters:
16
+
17
+ Layout/ArgumentAlignment:
13
18
  EnforcedStyle: with_fixed_indentation
19
+ # IndentationWidth: 2
14
20
 
15
21
  # It's ok to have more than one empty line to create a 'paragrapth'.
16
22
  Layout/EmptyLines:
@@ -26,6 +32,7 @@ Layout/EmptyLinesAroundModuleBody:
26
32
 
27
33
  # Normally one line in between, but two allowed for "paragraphs".
28
34
  Layout/EmptyLineBetweenDefs:
35
+ AllowAdjacentOneLineDefs: true
29
36
  NumberOfEmptyLines: [1, 2]
30
37
 
31
38
  # Rely on Git to normalize end of lines.
@@ -36,6 +43,18 @@ Layout/EndOfLine:
36
43
  Layout/EmptyLinesAroundBlockBody:
37
44
  Enabled: false
38
45
 
46
+ Layout/LineLength:
47
+ Exclude:
48
+ - features/step_definitions/**/*
49
+
50
+ Layout/ParameterAlignment:
51
+ EnforcedStyle: with_fixed_indentation
52
+
53
+
54
+ Naming/RescuedExceptionsVariableName:
55
+ PreferredName: error
56
+
57
+
39
58
  Metrics/AbcSize:
40
59
  Enabled: false
41
60
  Exclude:
@@ -49,10 +68,6 @@ Metrics/ClassLength:
49
68
  Metrics/CyclomaticComplexity:
50
69
  Enabled: false
51
70
 
52
- Metrics/LineLength:
53
- Exclude:
54
- - features/step_definitions/**/*
55
-
56
71
  Metrics/MethodLength:
57
72
  Exclude:
58
73
  - test/**/*
@@ -61,6 +76,11 @@ Metrics/MethodLength:
61
76
  Metrics/PerceivedComplexity:
62
77
  Enabled: false
63
78
 
79
+
80
+ # Nah, sometimes easier to read with accessors having separate grouping.
81
+ Style/AccessorGrouping:
82
+ Enabled: false
83
+
64
84
  # Prefer { ... } over do ... end except for control flow and
65
85
  # method defintions. Unfortunatly, no cop configuration for this.
66
86
  # https://github.com/chneukirchen/styleguide/blob/e60de37b478d3f892f6985a58d573016f33f0269/RUBY-STYLE#L63-L67
@@ -102,6 +122,13 @@ Style/IfUnlessModifier:
102
122
  Style/ModuleFunction:
103
123
  Enabled: false
104
124
 
125
+ # Excluding some files that copies the Thor implementation.
126
+ # TODO: Investigate if Thor changed their implementation.
127
+ Style/OptionalBooleanParameter:
128
+ Exclude:
129
+ - lib/skippy/cli.rb
130
+ - lib/skippy/command.rb
131
+
105
132
  # %w and %i etc isn't really intuitive unless you are really familiar with the
106
133
  # syntax. %w seems used often enough. But [:symbol, :foo] reads clearer than
107
134
  # %i(symbol foo).
@@ -109,5 +136,140 @@ Style/SymbolArray:
109
136
  Enabled: False
110
137
 
111
138
  # Add trailing comma so it's easy to duplicate/add lines.
112
- Style/TrailingCommaInLiteral:
139
+ Style/TrailingCommaInArrayLiteral:
140
+ EnforcedStyleForMultiline: consistent_comma
141
+
142
+ Style/TrailingCommaInHashLiteral:
113
143
  EnforcedStyleForMultiline: consistent_comma
144
+
145
+
146
+ # Not testing computed values, but serialized values.
147
+ # Ignoring floating point tolerance is fine (and wanted) in this case.
148
+ Minitest/AssertInDelta:
149
+ Enabled: false
150
+
151
+ # Too many false positives.
152
+ Minitest/AssertWithExpectedArgument:
153
+ Enabled: false
154
+
155
+ # No such thing as too many assertions.
156
+ Minitest/MultipleAssertions:
157
+ Enabled: false
158
+
159
+
160
+ ################################################################################
161
+ # Enabling new cops:
162
+
163
+ Gemspec/DateAssignment: # new in 1.10
164
+ Enabled: true
165
+ Layout/LineEndStringConcatenationIndentation: # new in 1.18
166
+ Enabled: true
167
+ Layout/SpaceBeforeBrackets: # new in 1.7
168
+ Enabled: true
169
+ Lint/AmbiguousAssignment: # new in 1.7
170
+ Enabled: true
171
+ Lint/AmbiguousOperatorPrecedence: # new in 1.21
172
+ Enabled: true
173
+ Lint/AmbiguousRange: # new in 1.19
174
+ Enabled: true
175
+ Lint/DeprecatedConstants: # new in 1.8
176
+ Enabled: true
177
+ Lint/DuplicateBranch: # new in 1.3
178
+ Enabled: true
179
+ Lint/DuplicateRegexpCharacterClassElement: # new in 1.1
180
+ Enabled: true
181
+ Lint/EmptyBlock: # new in 1.1
182
+ Enabled: true
183
+ Lint/EmptyClass: # new in 1.3
184
+ Enabled: true
185
+ Lint/EmptyInPattern: # new in 1.16
186
+ Enabled: true
187
+ Lint/IncompatibleIoSelectWithFiberScheduler: # new in 1.21
188
+ Enabled: true
189
+ Lint/LambdaWithoutLiteralBlock: # new in 1.8
190
+ Enabled: true
191
+ Lint/NoReturnInBeginEndBlocks: # new in 1.2
192
+ Enabled: true
193
+ Lint/NumberedParameterAssignment: # new in 1.9
194
+ Enabled: true
195
+ Lint/OrAssignmentToConstant: # new in 1.9
196
+ Enabled: true
197
+ Lint/RedundantDirGlobSort: # new in 1.8
198
+ Enabled: true
199
+ Lint/RequireRelativeSelfPath: # new in 1.22
200
+ Enabled: true
201
+ Lint/SymbolConversion: # new in 1.9
202
+ Enabled: true
203
+ Lint/ToEnumArguments: # new in 1.1
204
+ Enabled: true
205
+ Lint/TripleQuotes: # new in 1.9
206
+ Enabled: true
207
+ Lint/UnexpectedBlockArity: # new in 1.5
208
+ Enabled: true
209
+ Lint/UnmodifiedReduceAccumulator: # new in 1.1
210
+ Enabled: true
211
+ Security/IoMethods: # new in 1.22
212
+ Enabled: true
213
+ Style/ArgumentsForwarding: # new in 1.1
214
+ Enabled: true
215
+ Style/CollectionCompact: # new in 1.2
216
+ Enabled: true
217
+ Style/DocumentDynamicEvalDefinition: # new in 1.1
218
+ Enabled: true
219
+ Style/EndlessMethod: # new in 1.8
220
+ Enabled: true
221
+ Style/HashConversion: # new in 1.10
222
+ Enabled: true
223
+ Style/HashExcept: # new in 1.7
224
+ Enabled: true
225
+ Style/IfWithBooleanLiteralBranches: # new in 1.9
226
+ Enabled: true
227
+ Style/InPatternThen: # new in 1.16
228
+ Enabled: true
229
+ Style/MultilineInPatternThen: # new in 1.16
230
+ Enabled: true
231
+ Style/NegatedIfElseCondition: # new in 1.2
232
+ Enabled: true
233
+ Style/NilLambda: # new in 1.3
234
+ Enabled: true
235
+ Style/NumberedParameters: # new in 1.22
236
+ Enabled: true
237
+ Style/NumberedParametersLimit: # new in 1.22
238
+ Enabled: true
239
+ Style/QuotedSymbols: # new in 1.16
240
+ Enabled: true
241
+ Style/RedundantArgument: # new in 1.4
242
+ Enabled: true
243
+ Style/RedundantSelfAssignmentBranch: # new in 1.19
244
+ Enabled: true
245
+ Style/SelectByRegexp: # new in 1.22
246
+ Enabled: true
247
+ Style/StringChars: # new in 1.12
248
+ Enabled: true
249
+ Style/SwapValues: # new in 1.1
250
+ Enabled: true
251
+
252
+ Minitest/AssertionInLifecycleHook: # new in 0.10
253
+ Enabled: true
254
+ Minitest/AssertKindOf: # new in 0.10
255
+ Enabled: true
256
+ Minitest/AssertOutput: # new in 0.10
257
+ Enabled: true
258
+ Minitest/AssertPathExists: # new in 0.10
259
+ Enabled: true
260
+ Minitest/AssertSilent: # new in 0.10
261
+ Enabled: true
262
+ Minitest/LiteralAsActualArgument: # new in 0.10
263
+ Enabled: true
264
+ Minitest/RefuteInDelta: # new in 0.10
265
+ Enabled: true
266
+ Minitest/RefuteKindOf: # new in 0.10
267
+ Enabled: true
268
+ Minitest/RefutePathExists: # new in 0.10
269
+ Enabled: true
270
+ Minitest/TestMethodName: # new in 0.10
271
+ Enabled: true
272
+ Minitest/UnreachableAssertion: # new in 0.14
273
+ Enabled: true
274
+ Minitest/UnspecifiedException: # new in 0.10
275
+ Enabled: true
@@ -0,0 +1,27 @@
1
+ {
2
+ // See http://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
3
+ // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
4
+ // List of extensions which should be recommended for users of this workspace.
5
+ "recommendations": [
6
+ // Spell checking code and comments are important.
7
+ "streetsidesoftware.code-spell-checker",
8
+
9
+ // Will make VSCode pick up .editorconfig.
10
+ "editorconfig.editorconfig",
11
+
12
+ // Essential for Ruby syntax highlighting and debugging.
13
+ "rebornix.ruby",
14
+
15
+ // For code insight and auto-complete.
16
+ "castwide.solargraph",
17
+
18
+ // Test Explorer UI and adapter
19
+ "hbenl.vscode-test-explorer",
20
+ "matepek.vscode-catch2-test-adapter",
21
+
22
+ // Cucumber highlighting and more.
23
+ "alexkrechik.cucumberautocomplete"
24
+ ],
25
+ // List of extensions recommended by VS Code that should not be recommended for users of this workspace.
26
+ "unwantedRecommendations": []
27
+ }
data/Gemfile CHANGED
@@ -1,18 +1,15 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in skippy.gemspec
4
6
  gemspec
5
7
 
6
8
  group :development do
7
- # Original fork with bug-fix. Appear to be gone now.
8
- # gem 'aruba', git: 'https://github.com/daynix/aruba.git', branch: 'd-win-fix'
9
- # Backup fork of the bug fix:
10
- gem 'aruba', git: 'https://github.com/thomthom/aruba.git',
11
- branch: 'd-win-fix'
12
- # TODO: This might be a newer fix:
13
- # gem 'aruba', git: 'https://github.com/rbld/aruba.git',
14
- # branch: 'aruba-win-fix'
15
9
  gem 'pry'
16
- gem 'rubocop', '~> 0.51.0', require: false
10
+ gem 'rubocop', '~> 1.0', require: false
11
+ gem 'rubocop-minitest', '~> 0.15', require: false
12
+ gem 'rubocop-performance', '~> 1.0', require: false
13
+ gem 'rubocop-rake', '~> 0.6', require: false
17
14
  gem 'webmock', '~> 3.1'
18
15
  end
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Skippy
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/skippy.svg)](https://badge.fury.io/rb/skippy)
3
+ [![Gem Version](https://badge.fury.io/rb/skippy.svg)](https://badge.fury.io/rb/skippy) [![Build status](https://ci.appveyor.com/api/projects/status/qu5nk3t7g5oaymyx/branch/master?svg=true)](https://ci.appveyor.com/project/thomthom/skippy/branch/master)
4
4
 
5
5
  Skippy is a Command Line Interface which aims to automate common developer tasks for SketchUp Ruby extension development.
6
6
 
@@ -32,7 +32,7 @@ For Windows the easiest way to get Ruby running is using the [Ruby Installer for
32
32
  ## Installation
33
33
 
34
34
  ```bash
35
- gem install skippy
35
+ gem install skippy --pre
36
36
  ```
37
37
 
38
38
  ## Usage
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
2
4
  require 'rake/testtask'
3
5
 
@@ -5,6 +7,9 @@ Rake::TestTask.new(:test) do |t|
5
7
  t.libs << 'test'
6
8
  t.libs << 'lib'
7
9
  t.test_files = FileList['test/**/*_test.rb']
10
+ # Turning off because Rake 11 >= turns warning on by default.
11
+ # TODO: Clean up the warnings coming from this project and enable.
12
+ t.warning = false
8
13
  end
9
14
 
10
15
  task default: :test
data/app/boot.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  # Set the program name explicitly. Otherwise Thor will use the filename in the
4
5
  # banner for the command help.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'skippy/namespace'
2
4
 
3
5
  class Debug < Skippy::Command
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'json'
2
4
 
3
5
  require 'skippy/app'
data/app/commands/lib.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'fileutils'
2
4
  require 'json'
3
5
 
@@ -20,7 +22,7 @@ class Lib < Skippy::Command
20
22
  say
21
23
  say "#{library.name} (#{library.version})", [:bold, :yellow]
22
24
  library.modules.each { |lib_module|
23
- lib_info = " #{lib_module}"
25
+ lib_info = +" #{lib_module}"
24
26
  lib_info << ' (installed)' if project.modules.installed?(lib_module)
25
27
  say lib_info, :green
26
28
  }
@@ -75,7 +77,7 @@ class Lib < Skippy::Command
75
77
  private
76
78
 
77
79
  def install_options(cli_options)
78
- options = cli_options.map { |k, v| [k.to_sym, v] }.to_h
80
+ options = cli_options.transform_keys(&:to_sym)
79
81
  # The CLI options "version" is internally a "requirement".
80
82
  if options.key?(:version)
81
83
  options[:requirement] = options[:version]
data/app/commands/new.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'json'
2
4
 
3
5
  require 'skippy/app'
@@ -38,6 +40,7 @@ class New < Skippy::Command::Group
38
40
  if project.exist?
39
41
  raise Skippy::Error, "A project already exist: #{project.filename}"
40
42
  end
43
+
41
44
  project.namespace = namespace
42
45
  project.name = project.namespace.to_name
43
46
  project.basename = options[:basename] || project.namespace.short_name
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'json'
2
4
  require 'stringio'
3
5
 
@@ -15,6 +17,7 @@ class Sketchup < Skippy::Command
15
17
  unless app.can_debug
16
18
  raise Skippy::Error, "Debug library not installed for Sketchup #{version}"
17
19
  end
20
+
18
21
  arguments = ['-rdebug', %("ide port=#{options.port}")]
19
22
  Skippy.os.launch_app(app.executable, *arguments)
20
23
  end
@@ -51,10 +54,14 @@ class Sketchup < Skippy::Command
51
54
  # @param [Integer] version
52
55
  # @return [Skippy::SketchUpApp, nil]
53
56
  def find_sketchup(version)
57
+ # Allow shortcuts such as 18 to mean 2018.
58
+ full_version = version.to_i
59
+ full_version += 2000 if (13..99).cover?(full_version)
54
60
  app = Skippy.os.sketchup_apps.find { |sketchup|
55
- sketchup.version == version.to_i
61
+ sketchup.version == full_version
56
62
  }
57
63
  raise Skippy::Error, "SketchUp #{version} not found." if app.nil?
64
+
58
65
  app
59
66
  end
60
67
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Template < Skippy::Command
2
4
 
3
5
  desc 'list', 'List all known templates'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Hello < Skippy::Command
2
4
 
3
5
  desc 'world PERSON', 'Oh, hi there!'
data/cucumber.yml ADDED
@@ -0,0 +1 @@
1
+ default: --publish-quiet
data/lib/skippy/app.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'pathname'
2
4
 
3
5
  require 'skippy'
@@ -43,6 +45,7 @@ class Skippy::App
43
45
  template_path = templates_source_path.join(entry)
44
46
  next unless template_path.directory?
45
47
  next if %w(. ..).include?(entry.basename.to_s)
48
+
46
49
  result << entry.expand_path(templates_source_path)
47
50
  }
48
51
  result
@@ -54,7 +57,7 @@ class Skippy::App
54
57
  # Load the default skippy commands.
55
58
  path_commands = File.join(path, 'commands')
56
59
  commands_pattern = File.join(path_commands, '*.rb')
57
- Dir.glob(commands_pattern) { |filename|
60
+ Dir.glob(commands_pattern).sort.each { |filename|
58
61
  # noinspection RubyResolve
59
62
  require filename
60
63
  }
data/lib/skippy/cli.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'pathname'
2
4
 
3
5
  require 'skippy/app'
@@ -57,11 +59,12 @@ class Skippy::CLI < Skippy::Command
57
59
  end
58
60
  end
59
61
 
62
+ # rubocop:disable Style/MissingRespondToMissing
60
63
  # Verbatim copy from Thor::Runner:
61
64
  # If a command is not found on Thor::Runner, method missing is invoked and
62
65
  # Thor::Runner is then responsible for finding the command in all classes.
63
66
  #
64
- def method_missing(meth, *args) # rubocop:disable Style/MethodMissing
67
+ def method_missing(meth, *args)
65
68
  meth = meth.to_s
66
69
  initialize_thorfiles(meth)
67
70
  klass, command = Thor::Util.find_class_and_command_by_namespace(meth)
@@ -69,14 +72,15 @@ class Skippy::CLI < Skippy::Command
69
72
  args.unshift(command) if command
70
73
  klass.start(args, shell: shell)
71
74
  end
75
+ # rubocop:enable Style/MissingRespondToMissing
72
76
 
73
77
  # Verbatim copy from Thor::Runner:
74
78
  desc 'list [SEARCH]',
75
79
  "List the available #{$PROGRAM_NAME} commands (--substring means .*SEARCH)"
76
80
  method_options substring: :boolean,
77
- group: :string,
78
- all: :boolean,
79
- debug: :boolean
81
+ group: :string,
82
+ all: :boolean,
83
+ debug: :boolean
80
84
  def list(search = '')
81
85
  initialize_thorfiles
82
86
 
@@ -96,11 +100,6 @@ class Skippy::CLI < Skippy::Command
96
100
  "#{$PROGRAM_NAME} " + command.formatted_usage(self, all, subcommand)
97
101
  end
98
102
 
99
- # Verbatim copy from Thor::Runner:
100
- def self.exit_on_failure?
101
- true
102
- end
103
-
104
103
  private
105
104
 
106
105
  # This is one of the places this runner differ from Thor::Runner. It will
@@ -112,8 +111,9 @@ class Skippy::CLI < Skippy::Command
112
111
  def initialize_thorfiles(_relevant_to = nil, _skip_lookup = false)
113
112
  project = Skippy::Project.new(Dir.pwd)
114
113
  return unless project.exist?
114
+
115
115
  project.command_files { |filename|
116
- unless Thor::Base.subclass_files.keys.include?(File.expand_path(filename))
116
+ unless Thor::Base.subclass_files.key?(File.expand_path(filename))
117
117
  begin
118
118
  Thor::Util.load_thorfile(filename, nil, options[:debug])
119
119
  rescue ScriptError, StandardError => error
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'thor'
2
4
 
3
5
  module Skippy
@@ -9,5 +11,10 @@ module Skippy
9
11
  command.formatted_usage(self, true, subcommand).to_s
10
12
  end
11
13
 
14
+ def self.exit_on_failure?
15
+ # https://github.com/rails/thor/issues/244
16
+ true
17
+ end
18
+
12
19
  end
13
20
  end
data/lib/skippy/config.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'json'
2
4
  require 'pathname'
3
5
 
@@ -35,6 +37,7 @@ class Skippy::Config < Hash
35
37
  item = get_item(key_path)
36
38
  item = set_item(key_path, []) if item.nil?
37
39
  raise ArgumentError, 'key path is not an Array' unless item.is_a?(Array)
40
+
38
41
  item << value
39
42
  end
40
43
 
@@ -52,6 +55,7 @@ class Skippy::Config < Hash
52
55
 
53
56
  def save
54
57
  raise MissingPathError if path.nil?
58
+
55
59
  export(path)
56
60
  end
57
61
 
@@ -117,9 +121,11 @@ class Skippy::Config < Hash
117
121
  def get_item(key_path)
118
122
  parts = key_parts(key_path)
119
123
  return nil if parts.empty?
124
+
120
125
  item = self
121
126
  parts.each { |key|
122
127
  return nil if item.nil?
128
+
123
129
  item = item[key]
124
130
  }
125
131
  item
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'json'
2
4
  require 'pathname'
3
5
 
@@ -15,6 +17,7 @@ module Skippy::ConfigAccessors
15
17
  class_eval do
16
18
  symbols.each { |symbol|
17
19
  raise TypeError unless symbol.is_a?(Symbol)
20
+
18
21
  define_method(symbol) do
19
22
  value = @config.get(key || symbol, default)
20
23
  value = type.new(value) if type && !value.is_a?(type)
@@ -29,6 +32,7 @@ module Skippy::ConfigAccessors
29
32
  class_eval do
30
33
  symbols.each { |symbol|
31
34
  raise TypeError unless symbol.is_a?(Symbol)
35
+
32
36
  symbol_set = "#{symbol}=".intern
33
37
  define_method(symbol_set) do |value|
34
38
  value = type.new(value) if type && !value.is_a?(type)
data/lib/skippy/error.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Skippy
2
4
  class Error < StandardError
3
5
  end
data/lib/skippy/group.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'thor/group'
2
4
 
3
5
  require 'skippy/command'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Skippy::Helpers
2
4
  module File
3
5
 
@@ -7,6 +9,7 @@ module Skippy::Helpers
7
9
  # @return [Array<Pathname>]
8
10
  def directories(pathname)
9
11
  return [] unless pathname.exist?
12
+
10
13
  pathname.children.select(&:directory?)
11
14
  end
12
15