skippy 0.4.0.a → 0.5.0.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: 8911df6fd31addc62c4bc4756eb46f715eaf70ea2d2bcfb32175f104dad78f82
4
- data.tar.gz: dbb042f7ed689a8d1a01589b4f11479014da36861e1cf578453a75eab14028b0
3
+ metadata.gz: caf9e8f9363445b164e56aacb76d61cdb1395532d6128dc173c6ac55900eae85
4
+ data.tar.gz: c122744a1c428a3cb22e73e35f217603e81c931397f60878189ec1c6c0805699
5
5
  SHA512:
6
- metadata.gz: fda57b8e19f1a22ab2ad207bd938df1a5f9ba158400d5126572dc518130f48614cd30082aa4b4ac800fd33aa7c38fd32c712dfd4c7c5aac36432bc21762c0b6d
7
- data.tar.gz: e43b4802ac2f2b0c2a60e5b8da927e9cb19cdcaee74d38c021422ebb571a7395363184f6828eccd23c66055ba2d078e8f30162849543a02d081cfcd05df853a5
6
+ metadata.gz: f837fa5d0d6b7dc18570ba8037ba1cb25373dad59daaf0433e56799468600c99e9dc0df2e579fb667eed4dfdd5c56065e1f23519a349be240944ad49211cbd42
7
+ data.tar.gz: e022d61b5268000d120fb0226a996c665fbcc2f03a159c9d68b7defc959b31d8d791d58b234e8564b900aed08aef8c791131197e0c2bb13f333d4b8218492b5a
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:
@@ -45,14 +64,23 @@ Metrics/ClassLength:
45
64
  Exclude:
46
65
  - test/**/*
47
66
 
48
- Metrics/LineLength:
49
- Exclude:
50
- - features/step_definitions/**/*
67
+ # Too noisy.
68
+ Metrics/CyclomaticComplexity:
69
+ Enabled: false
51
70
 
52
71
  Metrics/MethodLength:
53
72
  Exclude:
54
73
  - test/**/*
55
74
 
75
+ # Too noisy.
76
+ Metrics/PerceivedComplexity:
77
+ Enabled: false
78
+
79
+
80
+ # Nah, sometimes easier to read with accessors having separate grouping.
81
+ Style/AccessorGrouping:
82
+ Enabled: false
83
+
56
84
  # Prefer { ... } over do ... end except for control flow and
57
85
  # method defintions. Unfortunatly, no cop configuration for this.
58
86
  # https://github.com/chneukirchen/styleguide/blob/e60de37b478d3f892f6985a58d573016f33f0269/RUBY-STYLE#L63-L67
@@ -82,6 +110,25 @@ Style/Documentation:
82
110
  Style/GuardClause:
83
111
  Enabled: false
84
112
 
113
+ # In the context of the Thor DLS the rocket arrow => reads better.
114
+ Style/HashSyntax:
115
+ Exclude:
116
+ - app/commands/**/*
117
+
118
+ # Some times it reads clearer to not trail if/unless at the end.
119
+ Style/IfUnlessModifier:
120
+ Enabled: false
121
+
122
+ Style/ModuleFunction:
123
+ Enabled: false
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
+
85
132
  # %w and %i etc isn't really intuitive unless you are really familiar with the
86
133
  # syntax. %w seems used often enough. But [:symbol, :foo] reads clearer than
87
134
  # %i(symbol foo).
@@ -89,5 +136,140 @@ Style/SymbolArray:
89
136
  Enabled: False
90
137
 
91
138
  # Add trailing comma so it's easy to duplicate/add lines.
92
- Style/TrailingCommaInLiteral:
139
+ Style/TrailingCommaInArrayLiteral:
140
+ EnforcedStyleForMultiline: consistent_comma
141
+
142
+ Style/TrailingCommaInHashLiteral:
93
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/.vscode/tasks.json CHANGED
@@ -1,16 +1,18 @@
1
1
  {
2
2
  // See https://go.microsoft.com/fwlink/?LinkId=733558
3
3
  // for the documentation about the tasks.json format
4
- "version": "0.1.0",
5
- "command": "bundle",
6
- "isShellCommand": true,
7
- "showOutput": "always",
8
- "echoCommand": true,
9
- "args": ["exec", "rake"],
10
- "tasks": [{
11
- "taskName": "test",
12
- "args": ["TEST=${relativeFile}"],
13
- "isTestCommand": true,
14
- "isBuildCommand": true
15
- }]
4
+ "version": "2.0.0",
5
+ "tasks": [
6
+ {
7
+ "label": "rake test FILE",
8
+ "type": "shell",
9
+ "command": "bundle",
10
+ "args": [
11
+ "exec",
12
+ "rake",
13
+ "TEST=${relativeFile}"
14
+ ],
15
+ "group": "test"
16
+ }
17
+ ]
16
18
  }
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'
@@ -22,7 +24,7 @@ class Install < Skippy::Command::Group
22
24
  next if library[:version].nil? || library[:source].nil?
23
25
 
24
26
  options = {
25
- requirement: library[:version]
27
+ requirement: library[:version],
26
28
  }
27
29
  options[:branch] = library[:branch] unless library[:branch].nil?
28
30
  lib = project.libraries.install(library[:source], options)
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
  }
@@ -39,7 +41,8 @@ class Lib < Skippy::Command
39
41
  def install(source)
40
42
  project = Skippy::Project.current_or_fail
41
43
  libraries = project.libraries
42
- library = libraries.install(source, install_options(options)) { |type, message|
44
+ installation_options = install_options(options)
45
+ library = libraries.install(source, installation_options) { |type, message|
43
46
  color = type == :warning ? :red : :yellow
44
47
  say message, color
45
48
  }
@@ -74,7 +77,7 @@ class Lib < Skippy::Command
74
77
  private
75
78
 
76
79
  def install_options(cli_options)
77
- options = cli_options.map { |k, v| [k.to_sym, v] }.to_h
80
+ options = cli_options.transform_keys(&:to_sym)
78
81
  # The CLI options "version" is internally a "requirement".
79
82
  if options.key?(:version)
80
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
 
@@ -112,8 +116,9 @@ class Skippy::CLI < Skippy::Command
112
116
  def initialize_thorfiles(_relevant_to = nil, _skip_lookup = false)
113
117
  project = Skippy::Project.new(Dir.pwd)
114
118
  return unless project.exist?
119
+
115
120
  project.command_files { |filename|
116
- unless Thor::Base.subclass_files.keys.include?(File.expand_path(filename))
121
+ unless Thor::Base.subclass_files.key?(File.expand_path(filename))
117
122
  begin
118
123
  Thor::Util.load_thorfile(filename, nil, options[:debug])
119
124
  rescue ScriptError, StandardError => error
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'thor'
2
4
 
3
5
  module Skippy
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'