kozo 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +7 -2
  3. data/.kzignore +1 -0
  4. data/.overcommit.yml +1 -0
  5. data/.rspec +1 -0
  6. data/.rubocop.yml +44 -5
  7. data/CHANGELOG.md +5 -0
  8. data/Gemfile +3 -1
  9. data/Gemfile.lock +156 -48
  10. data/LICENSE.md +1 -1
  11. data/README.md +28 -0
  12. data/Rakefile +3 -7
  13. data/bin/kozo +6 -2
  14. data/config/application.rb +3 -0
  15. data/config/dependencies.rb +4 -25
  16. data/kozo.gemspec +20 -5
  17. data/lib/core_ext/boolean.rb +12 -0
  18. data/lib/core_ext/nil_class.rb +11 -0
  19. data/lib/core_ext/string.rb +25 -0
  20. data/lib/kozo/backend.rb +81 -0
  21. data/lib/kozo/backends/git.rb +50 -0
  22. data/lib/kozo/backends/local.rb +41 -15
  23. data/lib/kozo/backends/memory.rb +26 -0
  24. data/lib/kozo/cli.rb +30 -9
  25. data/lib/kozo/command.rb +32 -0
  26. data/lib/kozo/commands/apply.rb +44 -0
  27. data/lib/kozo/commands/console.rb +15 -0
  28. data/lib/kozo/commands/import.rb +47 -0
  29. data/lib/kozo/commands/init.rb +15 -0
  30. data/lib/kozo/commands/plan.rb +29 -3
  31. data/lib/kozo/commands/refresh.rb +21 -0
  32. data/lib/kozo/commands/show.rb +15 -0
  33. data/lib/kozo/commands/state.rb +64 -0
  34. data/lib/kozo/commands/validate.rb +13 -0
  35. data/lib/kozo/commands/version.rb +13 -0
  36. data/lib/kozo/concerns/assignment.rb +17 -0
  37. data/lib/kozo/concerns/attributes.rb +99 -0
  38. data/lib/kozo/concerns/mark.rb +25 -0
  39. data/lib/kozo/concerns/track.rb +47 -0
  40. data/lib/kozo/configuration.rb +34 -7
  41. data/lib/kozo/dsl.rb +18 -12
  42. data/lib/kozo/error.rb +13 -0
  43. data/lib/kozo/logger.rb +8 -4
  44. data/lib/kozo/operation.rb +42 -0
  45. data/lib/kozo/operations/create.rb +29 -0
  46. data/lib/kozo/operations/destroy.rb +29 -0
  47. data/lib/kozo/operations/show.rb +12 -0
  48. data/lib/kozo/operations/update.rb +19 -0
  49. data/lib/kozo/options.rb +9 -1
  50. data/lib/kozo/parser.rb +35 -0
  51. data/lib/kozo/provider.rb +7 -1
  52. data/lib/kozo/providers/dummy/dependencies.rb +9 -0
  53. data/lib/kozo/providers/{null → dummy}/provider.rb +2 -6
  54. data/lib/kozo/providers/dummy/resource.rb +19 -0
  55. data/lib/kozo/providers/dummy/resources/dummy.rb +16 -0
  56. data/lib/kozo/providers/hcloud/dependencies.rb +13 -0
  57. data/lib/kozo/providers/hcloud/provider.rb +7 -1
  58. data/lib/kozo/providers/hcloud/resource.rb +46 -1
  59. data/lib/kozo/providers/hcloud/resources/server.rb +29 -0
  60. data/lib/kozo/providers/hcloud/resources/ssh_key.rb +6 -2
  61. data/lib/kozo/resource.rb +110 -3
  62. data/lib/kozo/state.rb +25 -0
  63. data/lib/kozo/type.rb +15 -0
  64. data/lib/kozo/types/boolean.rb +30 -0
  65. data/lib/kozo/types/date.rb +20 -0
  66. data/lib/kozo/types/float.rb +17 -0
  67. data/lib/kozo/types/hash.rb +20 -0
  68. data/lib/kozo/types/integer.rb +17 -0
  69. data/lib/kozo/types/string.rb +17 -0
  70. data/lib/kozo/types/time.rb +18 -0
  71. data/lib/kozo/version.rb +1 -1
  72. data/lib/kozo.rb +13 -7
  73. metadata +195 -31
  74. data/.github/dependabot.yml +0 -14
  75. data/.github/workflows/ci.yml +0 -81
  76. data/bin/bundle +0 -118
  77. data/bin/console +0 -7
  78. data/bin/rspec +0 -28
  79. data/bin/version +0 -62
  80. data/lib/kozo/backends/base.rb +0 -31
  81. data/lib/kozo/commands/base.rb +0 -21
  82. data/lib/kozo/container.rb +0 -35
  83. data/lib/kozo/environment.rb +0 -27
  84. data/lib/kozo/providers/null/resource.rb +0 -11
  85. data/lib/kozo/providers/null/resources/null.rb +0 -13
  86. data/log/.keep +0 -0
