oxidized-script 0.6.0 → 0.7.0

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: 0cb4b95b188a46565abcb9b42201b07bb988fd8672e2b5d55e3f5906378155eb
4
- data.tar.gz: fb7d1798857327b428289fdca4307aa745728bf21726140f2617fef81ce5857c
3
+ metadata.gz: cd86bc7eb47c34474806973616144d76929e76e6be946c2be376867e30fd85a0
4
+ data.tar.gz: 23559fdcbf463e4c06579d6c1991c6a0c6980f1d946edb34bb2957ec79edac8d
5
5
  SHA512:
6
- metadata.gz: 0c9c0468da66871a5d82de1f116897191a4ec78b6673ab97afdf8b092115c9d10f88bce3f790ca63318ad08c70edf150a887ec789f47aad08065db44d2684b91
7
- data.tar.gz: c631fe4bbc7d70ba5ea450926dacbb7d8d2d88528ffaf29e6af3b9c3f76baa58502bbdd400cc05e86a0ad66b8b6c10c9320c512dacfd1903c647e5c87b5b95b7
6
+ metadata.gz: a63abec821ddf36e1c56389205de27c426633c0fd13c4dc2023d201f369e801b6df17c1da8b935bb5228d117d759f076dbfea0654af63af4287b1f8b582a774b
7
+ data.tar.gz: 622ee1d0e5daea7570f1883163696f3bb47f9a73a9ac000888d36eab747fb1abf9c837bffd483da9ae665b4995262e8ac09f78110cba78b397349b3d79e5eda8
@@ -0,0 +1,12 @@
1
+ ## Pre-Request Checklist
2
+ <!-- Not all items apply to each PR, but a great PR addresses all applicable items. -->
3
+
4
+ - [ ] Passes rubocop code analysis (try `rubocop --auto-correct`)
5
+ - [ ] Tests added or adapted (try `rake test`)
6
+ - [ ] Changes are reflected in the documentation
7
+ - [ ] User-visible changes appended to [CHANGELOG.md](/CHANGELOG.md)
8
+
9
+ ## Description
10
+ <!-- Describe your changes here. -->
11
+
12
+ <!-- Add a text similar to "Closes issue #" if this PR relates to an existing issue. -->
@@ -0,0 +1,31 @@
1
+ # To get started with Dependabot version updates, you'll need to specify which
2
+ # package ecosystems to update and where the package manifests are located.
3
+ # Please see the documentation for all configuration options:
4
+ # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5
+
6
+ version: 2
7
+ updates:
8
+ - package-ecosystem: "github-actions"
9
+ target-branch: "master"
10
+ directory: "/"
11
+ schedule:
12
+ interval: "daily"
13
+ open-pull-requests-limit: 10
14
+ labels:
15
+ - dependencies
16
+ - package-ecosystem: "bundler"
17
+ target-branch: "master"
18
+ directory: "/"
19
+ schedule:
20
+ interval: "daily"
21
+ open-pull-requests-limit: 10
22
+ labels:
23
+ - dependencies
24
+ - package-ecosystem: "docker"
25
+ target-branch: "master"
26
+ directory: "/"
27
+ schedule:
28
+ interval: "daily"
29
+ open-pull-requests-limit: 10
30
+ labels:
31
+ - dependencies
@@ -0,0 +1,76 @@
1
+ # For most projects, this workflow file will not need changing; you simply need
2
+ # to commit it to your repository.
3
+ #
4
+ # You may wish to alter this file to override the set of languages analyzed,
5
+ # or to provide custom queries or build logic.
6
+ #
7
+ # ******** NOTE ********
8
+ # We have attempted to detect the languages in your repository. Please check
9
+ # the `language` matrix defined below to confirm you have the correct set of
10
+ # supported CodeQL languages.
11
+ #
12
+ name: "CodeQL"
13
+
14
+ on:
15
+ push:
16
+ branches: [ "master" ]
17
+ pull_request:
18
+ # The branches below must be a subset of the branches above
19
+ branches: [ "master" ]
20
+ schedule:
21
+ - cron: '44 21 * * 0'
22
+
23
+ jobs:
24
+ analyze:
25
+ name: Analyze
26
+ runs-on: ubuntu-latest
27
+ permissions:
28
+ actions: read
29
+ contents: read
30
+ security-events: write
31
+
32
+ strategy:
33
+ fail-fast: false
34
+ matrix:
35
+ language: [ 'ruby' ]
36
+ # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37
+ # Use only 'java' to analyze code written in Java, Kotlin or both
38
+ # Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
39
+ # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
40
+
41
+ steps:
42
+ - name: Checkout repository
43
+ uses: actions/checkout@v4
44
+
45
+ # Initializes the CodeQL tools for scanning.
46
+ - name: Initialize CodeQL
47
+ uses: github/codeql-action/init@v3
48
+ with:
49
+ languages: ${{ matrix.language }}
50
+ # If you wish to specify custom queries, you can do so here or in a config file.
51
+ # By default, queries listed here will override any specified in a config file.
52
+ # Prefix the list here with "+" to use these queries and those in the config file.
53
+
54
+ # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
55
+ # queries: security-extended,security-and-quality
56
+
57
+
58
+ # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
59
+ # If this step fails, then you should remove it and run the build manually (see below)
60
+ - name: Autobuild
61
+ uses: github/codeql-action/autobuild@v3
62
+
63
+ # ℹ️ Command-line programs to run using the OS shell.
64
+ # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
65
+
66
+ # If the Autobuild fails above, remove it and uncomment the following three lines.
67
+ # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
68
+
69
+ # - run: |
70
+ # echo "Run, Build Application using script"
71
+ # ./location_of_script_within_repo/buildscript.sh
72
+
73
+ - name: Perform CodeQL Analysis
74
+ uses: github/codeql-action/analyze@v3
75
+ with:
76
+ category: "/language:${{matrix.language}}"
@@ -0,0 +1,25 @@
1
+ name: Publish Docker
2
+ on:
3
+ push:
4
+ branches: [ "master" ]
5
+ jobs:
6
+ build:
7
+ if: github.repository_owner == 'ytti'
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ - uses: actions/checkout@master
11
+ with:
12
+ fetch-depth: 0
13
+ - name: Get Release Version
14
+ id: get_version
15
+ run: echo "release-version=$(git describe --tags)" >> $GITHUB_OUTPUT
16
+ - name: Set up Docker Buildx
17
+ uses: docker/setup-buildx-action@v3
18
+ - name: Publish to Registry
19
+ uses: elgohr/Publish-Docker-Github-Action@v5
20
+ with:
21
+ name: oxidized/oxidized
22
+ username: ${{ secrets.DOCKER_USERNAME }}
23
+ password: ${{ secrets.DOCKER_PASSWORD }}
24
+ tags: "latest,${{ steps.get_version.outputs.release-version }}"
25
+ platforms: linux/amd64,linux/arm64
@@ -0,0 +1,43 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: CI
9
+
10
+ on: [ push, pull_request ]
11
+ # push:
12
+ # branches: [ master ]
13
+ # pull_request:
14
+ # branches: [ master ]
15
+
16
+ jobs:
17
+ test:
18
+
19
+ runs-on: ubuntu-latest
20
+ strategy:
21
+ matrix:
22
+ ruby-version: ['3.1', '3.2', '3.3', '3.4', 'ruby-head']
23
+ continue-on-error: ${{ matrix.ruby-version == 'ruby-head' }}
24
+
25
+ steps:
26
+ - uses: actions/checkout@v4
27
+ - name: Set up Ruby
28
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
29
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
30
+ uses: ruby/setup-ruby@v1
31
+ with:
32
+ ruby-version: ${{ matrix.ruby-version }}
33
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
34
+ - name: rubocop
35
+ uses: reviewdog/action-rubocop@v2
36
+ with:
37
+ rubocop_version: gemfile
38
+ rubocop_extensions: rubocop-minitest:gemfile rubocop-rake:gemfile
39
+ reporter: github-pr-review
40
+ - name: Run tests
41
+ run: bundle exec rake
42
+ - uses: codecov/codecov-action@v5
43
+ if: ${{ always() }}
@@ -0,0 +1,21 @@
1
+ ---
2
+ name: "Stale Issue/PR cleanup"
3
+ on:
4
+ schedule:
5
+ - cron: "30 1 * * *"
6
+
7
+ permissions:
8
+ issues: write
9
+ pull-requests: write
10
+
11
+ jobs:
12
+ stale:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/stale@v9
16
+ with:
17
+ stale-issue-message: 'This issue is stale because it has been open 90 days with no activity.'
18
+ stale-pr-message: 'This PR is stale because it has been open 90 days with no activity.'
19
+ operations-per-run: 500
20
+ days-before-stale: 90
21
+ days-before-close: -1
data/.gitignore CHANGED
@@ -1,3 +1,3 @@
1
1
  Gemfile.lock