metadata CHANGED
@@ -1,37 +1,121 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kozo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Dejonckheere
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-23 00:00:00.000000000 Z
11
+ date: 2021-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activemodel
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '6.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '6.0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: activesupport
15
29
  requirement: !ruby/object:Gem::Requirement
16
30
  requirements:
17
- - - ">="
31
+ - - "~>"
18
32
  - !ruby/object:Gem::Version
19
- version: '0'
33
+ version: '6.0'
20
34
  type: :runtime
21
35
  prerelease: false
22
36
  version_requirements: !ruby/object:Gem::Requirement
23
37
  requirements:
24
- - - ">="
38
+ - - "~>"
25
39
  - !ruby/object:Gem::Version
26
- version: '0'
40
+ version: '6.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: colorize
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.8'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.8'
55
+ - !ruby/object:Gem::Dependency
56
+ name: dinja
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '2.0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '2.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: dotenv
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '2.7'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '2.7'
83
+ - !ruby/object:Gem::Dependency
84
+ name: git
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.9'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.9'
27
97
  - !ruby/object:Gem::Dependency
28
98
  name: zeitwerk
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '2.4'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '2.4'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop
29
113
  requirement: !ruby/object:Gem::Requirement
30
114
  requirements:
31
115
  - - ">="
32
116
  - !ruby/object:Gem::Version
33
117
  version: '0'
34
- type: :runtime
118
+ type: :development
35
119
  prerelease: false
36
120
  version_requirements: !ruby/object:Gem::Requirement
37
121
  requirements:
@@ -39,7 +123,7 @@ dependencies:
39
123
  - !ruby/object:Gem::Version
40
124
  version: '0'
41
125
  - !ruby/object:Gem::Dependency
42
- name: rubocop
126
+ name: rubocop-performance
43
127
  requirement: !ruby/object:Gem::Requirement
44
128
  requirements:
45
129
  - - ">="
@@ -53,7 +137,7 @@ dependencies:
53
137
  - !ruby/object:Gem::Version
54
138
  version: '0'
55
139
  - !ruby/object:Gem::Dependency
56
- name: rubocop-performance
140
+ name: rubocop-rake
57
141
  requirement: !ruby/object:Gem::Requirement
58
142
  requirements:
59
143
  - - ">="
@@ -108,6 +192,20 @@ dependencies:
108
192
  - - ">="
109
193
  - !ruby/object:Gem::Version
110
194
  version: '0'
195
+ - !ruby/object:Gem::Dependency
196
+ name: fakefs
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - ">="
200
+ - !ruby/object:Gem::Version
201
+ version: '0'
202
+ type: :development
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - ">="
207
+ - !ruby/object:Gem::Version
208
+ version: '0'
111
209
  - !ruby/object:Gem::Dependency
112
210
  name: ffaker
113
211
  requirement: !ruby/object:Gem::Requirement
@@ -150,6 +248,20 @@ dependencies:
150
248
  - - ">="
151
249
  - !ruby/object:Gem::Version
152
250
  version: '0'
251
+ - !ruby/object:Gem::Dependency
252
+ name: rake
253
+ requirement: !ruby/object:Gem::Requirement
254
+ requirements:
255
+ - - ">="
256
+ - !ruby/object:Gem::Version
257
+ version: '0'
258
+ type: :development
259
+ prerelease: false
260
+ version_requirements: !ruby/object:Gem::Requirement
261
+ requirements:
262
+ - - ">="
263
+ - !ruby/object:Gem::Version
264
+ version: '0'
153
265
  - !ruby/object:Gem::Dependency
154
266
  name: rspec
155
267
  requirement: !ruby/object:Gem::Requirement
@@ -178,6 +290,20 @@ dependencies:
178
290
  - - ">="
179
291
  - !ruby/object:Gem::Version
180
292
  version: '0'
293
+ - !ruby/object:Gem::Dependency
294
+ name: simplecov
295
+ requirement: !ruby/object:Gem::Requirement
296
+ requirements:
297
+ - - ">="
298
+ - !ruby/object:Gem::Version
299
+ version: '0'
300
+ type: :development
301
+ prerelease: false
302
+ version_requirements: !ruby/object:Gem::Requirement
303
+ requirements:
304
+ - - ">="
305
+ - !ruby/object:Gem::Version
306
+ version: '0'
181
307
  - !ruby/object:Gem::Dependency
182
308
  name: super_diff
183
309
  requirement: !ruby/object:Gem::Requirement
@@ -220,22 +346,31 @@ dependencies:
220
346
  - - ">="
221
347
  - !ruby/object:Gem::Version
222
348
  version: '0'
349
+ - !ruby/object:Gem::Dependency
350
+ name: jekyll
351
+ requirement: !ruby/object:Gem::Requirement
352
+ requirements:
353
+ - - ">="
354
+ - !ruby/object:Gem::Version
355
+ version: '0'
356
+ type: :development
357
+ prerelease: false
358
+ version_requirements: !ruby/object:Gem::Requirement
359
+ requirements:
360
+ - - ">="
361
+ - !ruby/object:Gem::Version
362
+ version: '0'
223
363
  description: Declaratively create, modify and destroy cloud infrastructure in your
224
364
  favourite language
225
365
  email:
226
366
  - florian@floriandejonckheere.be
227
367
  executables:
228
- - bundle
229
- - console
230
368
  - kozo
231
- - rspec
232
- - version
233
369
  extensions: []
234
370
  extra_rdoc_files: []
235
371
  files:
236
- - ".github/dependabot.yml"
237
- - ".github/workflows/ci.yml"
238
372
  - ".gitignore"
373
+ - ".kzignore"
239
374
  - ".overcommit.yml"
240
375
  - ".rspec"
241
376
  - ".rubocop.yml"
@@ -245,42 +380,72 @@ files:
245
380
  - LICENSE.md
246
381
  - README.md
247
382
  - Rakefile
248
- - bin/bundle
249
- - bin/console
250
383
  - bin/kozo
251
- - bin/rspec
252
- - bin/version
253
384
  - config/application.rb
254
385
  - config/dependencies.rb
255
386
  - config/inflections.rb
256
387
  - kozo.gemspec
388
+ - lib/core_ext/boolean.rb
389
+ - lib/core_ext/nil_class.rb
390
+ - lib/core_ext/string.rb
257
391
  - lib/kozo.rb
258
- - lib/kozo/backends/base.rb
392
+ - lib/kozo/backend.rb
393
+ - lib/kozo/backends/git.rb
259
394
  - lib/kozo/backends/local.rb
395
+ - lib/kozo/backends/memory.rb
260
396
  - lib/kozo/cli.rb
261
- - lib/kozo/commands/base.rb
397
+ - lib/kozo/command.rb
398
+ - lib/kozo/commands/apply.rb
399
+ - lib/kozo/commands/console.rb
400
+ - lib/kozo/commands/import.rb
401
+ - lib/kozo/commands/init.rb
262
402
  - lib/kozo/commands/plan.rb
403
+ - lib/kozo/commands/refresh.rb
404
+ - lib/kozo/commands/show.rb
405
+ - lib/kozo/commands/state.rb
406
+ - lib/kozo/commands/validate.rb
407
+ - lib/kozo/commands/version.rb
408
+ - lib/kozo/concerns/assignment.rb
409
+ - lib/kozo/concerns/attributes.rb
410
+ - lib/kozo/concerns/mark.rb
411
+ - lib/kozo/concerns/track.rb
263
412
  - lib/kozo/configuration.rb
264
- - lib/kozo/container.rb
265
413
  - lib/kozo/dsl.rb
266
- - lib/kozo/environment.rb
414
+ - lib/kozo/error.rb
267
415
  - lib/kozo/logger.rb
416
+ - lib/kozo/operation.rb
417
+ - lib/kozo/operations/create.rb
418
+ - lib/kozo/operations/destroy.rb
419
+ - lib/kozo/operations/show.rb
420
+ - lib/kozo/operations/update.rb
268
421
  - lib/kozo/options.rb