2
- gems
2
+ pkg
3
3
  *.swp
data/.rubocop.yml ADDED
@@ -0,0 +1,24 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ AllCops:
4
+ NewCops: enable
5
+ TargetRubyVersion: 3.2
6
+
7
+ Lint/RaiseException:
8
+ Enabled: true
9
+
10
+ Lint/StructNewOverride:
11
+ Enabled: true
12
+
13
+ Style/HashEachMethods:
14
+ Enabled: true
15
+
16
+ Style/HashTransformKeys:
17
+ Enabled: true
18
+
19
+ Style/HashTransformValues:
20
+ Enabled: true
21
+
22
+ require:
23
+ - rubocop-rake
24
+ - rubocop-minitest
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,407 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config --exclude-limit 10000`
3
+ # on 2025-01-20 18:20:44 UTC using RuboCop version 1.70.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 1
10
+ # Configuration parameters: Severity, Include.
11
+ # Include: **/*.gemspec
12
+ Gemspec/RequiredRubyVersion:
13
+ Exclude:
14
+ - 'oxidized-script.gemspec'
15
+
16
+ # Offense count: 5
17
+ # This cop supports safe autocorrection (--autocorrect).
18
+ Layout/EmptyLineAfterGuardClause:
19
+ Exclude:
20
+ - 'lib/oxidized/script/cli.rb'
21
+ - 'lib/oxidized/script/commands/list-nodes.rb'
22
+ - 'lib/oxidized/script/script.rb'
23
+
24
+ # Offense count: 2
25
+ # This cop supports safe autocorrection (--autocorrect).
26
+ # Configuration parameters: EmptyLineBetweenMethodDefs, EmptyLineBetweenClassDefs, EmptyLineBetweenModuleDefs, DefLikeMacros, AllowAdjacentOneLineDefs, NumberOfEmptyLines.
27
+ Layout/EmptyLineBetweenDefs:
28
+ Exclude:
29
+ - 'lib/oxidized/script/script.rb'
30
+
31
+ # Offense count: 1
32
+ # This cop supports safe autocorrection (--autocorrect).
33
+ Layout/EmptyLines:
34
+ Exclude:
35
+ - 'lib/oxidized/script/script.rb'
36
+
37
+ # Offense count: 1
38
+ # This cop supports safe autocorrection (--autocorrect).
39
+ # Configuration parameters: AllowAliasSyntax, AllowedMethods.
40
+ # AllowedMethods: alias_method, public, protected, private
41
+ Layout/EmptyLinesAroundAttributeAccessor:
42
+ Exclude:
43
+ - 'lib/oxidized/script/cli.rb'
44
+
45
+ # Offense count: 3
46
+ # This cop supports safe autocorrection (--autocorrect).
47
+ # Configuration parameters: EnforcedStyle.
48
+ # SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines, beginning_only, ending_only
49
+ Layout/EmptyLinesAroundClassBody:
50
+ Exclude:
51
+ - 'lib/oxidized/script/cli.rb'
52
+ - 'lib/oxidized/script/commands/list-models.rb'
53
+ - 'lib/oxidized/script/commands/list-nodes.rb'
54
+
55
+ # Offense count: 11
56
+ # This cop supports safe autocorrection (--autocorrect).
57
+ # Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment.
58
+ Layout/ExtraSpacing:
59
+ Exclude:
60
+ - 'lib/oxidized/script/cli.rb'
61
+ - 'lib/oxidized/script/commands/list-nodes.rb'
62
+
63
+ # Offense count: 1
64
+ # This cop supports safe autocorrection (--autocorrect).
65
+ Layout/SpaceAfterComma:
66
+ Exclude:
67
+ - 'lib/oxidized/script/cli.rb'
68
+
69
+ # Offense count: 4
70
+ # This cop supports safe autocorrection (--autocorrect).
71
+ # Configuration parameters: .
72
+ # SupportedStyles: space, no_space
73
+ Layout/SpaceAroundEqualsInParameterDefault:
74
+ EnforcedStyle: no_space
75
+
76
+ # Offense count: 12
77
+ # This cop supports safe autocorrection (--autocorrect).
78
+ # Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator, EnforcedStyleForRationalLiterals.
79
+ # SupportedStylesForExponentOperator: space, no_space
80
+ # SupportedStylesForRationalLiterals: space, no_space
81
+ Layout/SpaceAroundOperators:
82
+ Exclude:
83
+ - 'lib/oxidized/script/cli.rb'
84
+ - 'lib/oxidized/script/script.rb'
85
+
86
+ # Offense count: 4
87
+ # This cop supports safe autocorrection (--autocorrect).
88
+ # Configuration parameters: AllowForAlignment.
89
+ Layout/SpaceBeforeFirstArg:
90
+ Exclude:
91
+ - 'lib/oxidized/script/cli.rb'
92
+
93
+ # Offense count: 2
94
+ # Configuration parameters: AllowedParentClasses.
95
+ Lint/MissingSuper:
96
+ Exclude:
97
+ - 'lib/oxidized/script/commands/list-models.rb'
98
+ - 'lib/oxidized/script/commands/list-nodes.rb'
99
+
100
+ # Offense count: 1
101
+ # This cop supports safe autocorrection (--autocorrect).
102
+ Lint/RedundantStringCoercion:
103
+ Exclude:
104
+ - 'lib/oxidized/script/cli.rb'
105
+
106
+ # Offense count: 1
107
+ # This cop supports safe autocorrection (--autocorrect).
108
+ Lint/ScriptPermission:
109
+ Exclude:
110
+ - 'lib/oxidized/script/script.rb'
111
+
112
+ # Offense count: 2
113
+ # This cop supports safe autocorrection (--autocorrect).
114
+ # Configuration parameters: AutoCorrect, AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods, NotImplementedExceptions.
115
+ # NotImplementedExceptions: NotImplementedError
116
+ Lint/UnusedMethodArgument:
117
+ Exclude:
118
+ - 'lib/oxidized/script/commands/list-nodes.rb'
119
+ - 'lib/oxidized/script/script.rb'
120
+
121
+ # Offense count: 2
122
+ # This cop supports safe autocorrection (--autocorrect).
123
+ # Configuration parameters: AutoCorrect.
124
+ Lint/UselessAssignment:
125
+ Exclude:
126
+ - 'lib/oxidized/script/script.rb'
127
+
128
+ # Offense count: 6
129
+ # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
130
+ Metrics/AbcSize:
131
+ Max: 54
132
+
133
+ # Offense count: 1
134
+ # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
135
+ # AllowedMethods: refine
136
+ Metrics/BlockLength:
137
+ Max: 31
138
+
139
+ # Offense count: 1
140
+ # Configuration parameters: CountComments, CountAsOne.
141
+ Metrics/ClassLength:
142
+ Max: 168
143
+
144
+ # Offense count: 4
145
+ # Configuration parameters: AllowedMethods, AllowedPatterns.
146
+ Metrics/CyclomaticComplexity:
147
+ Max: 18
148
+
149
+ # Offense count: 8
150
+ # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
151
+ Metrics/MethodLength:
152
+ Max: 44
153
+
154
+ # Offense count: 4
155
+ # Configuration parameters: AllowedMethods, AllowedPatterns.
156
+ Metrics/PerceivedComplexity:
157
+ Max: 18
158
+
159
+ # Offense count: 1
160
+ Naming/AccessorMethodName:
161
+ Exclude:
162
+ - 'lib/oxidized/script/cli.rb'
163
+
164
+ # Offense count: 4
165
+ Naming/ConstantName:
166
+ Exclude:
167
+ - 'lib/oxidized/script/commands/list-models.rb'
168
+ - 'lib/oxidized/script/commands/list-nodes.rb'
169
+
170
+ # Offense count: 2
171
+ # Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms.
172
+ # CheckDefinitionPathHierarchyRoots: lib, spec, test, src
173
+ # AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
174
+ Naming/FileName:
175
+ Exclude:
176
+ - 'Rakefile.rb'
177
+ - 'lib/oxidized/script/commands/list-models.rb'
178
+ - 'lib/oxidized/script/commands/list-nodes.rb'
179
+
180
+ # Offense count: 3
181
+ # This cop supports safe autocorrection (--autocorrect).
182
+ # Configuration parameters: PreferredName.
183
+ Naming/RescuedExceptionsVariableName:
184
+ Exclude:
185
+ - 'bin/oxs'
186
+ - 'lib/oxidized/script/cli.rb'
187
+ - 'lib/oxidized/script/script.rb'
188
+
189
+ # Offense count: 1
190
+ Security/Eval:
191
+ Exclude:
192
+ - 'Rakefile'
193
+
194
+ # Offense count: 1
195
+ # This cop supports safe autocorrection (--autocorrect).
196
+ # Configuration parameters: EnforcedStyle.
197
+ # SupportedStyles: prefer_alias, prefer_alias_method
198
+ Style/Alias:
199
+ Exclude:
200
+ - 'lib/oxidized/script/script.rb'
201
+
202
+ # Offense count: 8
203
+ # This cop supports unsafe autocorrection (--autocorrect-all).
204
+ # Configuration parameters: EnforcedStyle.
205
+ # SupportedStyles: always, conditionals
206
+ Style/AndOr:
207
+ Exclude:
208
+ - 'lib/oxidized/script/cli.rb'
209
+
210
+ # Offense count: 1
211
+ # This cop supports safe autocorrection (--autocorrect).
212
+ # Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
213
+ # SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
214
+ # ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
215
+ # FunctionalMethods: let, let!, subject, watch
216
+ # AllowedMethods: lambda, proc, it
217
+ Style/BlockDelimiters:
218
+ Exclude:
219
+ - 'lib/oxidized/script/cli.rb'
220
+
221
+ # Offense count: 2
222
+ Style/ClassVars:
223
+ Exclude:
224
+ - 'lib/oxidized/script/script.rb'
225
+
226
+ # Offense count: 1
227
+ # This cop supports safe autocorrection (--autocorrect).
228
+ # Configuration parameters: EnforcedStyle, AllowInnerBackticks.
229
+ # SupportedStyles: backticks, percent_x, mixed
230
+ Style/CommandLiteral:
231
+ Exclude:
232
+ - 'Rakefile'
233
+
234
+ # Offense count: 7
235
+ # Configuration parameters: AllowedConstants.
236
+ Style/Documentation:
237
+ Exclude:
238
+ - 'spec/**/*'
239
+ - 'test/**/*'
240
+ - 'lib/oxidized/script/cli.rb'
241
+ - 'lib/oxidized/script/commands/list-models.rb'
242
+ - 'lib/oxidized/script/commands/list-nodes.rb'
243
+ - 'lib/oxidized/script/script.rb'
244
+
245
+ # Offense count: 1
246
+ # This cop supports safe autocorrection (--autocorrect).
247
+ # Configuration parameters: AutoCorrect, EnforcedStyle.
248
+ # SupportedStyles: compact, expanded
249
+ Style/EmptyMethod:
250
+ Exclude:
251
+ - 'lib/oxidized/script/commands/list-models.rb'
252
+
253
+ # Offense count: 2
254
+ # This cop supports safe autocorrection (--autocorrect).
255
+ # Configuration parameters: EnforcedStyle.
256
+ # SupportedStyles: format, sprintf, percent
257
+ Style/FormatString:
258
+ Exclude:
259
+ - 'lib/oxidized/script/commands/list-models.rb'
260
+ - 'lib/oxidized/script/commands/list-nodes.rb'
261
+
262
+ # Offense count: 4
263
+ # This cop supports safe autocorrection (--autocorrect).
264
+ # Configuration parameters: MaxUnannotatedPlaceholdersAllowed, AllowedMethods, AllowedPatterns.
265
+ # SupportedStyles: annotated, template, unannotated
266
+ Style/FormatStringToken:
267
+ EnforcedStyle: unannotated
268
+
269
+ # Offense count: 10
270
+ # This cop supports unsafe autocorrection (--autocorrect-all).
271
+ # Configuration parameters: EnforcedStyle.
272
+ # SupportedStyles: always, always_true, never
273
+ Style/FrozenStringLiteralComment:
274
+ Exclude:
275
+ - 'Gemfile'
276
+ - 'Rakefile'
277
+ - 'bin/oxs'
278
+ - 'lib/oxidized/script.rb'
279
+ - 'lib/oxidized/script/cli.rb'
280
+ - 'lib/oxidized/script/command.rb'
281
+ - 'lib/oxidized/script/commands/list-models.rb'
282
+ - 'lib/oxidized/script/commands/list-nodes.rb'
283
+ - 'lib/oxidized/script/script.rb'
284
+ - 'oxidized-script.gemspec'
285
+
286
+ # Offense count: 1
287
+ # This cop supports safe autocorrection (--autocorrect).
288
+ # Configuration parameters: MinBodyLength, AllowConsecutiveConditionals.
289
+ Style/GuardClause:
290
+ Exclude:
291
+ - 'lib/oxidized/script/script.rb'
292
+
293
+ # Offense count: 11
294
+ # This cop supports safe autocorrection (--autocorrect).
295
+ # Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
296
+ # SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
297
+ # SupportedShorthandSyntax: always, never, either, consistent, either_consistent
298
+ Style/HashSyntax:
299
+ Exclude:
300
+ - 'lib/oxidized/script/cli.rb'
301
+ - 'lib/oxidized/script/script.rb'
302
+
303
+ # Offense count: 1
304
+ # This cop supports safe autocorrection (--autocorrect).
305
+ Style/IfUnlessModifier:
306
+ Exclude:
307
+ - 'lib/oxidized/script/cli.rb'
308
+
309
+ # Offense count: 9
310
+ # This cop supports safe autocorrection (--autocorrect).
311
+ # Configuration parameters: EnforcedStyle.
312
+ # SupportedStyles: require_parentheses, require_no_parentheses, require_no_parentheses_except_multiline
313
+ Style/MethodDefParentheses:
314
+ Exclude:
315
+ - 'lib/oxidized/script/cli.rb'
316
+ - 'lib/oxidized/script/commands/list-models.rb'
317
+ - 'lib/oxidized/script/commands/list-nodes.rb'
318
+ - 'lib/oxidized/script/script.rb'
319
+
320
+ # Offense count: 4
321
+ # This cop supports unsafe autocorrection (--autocorrect-all).
322
+ # Configuration parameters: EnforcedStyle.
323
+ # SupportedStyles: literals, strict
324
+ Style/MutableConstant:
325
+ Exclude:
326
+ - 'lib/oxidized/script/commands/list-models.rb'
327
+ - 'lib/oxidized/script/commands/list-nodes.rb'
328
+
329
+ # Offense count: 2
330
+ # This cop supports safe autocorrection (--autocorrect).
331
+ # Configuration parameters: EnforcedStyle.
332
+ # SupportedStyles: both, prefix, postfix
333
+ Style/NegatedIf:
334
+ Exclude:
335
+ - 'lib/oxidized/script/script.rb'
336
+
337
+ # Offense count: 8
338
+ # This cop supports safe autocorrection (--autocorrect).
339
+ Style/Not:
340
+ Exclude:
341
+ - 'lib/oxidized/script/cli.rb'
342
+ - 'lib/oxidized/script/script.rb'
343
+
344
+ # Offense count: 1
345
+ # This cop supports safe autocorrection (--autocorrect).
346
+ Style/RedundantBegin:
347
+ Exclude:
348
+ - 'lib/oxidized/script/script.rb'
349
+
350
+ # Offense count: 1
351
+ # This cop supports unsafe autocorrection (--autocorrect-all).
352
+ Style/RedundantInterpolation:
353
+ Exclude:
354
+ - 'bin/oxs'
355
+
356
+ # Offense count: 3
357
+ # This cop supports safe autocorrection (--autocorrect).
358
+ # Configuration parameters: EnforcedStyle.
359
+ # SupportedStyles: implicit, explicit
360
+ Style/RescueStandardError:
361
+ Exclude:
362
+ - 'bin/oxs'
363
+ - 'lib/oxidized/script/cli.rb'
364
+ - 'lib/oxidized/script/script.rb'
365
+
366
+ # Offense count: 1
367
+ # This cop supports unsafe autocorrection (--autocorrect-all).
368
+ Style/SlicingWithRange:
369
+ Exclude:
370
+ - 'lib/oxidized/script/commands/list-nodes.rb'
371
+
372
+ # Offense count: 3
373
+ # This cop supports safe autocorrection (--autocorrect).
374
+ # Configuration parameters: AllowModifier.
375
+ Style/SoleNestedConditional:
376
+ Exclude:
377
+ - 'lib/oxidized/script/cli.rb'
378
+
379
+ # Offense count: 3
380
+ # This cop supports unsafe autocorrection (--autocorrect-all).
381
+ # Configuration parameters: Mode.
382
+ Style/StringConcatenation:
383
+ Exclude:
384
+ - 'Rakefile'
385
+ - 'lib/oxidized/script/cli.rb'
386
+
387
+ # Offense count: 5
388
+ # This cop supports safe autocorrection (--autocorrect).
389
+ # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
390
+ # SupportedStyles: single_quotes, double_quotes
391
+ Style/StringLiterals:
392
+ Exclude:
393
+ - 'lib/oxidized/script/cli.rb'
394
+
395
+ # Offense count: 1
396
+ # This cop supports safe autocorrection (--autocorrect).
397
+ # Configuration parameters: MinSize.
398
+ # SupportedStyles: percent, brackets
399
+ Style/SymbolArray:
400
+ EnforcedStyle: brackets
401
+
402
+ # Offense count: 1
403
+ # This cop supports safe autocorrection (--autocorrect).
404
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
405
+ # URISchemes: http, https
406
+ Layout/LineLength:
407
+ Max: 128
data/CHANGELOG.md CHANGED
@@ -1,21 +1,56 @@
1
- # 0.3.2
1
+ # Changelog
2
+
3
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
4
+
5
+ ## [0.7.0 - 2025-01-21]
6
+
7
+ ### Added
8
+ - Added no-trim option (@Gman98ish)
9
+ - added rubocop config (@wk)
10
+ - added Github Actions from ytti/oxidized (@aschaber1)
11
+
12
+ ### Fixed
13
+ - Normalise file permissions before push (@ytti)
14
+ - update gemspec dependencies (@nickhilliard)
15
+ - updates + sanity checking on gh actions (@nickhilliard)
16
+
17
+ ## [0.6.0 - 2018-12-16]
18
+
19
+ ### Added
20
+ - Implemented combination of regex with ostype (@LarsKollstedt)
21
+
22
+ ### Fixed
23
+ - refactor some code (@ytti)
24
+ - updated oxidized dependency (@ytti)
25
+
26
+ ## [0.5.1 - 2018-06-03]
27
+
28
+ ### Fixed
29
+ - fixed oxidized dependency (@ytti)
30
+
31
+ ## [0.5.0 - 2017-11-01]
32
+
33
+ ### Fixed
34
+ - adding in sync for stdout giving more control over individual changes (@nertwork)
35
+
36
+ ## 0.4.0
2
37
  - FEATURE on --ostype to get a list of nodes that match a particular OS Type (junos, routeros, ios) (by InsaneSplash)
3
38
 
4
- # 0.3.1
39
+ ## 0.3.1
5
40
  - FEATURE on --dryrun to get a list of nodes without running a command (by @nertwork)
6
41
  - BUGFIX: errors with large config files running in ruby threads - forking instead (by @nertwork)
7
42
 
8
- # 0.3.0
43
+ ## 0.3.0
9
44
  - FEATURE on --regex to run commands on hosts matching a regex (by @nertwork)
10
45
  - FEATURE on -g to run commands on entire group (by @nertwork)
11
46
  - FEATURE on -r to thread commands run on entire group (by @nertwork)
12
47
  - BUGFIX: fix for replacing escaped newlines in config files (by @nertwork)
13
48
 
14
- # 0.2.0
49
+ ## 0.2.0
15
50
  - FEATURE on -x disable ssh exec mode (by @nickhilliard)
16
51
 
17
- # 0.1.2
52
+ ## 0.1.2
18
53
  - BUGFIX: fix for oxidized refactored code
19
54
 
20
- # 0.1.1
55
+ ## 0.1.1
21
56
  - BUGFIX: initialize manager only once
data/Gemfile CHANGED
@@ -1,3 +1,2 @@
1
1
  source 'https://rubygems.org'
2
-
3
2
  gemspec
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'bundler/gem_tasks'
2
2
  require 'rake/testtask'
3
3
 
4
4
  gemspec = eval(File.read(Dir['*.gemspec'].first))
5
- file = [gemspec.name, gemspec.version].join('-') + '.gem'
5
+ gemfile = [gemspec.name, gemspec.version].join('-') + '.gem'
6
6
 
7
7
  desc 'Validate gemspec'
8
8
  task :gemspec do
@@ -20,10 +20,11 @@ task :test do
20
20
  end
21
21
 
22
22
  desc 'Install gem'
23
- task :install => :build do
24
- system "sudo -Es sh -c \'umask 022; gem install gems/#{file}\'"
23
+ task install: :build do
24
+ system "sudo -Es sh -c 'umask 022; gem install gems/#{gemfile}'"
25
25
  end
26
26
 
27
+ task build: :chmod
27
28
  desc 'Remove gems'
28
29
  task :clean do
29
30
  FileUtils.rm_rf 'pkg'
@@ -35,8 +36,21 @@ task :tag do
35
36
  end
36
37
 
37
38
  desc 'Push to rubygems'
38
- task :push => :tag do
39
- system "gem push pkg/#{file}"
39
+ task push: :tag do
40
+ system "gem push pkg/#{gemfile}"
41
+ end
42
+
43
+ desc 'Normalise file permissions'
44
+ task :chmod do
45
+ xbit = %w[
46
+ bin/oxs
47
+ ]
48
+ dirs = []
49
+ %x(git ls-files -z).split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }.each do |file|
50
+ dirs.push(File.dirname(file))
51
+ xbit.include?(file) ? File.chmod(0o0755, file) : File.chmod(0o0644, file)
52
+ end
53
+ dirs.sort.uniq.each { |dir| File.chmod(0o0755, dir) }
40
54
  end
41
55
 
42
56
  task default: :test
@@ -76,41 +76,47 @@ module Oxidized
76
76
  end
77
77
 
78
78
  def opts_parse cmds
79
- slop = Slop.new(help: true)
80
- slop.banner 'Usage: oxs [options] hostname [command]'
81
- slop.on 'm=', '--model', 'host model (ios, junos, etc), otherwise discovered from Oxidized source'
82
- slop.on 'o=', '--ostype', 'OS Type (ios, junos, etc)'
83
- slop.on 'x=', '--commands', 'commands file to be sent'
84
- slop.on 'u=', '--username', 'username to use'
85
- slop.on 'p=', '--password', 'password to use'
86
- slop.on 't=', '--timeout', 'timeout value to use'
87
- slop.on 'e=', '--enable', 'enable password to use'
88
- slop.on 'c=', '--community', 'snmp community to use for discovery'
89
- slop.on 'g=', '--group', 'group to run commands on (ios, junos, etc), specified in oxidized db'
90
- slop.on 'r=', '--threads', 'specify ammount of threads to use for running group', default: '1'
91
- slop.on '--regex=', 'run on all hosts that match the regexp'
92
- slop.on '--dryrun', 'do a dry run on either groups or regexp to find matching hosts'
93
- slop.on '--protocols=','protocols to use, default "ssh, telnet"'
94
- slop.on 'v', '--verbose', 'verbose output, e.g. show commands sent'
95
- slop.on 'd', '--debug', 'turn on debugging'
96
- slop.on :terse, 'display clean output'
97
- cmds.each do |cmd|
98
- if cmd[:class].respond_to? :cmdline
99
- cmd[:class].cmdline slop, self
100
- else
101
- slop.on cmd[:name], cmd[:description] do
102
- @cmd_class = cmd[:class]
79
+ opts = Slop.parse do |opt|
80
+ opt.banner = 'Usage: oxs [options] hostname [command]'
81
+ opt.on '-h', '--help', 'show usage' do
82
+ puts opt
83
+ exit
84
+ end
85
+ opt.string '-m', '--model', 'host model (ios, junos, etc), otherwise discovered from Oxidized source'
86
+ opt.string '-o', '--ostype', 'OS Type (ios, junos, etc)'
87
+ opt.string '-x', '--commands', 'commands file to be sent'
88
+ opt.string '-u', '--username', 'username to use'
89
+ opt.string '-p', '--password', 'password to use'
90
+ opt.int '-t', '--timeout', 'timeout value to use'
91
+ opt.string '-e', '--enable', 'enable password to use'
92
+ opt.string '-c', '--community', 'snmp community to use for discovery'
93
+ opt.string '-g', '--group', 'group to run commands on (ios, junos, etc), specified in oxidized db'
94
+ opt.int '-r', '--threads', 'specify ammount of threads to use for running group', default: '1'
95
+ opt.string '--regex', 'run on all hosts that match the regexp'
96
+ opt.on '--dryrun', 'do a dry run on either groups or regexp to find matching hosts'
97
+ opt.string '--protocols','protocols to use, default "ssh, telnet"'
98
+ opt.on '--no-trim', 'Dont trim newlines and whitespace when running commands'
99
+ opt.on '-v', '--verbose', 'verbose output, e.g. show commands sent'
100
+ opt.on '-d', '--debug', 'turn on debugging'
101
+ opt.on :terse, 'display clean output'
102
+
103
+ cmds.each do |cmd|
104
+ if cmd[:class].respond_to? :cmdline
105
+ cmd[:class].cmdline opt, self
106
+ else
107
+ opt.on "--" + cmd[:name], cmd[:description] do
108
+ @cmd_class = cmd[:class]
109
+ end
103
110
  end
104
111
  end
105
112
  end
106
- slop.parse
107
- @group = slop[:group]
108
- @ostype = slop[:ostype]
109
- @threads = slop[:threads]
110
- @verbose = slop[:verbose]
111
- @dryrun = slop[:dryrun]
112
- @regex = slop[:regex]
113
- [slop.parse!, slop]
113
+ @group = opts[:group]
114
+ @ostype = opts[:ostype]
115
+ @threads = opts[:threads]
116
+ @verbose = opts[:verbose]
117
+ @dryrun = opts[:dryrun]
118
+ @regex = opts[:regex]
119
+ [opts.arguments, opts]
114
120
  end
115
121
 
116
122
  def connect
@@ -126,8 +132,8 @@ module Oxidized
126
132
  out = ''
127
133
  file = file == '-' ? $stdin : File.read(file)
128
134
  file.each_line do |line|
129
- line.chomp!
130
135
  # line.sub!(/\\n/, "\n") # treat escaped newline as newline
136
+ line.chomp! unless @opts["no-trim"]
131
137
  out += @oxs.cmd line
132
138
  end
133
139
  out
@@ -1,18 +1,30 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'oxidized-script'
3
- s.version = '0.6.0'
4
- s.licenses = %w( Apache-2.0 )
3
+ s.version = '0.7.0'
4
+ s.licenses = %w[Apache-2.0]
5
5
  s.platform = Gem::Platform::RUBY
6
- s.authors = [ 'Saku Ytti' ]
7
- s.email = %w( saku@ytti.fi )
6
+ s.authors = ['Saku Ytti']
7
+ s.email = %w[saku@ytti.fi]
8
8
  s.homepage = 'http://github.com/ytti/oxidized-script'
9
9
  s.summary = 'cli + library for scripting network devices'
10
10
  s.description = 'rancid clogin-like script to push configs to devices + library interface to do same'
11
- s.rubyforge_project = s.name
12
- s.files = `git ls-files`.split("\n")
13
- s.executables = %w( oxs )
11
+ s.files = `git ls-files -z`.split("\x0")
12
+ s.executables = %w[oxs]
14
13
  s.require_path = 'lib'
15
14
 
16
- s.add_runtime_dependency 'oxidized', '~> 0.25'
17
- s.add_runtime_dependency 'slop', '~> 3.5'
15
+ s.metadata['rubygems_mfa_required'] = 'true'
16
+
17
+ s.required_ruby_version = '>= 3.0'
18
+
19
+ s.add_runtime_dependency 'oxidized', '~> 0.29'
20
+ s.add_runtime_dependency 'slop', '~> 4.6'
21
+
22
+ s.add_development_dependency 'bundler', '~> 2.2'
23
+ s.add_development_dependency 'rake', '~> 13.0'
24
+ s.add_development_dependency 'rubocop', '~> 1.70.0'
25
+ s.add_development_dependency 'rubocop-minitest', '~> 0.29.0'
26
+ s.add_development_dependency 'rubocop-rake', '~> 0.6.0'
27
+ s.add_development_dependency 'simplecov', '~> 0.22.0'
28
+ s.add_development_dependency 'simplecov-cobertura', '~> 2.1.0'
29
+ s.add_development_dependency 'simplecov-html', '~> 0.12.3'
18
30
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oxidized-script
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Saku Ytti
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-16 00:00:00.000000000 Z
11
+ date: 2025-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oxidized
@@ -16,28 +16,140 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.25'
19
+ version: '0.29'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.25'
26
+ version: '0.29'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: slop
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '3.5'
33
+ version: '4.6'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '3.5'
40
+ version: '4.6'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.2'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.2'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '13.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '13.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 1.70.0
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 1.70.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop-minitest
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.29.0
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.29.0
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop-rake
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 0.6.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 0.6.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: simplecov
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 0.22.0
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 0.22.0
125
+ - !ruby/object:Gem::Dependency
126
+ name: simplecov-cobertura
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: 2.1.0
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: 2.1.0
139
+ - !ruby/object:Gem::Dependency
140
+ name: simplecov-html
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: 0.12.3
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: 0.12.3
41
153
  description: rancid clogin-like script to push configs to devices + library interface
42
154
  to do same
43
155
  email:
@@ -47,7 +159,15 @@ executables:
47
159
  extensions: []
48
160
  extra_rdoc_files: []
49
161
  files:
162
+ - ".github/PULL_REQUEST_TEMPLATE.md"
163
+ - ".github/dependabot.yml"
164
+ - ".github/workflows/codeql.yml"
165
+ - ".github/workflows/publishdocker.yml"
166
+ - ".github/workflows/ruby.yml"
167
+ - ".github/workflows/stale.yml"
50
168
  - ".gitignore"
169
+ - ".rubocop.yml"
170
+ - ".rubocop_todo.yml"
51
171
  - CHANGELOG.md
52
172
  - Gemfile
53
173
  - README.md
@@ -63,8 +183,9 @@ files:
63
183
  homepage: http://github.com/ytti/oxidized-script
64
184
  licenses:
65
185
  - Apache-2.0
66
- metadata: {}
67
- post_install_message:
186
+ metadata:
187
+ rubygems_mfa_required: 'true'
188
+ post_install_message:
68
189
  rdoc_options: []
69
190
  require_paths:
70
191
  - lib
@@ -72,16 +193,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
72
193
  requirements:
73
194
  - - ">="
74
195
  - !ruby/object:Gem::Version
75
- version: '0'
196
+ version: '3.0'
76
197
  required_rubygems_version: !ruby/object:Gem::Requirement
77
198
  requirements:
78
199
  - - ">="
79
200
  - !ruby/object:Gem::Version
80
201
  version: '0'
81
202
  requirements: []
82
- rubyforge_project: oxidized-script
83
- rubygems_version: 2.7.6
84
- signing_key:
203
+ rubygems_version: 3.4.19
204
+ signing_key:
85
205
  specification_version: 4
86
206
  summary: cli + library for scripting network devices
87
207
  test_files: []