422
+ - lib/kozo/parser.rb
269
423
  - lib/kozo/provider.rb
424
+ - lib/kozo/providers/dummy/dependencies.rb
425
+ - lib/kozo/providers/dummy/provider.rb
426
+ - lib/kozo/providers/dummy/resource.rb
427
+ - lib/kozo/providers/dummy/resources/dummy.rb
428
+ - lib/kozo/providers/hcloud/dependencies.rb
270
429
  - lib/kozo/providers/hcloud/provider.rb
271
430
  - lib/kozo/providers/hcloud/resource.rb
431
+ - lib/kozo/providers/hcloud/resources/server.rb
272
432
  - lib/kozo/providers/hcloud/resources/ssh_key.rb
273
- - lib/kozo/providers/null/provider.rb
274
- - lib/kozo/providers/null/resource.rb
275
- - lib/kozo/providers/null/resources/null.rb
276
433
  - lib/kozo/resource.rb
434
+ - lib/kozo/state.rb
435
+ - lib/kozo/type.rb
436
+ - lib/kozo/types/boolean.rb
437
+ - lib/kozo/types/date.rb
438
+ - lib/kozo/types/float.rb
439
+ - lib/kozo/types/hash.rb
440
+ - lib/kozo/types/integer.rb
441
+ - lib/kozo/types/string.rb
442
+ - lib/kozo/types/time.rb
277
443
  - lib/kozo/version.rb
278
- - log/.keep
279
444
  homepage: http://github.com/floriandejonckheere/kozo
280
445
  licenses:
281
446
  - MIT
282
447
  metadata:
283
- source_code_uri: https://github.com/floriandejonckheere/kozo
448
+ rubygems_mfa_required: 'true'
284
449
  post_install_message:
285
450
  rdoc_options: []
286
451
  require_paths:
@@ -289,15 +454,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
289
454
  requirements:
290
455
  - - ">="
291
456
  - !ruby/object:Gem::Version
292
- version: 2.7.2
457
+ version: 3.0.0
293
458
  required_rubygems_version: !ruby/object:Gem::Requirement
294
459
  requirements:
295
460
  - - ">="
296
461
  - !ruby/object:Gem::Version
297
462
  version: '0'
298
463
  requirements: []
299
- rubyforge_project:
300
- rubygems_version: 2.7.6
464
+ rubygems_version: 3.1.2
301
465
  signing_key:
302
466
  specification_version: 4
303
467
  summary: Declarative cloud infrastructure
@@ -1,14 +0,0 @@
1
- version: 2
2
- updates:
3
- - package-ecosystem: bundler
4
- directory: "/"
5
- schedule:
6
- interval: weekly
7
- time: "04:00"
8
- open-pull-requests-limit: 10
9
- - package-ecosystem: github-actions
10
- directory: "/"
11
- schedule:
12
- interval: weekly
13
- time: "04:00"
14
- open-pull-requests-limit: 10
@@ -1,81 +0,0 @@
1
- name: Continuous Integration
2
-
3
- on:
4
- push:
5
- branches:
6
- - '**'
7
- tags-ignore:
8
- - 'production'
9
-
10
- jobs:
11
- test:
12
- name: Test application
13
- if: "!contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci')"
14
- runs-on: ubuntu-latest
15
-
16
- container:
17
- image: ruby:2.7-alpine
18
-
19
- steps:
20
- - uses: actions/checkout@v2
21
-
22
- - name: Install dependencies
23
- run: |
24
- apk add build-base curl-dev git
25
- apk add tar
26
-
27
- - name: Cache Gems
28
- uses: actions/cache@v2.1.3
29
- with:
30
- path: vendor/bundle
31
- key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }}
32
- restore-keys: |
33
- ${{ runner.os }}-gem-
34
-
35
- - name: Install Gems
36
- run: |
37
- gem install bundler
38
- bundle config path vendor/bundle
39
- bundle install --jobs 4 --retry 3
40
-
41
- - name: Test
42
- run: |
43
- bundle exec rspec --profile 10 --format progress
44
-
45
- - name: Lint
46
- run: bundle exec rubocop --parallel --display-cop-names
47
-
48
- release:
49
- name: Create release
50
- if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
51
- runs-on: ubuntu-latest
52
- needs: test
53
-
54
- steps:
55
- - uses: actions/checkout@v2
56
-
57
- - name: Set version
58
- run: |
59
- echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
60
-
61
- - name: Publish to RubyGems
62
- run: |
63
- mkdir -p ~/.gem
64
- touch ~/.gem/credentials
65
- chmod 0600 ~/.gem/credentials
66
- printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > ~/.gem/credentials
67
- gem build *.gemspec
68
- gem push *.gem
69
- env:
70
- GEM_HOST_API_KEY: ${{secrets.RUBYGEMS_API_KEY}}
71
-
72
- - name: Create Github Release
73
- uses: actions/create-release@v1
74
- env:
75
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76
- with:
77
- tag_name: ${{ github.ref }}
78
- release_name: ${{ github.event.repository.name }} ${{ env.VERSION }}
79
- prerelease: contains(github.ref, '-')
80
- body: |
81
- Application ${{ github.event.repository.name }} ${{ env.VERSION }} was released
data/bin/bundle DELETED
@@ -1,118 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- #
5
- # This file was generated by Bundler.
6
- #
7
- # The application 'bundle' is installed as part of a gem, and
8
- # this file is here to facilitate running it.
9
- #
10
-
11
- require "rubygems"
12
-
13
- m = Module.new do
14
- module_function
15
-
16
- def invoked_as_script?
17
- File.expand_path($PROGRAM_NAME) == File.expand_path(__FILE__)
18
- end
19
-
20
- def env_var_version
21
- ENV["BUNDLER_VERSION"]
22
- end
23
-
24
- def cli_arg_version
25
- return unless invoked_as_script? # don't want to hijack other binstubs
26
- return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
27
-
28
- bundler_version = nil
29
- update_index = nil
30
- ARGV.each_with_index do |a, i|
31
- bundler_version = a if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
32
- next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/o
33
-
34
- bundler_version = Regexp.last_match(1)
35
- update_index = i
36
- end
37
- bundler_version
38
- end
39
-
40
- def gemfile
41
- gemfile = ENV["BUNDLE_GEMFILE"]
42
- return gemfile if gemfile && !gemfile.empty?
43
-
44
- File.expand_path("../Gemfile", __dir__)
45
- end
46
-
47
- def lockfile
48
- lockfile =
49
- case File.basename(gemfile)
50
- when "gems.rb" then gemfile.sub(/\.rb$/, gemfile)
51
- else "#{gemfile}.lock"
52
- end
53
- File.expand_path(lockfile)
54
- end
55
-
56
- def lockfile_version
57
- return unless File.file?(lockfile)
58
-
59
- lockfile_contents = File.read(lockfile)
60
- return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/o
61
-
62
- Regexp.last_match(1)
63
- end
64
-
65
- def bundler_version
66
- @bundler_version ||=
67
- env_var_version || cli_arg_version ||
68
- lockfile_version
69
- end
70
-
71
- def bundler_requirement
72
- return "#{Gem::Requirement.default}.a" unless bundler_version
73
-
74
- bundler_gem_version = Gem::Version.new(bundler_version)
75
-
76
- requirement = bundler_gem_version.approximate_recommendation
77
-
78
- return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0")
79
-
80
- requirement += ".a" if bundler_gem_version.prerelease?
81
-
82
- requirement
83
- end
84
-
85
- def load_bundler!
86
- ENV["BUNDLE_GEMFILE"] ||= gemfile
87
-
88
- activate_bundler
89
- end
90
-
91
- def activate_bundler
92
- gem_error = activation_error_handling do
93
- gem "bundler", bundler_requirement
94
- end
95
- return if gem_error.nil?
96
-
97
- require_error = activation_error_handling do
98
- require "bundler/version"
99
- end
100
- if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
101
- return
102
- end
103
-
104
- warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
105
- exit 42
106
- end
107
-
108
- def activation_error_handling
109
- yield
110
- nil
111
- rescue StandardError, LoadError => e
112
- e
113
- end
114
- end
115
-
116
- m.load_bundler!
117
-
118
- load Gem.bin_path("bundler", "bundle") if m.invoked_as_script?
data/bin/console DELETED
@@ -1,7 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require_relative "../config/application"
5
-
6
- require "irb"
7
- IRB.start(__FILE__)
data/bin/rspec DELETED
@@ -1,28 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- #
5
- # This file was generated by Bundler.
6
- #
7
- # The application 'rspec' is installed as part of a gem, and
8
- # this file is here to facilitate running it.
9
- #
10
-
11
- require "pathname"
12
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", Pathname.new(__FILE__).realpath)
13
-
14
- bundle_binstub = File.expand_path("bundle", __dir__)
15
-
16
- if File.file?(bundle_binstub)
17
- if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 300))
18
- load(bundle_binstub)
19
- else
20
- abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
21
- Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
22
- end
23
- end
24
-
25
- require "rubygems"
26
- require "bundler/setup"
27
-
28
- load Gem.bin_path("rspec-core", "rspec")
data/bin/version DELETED
@@ -1,62 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require_relative "../config/application"
5
-
6
- FILE = Kozo.root.join("lib/kozo/version.rb")
7
-
8
- def usage(error: false)
9
- puts "Usage: #{$PROGRAM_NAME} [major [VERSION] | minor [VERSION] | patch [VERSION] | pre VERSION]"
10
- puts " #{$PROGRAM_NAME} major\t\tIncrement major version number"
11
- puts " #{$PROGRAM_NAME} major VERSION\tSet major version number"
12
- puts " #{$PROGRAM_NAME} minor\t\tIncrement minor version number"
13
- puts " #{$PROGRAM_NAME} minor VERSION\tSet minor version number"
14
- puts " #{$PROGRAM_NAME} patch\t\tIncrement patch version number"
15
- puts " #{$PROGRAM_NAME} patch VERSION\tSet patch version number"
16
- puts " #{$PROGRAM_NAME} pre\t\tClear pre version number"
17
- puts " #{$PROGRAM_NAME} pre VERSION\tSet pre version number"
18
- puts " #{$PROGRAM_NAME} version VERSION\tSet entire version number"
19
-
20
- exit 1 if error
21
- end
22
-
23
- def bump(hash)
24
- hash.each do |level, version|
25
- File.write FILE, File.read(FILE).gsub(/#{level}( +)= [^\n]*/) { "#{level}#{$LAST_MATCH_INFO[1]}= #{version}" }
26
- end
27
-
28
- silence_warnings { load FILE }
29
-
30
- File.write FILE_JS, File.read(FILE_JS).gsub(/"version": "[^"]*"/) { "\"version\": \"#{Kozo::VERSION}\"" }
31
- end
32
-
33
- case ARGV.shift&.to_sym
34
- when nil
35
- # Print version
36
- puts "v#{Kozo::VERSION}"
37
- when :version
38
- usage(error: true) unless ARGV.any?
39
-
40
- version, pre = ARGV.shift.split("-")
41
- major, minor, patch = version.split(".")
42
-
43
- bump MAJOR: major, MINOR: minor, PATCH: patch, PRE: (pre ? "\"#{pre}\"" : "nil")
44
- puts "Setting version to #{Kozo::VERSION}"
45
- when :major
46
- # Bump major version
47
- bump MAJOR: (ARGV.pop || Kozo::Version::MAJOR + 1), MINOR: 0, PATCH: 0, PRE: "nil"
48
- puts "Bumping version to #{Kozo::VERSION}"
49
- when :minor
50
- # Bump minor version
51
- bump MINOR: (ARGV.pop || Kozo::Version::MINOR + 1), PATCH: 0, PRE: "nil"
52
- puts "Bumping version to #{Kozo::VERSION}"
53
- when :patch
54
- # Bump patch version
55
- bump PATCH: (ARGV.pop || Kozo::Version::PATCH + 1), PRE: "nil"
56
- puts "Bumping version to #{Kozo::VERSION}"
57
- when :pre
58
- # Set or clear patch version
59
- bump PRE: (ARGV.any? ? "\"#{ARGV.shift}\"" : "nil")
60
- else
61
- usage
62
- end
@@ -1,31 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Kozo
4
- module Backends
5
- class Base
6
- attr_accessor :directory
7
-
8
- def initialize(directory)
9
- @directory = directory
10
- end
11
-
12
- def providers
13
- state.fetch(:providers)
14
- end
15
-
16
- def resources
17
- state.fetch(:resources)
18
- end
19
-
20
- protected
21
-
22
- def state
23
- raise NotImplementedError
24
- end
25
-
26
- def state=(_value)
27
- raise NotImplementedError
28
- end
29
- end
30
- end
31
- end