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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3af664ebfefded7c930c271aefec9aae7d1d43d22476e9520e6b9e9ff6f4eb22
4
- data.tar.gz: 11ac252c2cf7d89c0031a1564a91e412d09a4e80514d3c94353cbcf1ff5341f1
3
+ metadata.gz: b6f328c53f7a4a3c079a6b01da46e6d669b7a5671b9d145dd28ac0bb9849a214
4
+ data.tar.gz: 7ee031a2ed77304366d4f4d6d6cbfb9ef9525018b54fc89d0109c0da358f84c9
5
5
  SHA512:
6
- metadata.gz: ba28584312b4eb9f395c5af02a0fce4c5637e056eb74e50207e756840564930f5d08be647dd4c5fbeb7d5d2aa57d819a5dedf7462da57fcd1d32476d349cffd0
7
- data.tar.gz: 99ceb6c915ef5420f019392675c8270027a04194648843e98fe317c78afb73afeea4508b62b14ddc5389d2971d3dbf9d26bbc378bec66a178dff83a6a4fbeaee
6
+ metadata.gz: 70a8837f4076eb87771371397f95ca43e73d07f7105b23095214f3f89f5ac85db234b8c4f2407e0f3d9671e2ed10d68fbb5f4cd9d27356248cfdf86fb0a693dd
7
+ data.tar.gz: 1b8d14f8bceaae53776d94db21e7651b5b65fe88074e0297175067c04941e2dc57618640993795945eb82235d686fe93f31ef714adc1f0fd659ee82ec612db68
data/.gitignore CHANGED
@@ -14,9 +14,10 @@
14
14
  /test/tmp/
15
15
  /test/version_tmp/
16
16
  /tmp/
17
+ /vendor/
17
18
 
18
19
  # Used by dotenv library to load environment variables.
19
- # .env
20
+ .env
20
21
 
21
22
  # Ignore Byebug command history file.
22
23
  .byebug_history
@@ -39,8 +40,8 @@ build-iPhoneSimulator/
39
40
  ## Documentation cache and generated files:
40
41
  /.yardoc/
41
42
  /_yardoc/
42
- /doc/
43
43
  /rdoc/
44
+ /doc/
44
45
 
45
46
  ## Environment normalization:
46
47
  /.bundle/
@@ -67,3 +68,7 @@ build-iPhoneSimulator/
67
68
 
68
69
  ### RubyMine ###
69
70
  .idea
71
+
72
+ ### Kozo ###
73
+ *.kz
74
+ *.kzstate
data/.kzignore ADDED
@@ -0,0 +1 @@
1
+ /spec/
data/.overcommit.yml CHANGED
@@ -19,6 +19,7 @@ PreCommit:
19
19
  RuboCop:
20
20
  enabled: true
21
21
  on_warn: fail # Treat all warnings as failures
22
+ command: ["bin/rubocop"]
22
23
 
23
24
  TrailingWhitespace:
24
25
  enabled: true
data/.rspec CHANGED
@@ -1,2 +1,3 @@
1
1
  --color
2
2
  --require spec_helper
3
+ --tag ~integration
data/.rubocop.yml CHANGED
@@ -8,12 +8,13 @@ AllCops:
8
8
  - tmp/**/*
9
9
  - vendor/**/*
10
10
  - bin/**/*
11
- TargetRubyVersion: 2.7
11
+ TargetRubyVersion: 3.0
12
+
13
+ Layout/FirstHashElementIndentation:
14
+ EnforcedStyle: consistent
12
15
 
13
16
  Layout/LineLength:
14
- Max: 120
15
- Exclude:
16
- - spec/**/*
17
+ Enabled: false
17
18
 
18
19
  Layout/MultilineMethodCallIndentation:
19
20
  EnforcedStyle: indented
@@ -24,27 +25,62 @@ Layout/ParameterAlignment:
24
25
  Lint/EmptyClass:
25
26
  Enabled: false
26
27
 
28
+ Lint/MissingSuper:
29
+ Enabled: false
30
+
27
31
  Metrics/AbcSize:
28
- Max: 20
32
+ Enabled: false
29
33
 
30
34
  Metrics/BlockLength:
35
+ Max: 30
31
36
  Exclude:
32
37
  - spec/**/*
33
38
  - "*.gemspec"
34
39
 
40
+ Metrics/CyclomaticComplexity:
41
+ Enabled: false
42
+
35
43
  Metrics/MethodLength:
36
44
  Max: 20
37
45
 
46
+ Metrics/PerceivedComplexity:
47
+ Enabled: false
48
+
49
+ RSpec/DescribeClass:
50
+ Enabled: false
51
+
52
+ RSpec/EmptyExampleGroup:
53
+ Enabled: false
54
+
38
55
  RSpec/ExampleLength:
39
56
  Max: 20
40
57
 
41
58
  RSpec/FilePath:
42
59
  CustomTransform:
43
60
  HCloud: hcloud
61
+ SpecSuffixOnly: true
62
+
63
+ RSpec/MessageSpies:
64
+ Enabled: false
65
+
66
+ RSpec/MultipleExpectations:
67
+ Max: 5
68
+
69
+ RSpec/MultipleMemoizedHelpers:
70
+ Max: 10
71
+
72
+ RSpec/NestedGroups:
73
+ Max: 5
44
74
 
45
75
  Style/Documentation:
46
76
  Enabled: false
47
77
 
78
+ Style/DoubleNegation:
79
+ Enabled: false
80
+
81
+ Style/OpenStructUse:
82
+ Enabled: false
83
+
48
84
  Style/StringLiterals:
49
85
  EnforcedStyle: double_quotes
50
86
 
@@ -68,3 +104,6 @@ Style/PercentLiteralDelimiters:
68
104
  "%r": "()"
69
105
  "%w": "()"
70
106
  "%W": "()"
107
+
108
+ Style/WordArray:
109
+ EnforcedStyle: brackets
data/CHANGELOG.md CHANGED
@@ -3,3 +3,8 @@
3
3
  ## Kozo v0.1.0
4
4
 
5
5
  Initial release
6
+
7
+ ## Kozo v0.2.0
8
+
9
+ - Add SSH Key and Server resource
10
+ - Update only changed attributes
data/Gemfile CHANGED
@@ -4,6 +4,8 @@ source "https://rubygems.org"
4
4
 
5
5
  git_source(:github) { |repo| "https://github.com/#{repo}.git" }
6
6
 
7
- ruby "~> 2.7"
7
+ ruby "~> 3.0"
8
8
 
9
9
  gemspec
10
+
11
+ gem "hcloud", github: "floriandejonckheere/hcloud"
data/Gemfile.lock CHANGED
@@ -1,47 +1,129 @@
1
- PATH
2
- remote: .
1
+ GIT
2
+ remote: https://github.com/floriandejonckheere/hcloud.git
3
+ revision: c2ef9116c0f696ded8a8e91aba15820481a74936
3
4
  specs:
4
- kozo (0.1.0)
5
+ hcloud (1.0.0)
6
+ activemodel
5
7
  activesupport
8
+ http
6
9
  zeitwerk
7
10
 
11
+ PATH
12
+ remote: .
13
+ specs:
14
+ kozo (0.2.0)
15
+ activemodel (~> 6.0)
16
+ activesupport (~> 6.0)
17
+ colorize (~> 0.8)
18
+ dinja (~> 2.0)
19
+ dotenv (~> 2.7)
20
+ git (~> 1.9)
21
+ zeitwerk (~> 2.4)
22
+
8
23
  GEM
9
24
  remote: https://rubygems.org/
10
25
  specs:
11
- activesupport (6.1.0)
26
+ activemodel (6.1.4.1)
27
+ activesupport (= 6.1.4.1)
28
+ activesupport (6.1.4.1)
12
29
  concurrent-ruby (~> 1.0, >= 1.0.2)
13
30
  i18n (>= 1.6, < 2)
14
31
  minitest (>= 5.1)
15
32
  tzinfo (~> 2.0)
16
33
  zeitwerk (~> 2.3)
17
- addressable (2.7.0)
34
+ addressable (2.8.0)
18
35
  public_suffix (>= 2.0.2, < 5.0)
19
- ast (2.4.1)
20
- attr_extras (6.2.4)
36
+ ast (2.4.2)
37
+ attr_extras (6.2.5)
21
38
  byebug (11.1.3)
22
- childprocess (4.0.0)
23
- climate_control (0.2.0)
39
+ childprocess (4.1.0)
40
+ climate_control (1.0.1)
24
41
  coderay (1.1.3)
25
- concurrent-ruby (1.1.7)
26
- crack (0.4.4)
42
+ colorator (1.1.0)
43
+ colorize (0.8.1)
44
+ concurrent-ruby (1.1.9)
45
+ crack (0.4.5)
46
+ rexml
27
47
  diff-lcs (1.4.4)
28
- factory_bot (6.1.0)
48
+ dinja (2.0.0)
49
+ zeitwerk
50
+ docile (1.4.0)
51
+ domain_name (0.5.20190701)
52
+ unf (>= 0.0.5, < 1.0.0)
53
+ dotenv (2.7.6)
54
+ em-websocket (0.5.3)
55
+ eventmachine (>= 0.12.9)
56
+ http_parser.rb (~> 0)
57
+ eventmachine (1.2.7)
58
+ factory_bot (6.2.0)
29
59
  activesupport (>= 5.0.0)
30
- ffaker (2.17.0)
60
+ fakefs (1.4.0)
61
+ ffaker (2.20.0)
62
+ ffi (1.15.4)
63
+ ffi-compiler (1.0.1)
64
+ ffi (>= 1.0.0)
65
+ rake
66
+ forwardable-extended (2.6.0)
67
+ git (1.9.1)
68
+ rchardet (~> 1.8)
31
69
  hashdiff (1.0.1)
32
- i18n (1.8.5)
70
+ http (5.0.4)
71
+ addressable (~> 2.8)
72
+ http-cookie (~> 1.0)
73
+ http-form_data (~> 2.2)
74
+ llhttp-ffi (~> 0.4.0)
75
+ http-cookie (1.0.4)
76
+ domain_name (~> 0.5)
77
+ http-form_data (2.3.0)
78
+ http_parser.rb (0.8.0)
79
+ i18n (1.8.11)
33
80
  concurrent-ruby (~> 1.0)
34
81
  iniparse (1.5.0)
82
+ jekyll (4.2.1)
83
+ addressable (~> 2.4)
84
+ colorator (~> 1.0)
85
+ em-websocket (~> 0.5)
86
+ i18n (~> 1.0)
87
+ jekyll-sass-converter (~> 2.0)
88
+ jekyll-watch (~> 2.0)
89
+ kramdown (~> 2.3)
90
+ kramdown-parser-gfm (~> 1.0)
91
+ liquid (~> 4.0)
92
+ mercenary (~> 0.4.0)
93
+ pathutil (~> 0.9)
94
+ rouge (~> 3.0)
95
+ safe_yaml (~> 1.0)
96
+ terminal-table (~> 2.0)
97
+ jekyll-sass-converter (2.1.0)
98
+ sassc (> 2.0.1, < 3.0)
99
+ jekyll-watch (2.2.1)
100
+ listen (~> 3.0)
101
+ kramdown (2.3.1)
102
+ rexml
103
+ kramdown-parser-gfm (1.1.0)
104
+ kramdown (~> 2.0)
105
+ liquid (4.0.3)
106
+ listen (3.7.0)
107
+ rb-fsevent (~> 0.10, >= 0.10.3)
108
+ rb-inotify (~> 0.9, >= 0.9.10)
109
+ llhttp-ffi (0.4.0)
110
+ ffi-compiler (~> 1.0)
111
+ rake (~> 13.0)
112
+ mercenary (0.4.0)
35
113
  method_source (1.0.0)
36
- minitest (5.14.2)
37
- overcommit (0.57.0)
114
+ minitest (5.14.4)
115
+ optimist (3.0.1)
116
+ overcommit (0.58.0)
38
117
  childprocess (>= 0.6.3, < 5)
39
118
  iniparse (~> 1.4)
40
- parallel (1.20.1)
41
- parser (2.7.2.0)
119
+ rexml (~> 3.2)
120
+ parallel (1.21.0)
121
+ parser (3.0.3.0)
42
122
  ast (~> 2.4.1)
43
- patience_diff (1.1.0)
44
- trollop (~> 1.16)
123
+ pathutil (0.16.2)
124
+ forwardable-extended (~> 2.6)
125
+ patience_diff (1.2.0)
126
+ optimist (~> 3.0)
45
127
  pry (0.13.1)
46
128
  coderay (~> 1.1)
47
129
  method_source (~> 1.0)
@@ -50,55 +132,75 @@ GEM
50
132
  pry (~> 0.13.0)
51
133
  public_suffix (4.0.6)
52
134
  rainbow (3.0.0)
53
- regexp_parser (2.0.0)
54
- rexml (3.2.4)
135
+ rake (13.0.6)
136
+ rb-fsevent (0.11.0)
137
+ rb-inotify (0.10.1)
138
+ ffi (~> 1.0)
139
+ rchardet (1.8.0)
140
+ regexp_parser (2.1.1)
141
+ rexml (3.2.5)
142
+ rouge (3.26.1)
55
143
  rspec (3.10.0)
56
144
  rspec-core (~> 3.10.0)
57
145
  rspec-expectations (~> 3.10.0)
58
146
  rspec-mocks (~> 3.10.0)
59
- rspec-core (3.10.0)
147
+ rspec-core (3.10.1)
60
148
  rspec-support (~> 3.10.0)
61
- rspec-expectations (3.10.0)
149
+ rspec-expectations (3.10.1)
62
150
  diff-lcs (>= 1.2.0, < 2.0)
63
151
  rspec-support (~> 3.10.0)
64
- rspec-mocks (3.10.0)
152
+ rspec-mocks (3.10.2)
65
153
  diff-lcs (>= 1.2.0, < 2.0)
66
154
  rspec-support (~> 3.10.0)
67
- rspec-support (3.10.0)
68
- rubocop (1.6.1)
155
+ rspec-support (3.10.3)
156
+ rubocop (1.23.0)
69
157
  parallel (~> 1.10)
70
- parser (>= 2.7.1.5)
158
+ parser (>= 3.0.0.0)
71
159
  rainbow (>= 2.2.2, < 4.0)
72
160
  regexp_parser (>= 1.8, < 3.0)
73
161
  rexml
74
- rubocop-ast (>= 1.2.0, < 2.0)
162
+ rubocop-ast (>= 1.12.0, < 2.0)
75
163
  ruby-progressbar (~> 1.7)
76
- unicode-display_width (>= 1.4.0, < 2.0)
77
- rubocop-ast (1.3.0)
78
- parser (>= 2.7.1.5)
79
- rubocop-performance (1.9.1)
80
- rubocop (>= 0.90.0, < 2.0)
164
+ unicode-display_width (>= 1.4.0, < 3.0)
165
+ rubocop-ast (1.13.0)
166
+ parser (>= 3.0.1.1)
167
+ rubocop-performance (1.12.0)
168
+ rubocop (>= 1.7.0, < 2.0)
81
169
  rubocop-ast (>= 0.4.0)
82
- rubocop-rspec (2.1.0)
170
+ rubocop-rake (0.6.0)
83
171
  rubocop (~> 1.0)
84
- rubocop-ast (>= 1.1.0)
85
- ruby-progressbar (1.10.1)
86
- shoulda-matchers (4.4.1)
87
- activesupport (>= 4.2.0)
88
- super_diff (0.5.2)
172
+ rubocop-rspec (2.6.0)
173
+ rubocop (~> 1.19)
174
+ ruby-progressbar (1.11.0)
175
+ safe_yaml (1.0.5)
176
+ sassc (2.4.0)
177
+ ffi (~> 1.9)
178
+ shoulda-matchers (5.0.0)
179
+ activesupport (>= 5.2.0)
180
+ simplecov (0.21.2)
181
+ docile (~> 1.1)
182
+ simplecov-html (~> 0.11)
183
+ simplecov_json_formatter (~> 0.1)
184
+ simplecov-html (0.12.3)
185
+ simplecov_json_formatter (0.1.3)
186
+ super_diff (0.8.0)
89
187
  attr_extras (>= 6.2.4)
90
188
  diff-lcs
91
189
  patience_diff
92
- timecop (0.9.2)
93
- trollop (1.16.2)
190
+ terminal-table (2.0.0)
191
+ unicode-display_width (~> 1.1, >= 1.1.1)
192
+ timecop (0.9.4)
94
193
  tzinfo (2.0.4)
95
194
  concurrent-ruby (~> 1.0)
96
- unicode-display_width (1.7.0)
97
- webmock (3.11.0)
98
- addressable (>= 2.3.6)
195
+ unf (0.1.4)
196
+ unf_ext
197
+ unf_ext (0.0.8)
198
+ unicode-display_width (1.8.0)
199
+ webmock (3.14.0)
200
+ addressable (>= 2.8.0)
99
201
  crack (>= 0.3.2)
100
202
  hashdiff (>= 0.4.0, < 2.0.0)
101
- zeitwerk (2.4.2)
203
+ zeitwerk (2.5.1)
102
204
 
103
205
  PLATFORMS
104
206
  ruby
@@ -106,21 +208,27 @@ PLATFORMS
106
208
  DEPENDENCIES
107
209
  climate_control
108
210
  factory_bot
211
+ fakefs
109
212
  ffaker
213
+ hcloud!
214
+ jekyll
110
215
  kozo!
111
216
  overcommit
112
217
  pry-byebug
218
+ rake
113
219
  rspec (~> 3.10)
114
220
  rubocop
115
221
  rubocop-performance
222
+ rubocop-rake
116
223
  rubocop-rspec
117
224
  shoulda-matchers
225
+ simplecov
118
226
  super_diff
119
227
  timecop
120
228
  webmock
121
229
 
122
230
  RUBY VERSION
123
- ruby 2.7.2p137
231
+ ruby 3.0.0p0
124
232
 
125
233
  BUNDLED WITH
126
- 2.1.4
234
+ 2.2.22
data/LICENSE.md CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2020 Florian Dejonckheere
1
+ Copyright 2021 Florian Dejonckheere
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -6,6 +6,26 @@
6
6
  _Kōzō_ (構造) is an open-source tool to manage your cloud resources based on the [infrastructure as code](https://en.wikipedia.org/wiki/Infrastructure_as_code) principle.
7
7
  It leverages the power of [Ruby](https://www.ruby-lang.org/en/) to allow you to declare your infrastructure in your favourite language.
8
8
 
9
+ ## Installation
10
+
11
+ Install the gem using your operating system's package manager, or using RubyGems:
12
+
13
+ ```sh
14
+ gem install kozo
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ Execute `kozo --help` to see all available commands and their arguments.
20
+
21
+ See the [documentation site](https://www.kozo.dev/) or the [quickstart guide](https://www.kozo.dev/quickstart) for a more detailed description on how to work with Kozo.
22
+
23
+ ## Documentation
24
+
25
+ A documentation site is provided at `docs/`.
26
+ Run `bundle exec jekyll serve` to build and serve the site locally.
27
+ Once pushed to Github, the [documentation site](https://www.kozo.dev/) is automatically built and published.
28
+
9
29
  ## Release
10
30
 
11
31
  Update the changelog and bump the version using the `bin/version` tool.
@@ -22,6 +42,14 @@ git push origin master
22
42
  git push origin v1.0.0
23
43
  ```
24
44
 
45
+ ## Contributing
46
+
47
+ 1. Fork the repository (<https://github.com/floriandejonckheere/kozo/fork>)
48
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
49
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
50
+ 4. Push to the branch (`git push origin my-new-feature`)
51
+ 5. Create a new Pull Request
52
+
25
53
  ## License
26
54
 
27
55
  See [LICENSE.md](LICENSE.md).
data/Rakefile CHANGED
@@ -1,11 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- begin
4
- require "rspec/core/rake_task"
3
+ require "rspec/core/rake_task"
5
4
 
6
- RSpec::Core::RakeTask.new(:spec)
5
+ RSpec::Core::RakeTask.new(:spec)
7
6
 
8
- task default: :spec
9
- rescue LoadError
10
- puts "RSpec not available."
11
- end
7
+ task default: :spec
data/bin/kozo CHANGED
@@ -4,6 +4,10 @@
4
4
  require_relative "../config/application"
5
5
 
6
6
  require "kozo"
7
- require "byebug"
7
+ require "byebug" if ENV["ENV"] == "development"
8
8
 
9
- Kozo::CLI.new(ARGV).start
9
+ begin
10
+ Kozo::CLI.new(ARGV).start
11
+ rescue Kozo::ExitError => e
12
+ exit(e.message.to_i)
13
+ end
@@ -3,4 +3,7 @@
3
3
  $LOAD_PATH.unshift File.expand_path(File.join(__dir__, "..", "lib"))
4
4
 
5
5
  require "bundler/setup"
6
+
7
+ require "dotenv/load"
8
+
6
9
  require "kozo"
@@ -1,30 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- ##
4
- # Backends
5
- #
6
- register("backend.local") do |directory|
7
- Kozo::Backends::Local.new(directory)
3
+ register("backend.local") do |configuration, directory|
4
+ Kozo::Backends::Local.new(configuration, directory)
8
5
  end
9
6
 
10
- ##
11
- # Null provider
12
- #
13
- register("provider.null") do
14
- Kozo::Providers::Null::Provider.new
15
- end
16
-
17
- register("resource.null") do
18
- Kozo::Providers::Null::Resources::Null.new
19
- end
20
-
21
- ##
22
- # HCloud
23
- #
24
- register("provider.hcloud") do
25
- Kozo::Providers::HCloud::Provider.new
26
- end
27
-
28
- register("resource.hcloud_ssh_key") do
29
- Kozo::Providers::HCloud::Resources::SSHKey.new
7
+ register("backend.git") do |configuration, directory|
8
+ Kozo::Backends::Git.new(configuration, directory)
30
9
  end
data/kozo.gemspec CHANGED
@@ -12,34 +12,49 @@ Gem::Specification.new do |spec|
12
12
  spec.description = "Declaratively create, modify and destroy cloud infrastructure in your favourite language"
13
13
  spec.homepage = "http://github.com/floriandejonckheere/kozo"
14
14
  spec.license = "MIT"
15
- spec.required_ruby_version = Gem::Requirement.new(">= 2.7.2")
15
+ spec.required_ruby_version = Gem::Requirement.new(">= 3.0.0")
16
16
 
17
17
  spec.metadata["source_code_uri"] = "https://github.com/floriandejonckheere/kozo"
18
18
 
19
19
  # Specify which files should be added to the gem when it is released.
20
20
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
21
21
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
22
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
22
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|docs|bin|.github|.rspec|.rubocop.yml)/}) }
23
23
  end
24
24
  spec.bindir = "bin"
25
- spec.executables = spec.files.grep(%r(^bin/)) { |f| File.basename(f) }
25
+ spec.executables = ["kozo"]
26
26
  spec.require_paths = ["lib"]
27
27
 
28
- spec.add_runtime_dependency "activesupport"
29
- spec.add_runtime_dependency "zeitwerk"
28
+ spec.metadata = {
29
+ "rubygems_mfa_required" => "true",
30
+ }
31
+
32
+ spec.add_runtime_dependency "activemodel", "~> 6.0"
33
+ spec.add_runtime_dependency "activesupport", "~> 6.0"
34
+ spec.add_runtime_dependency "colorize", "~> 0.8"
35
+ spec.add_runtime_dependency "dinja", "~> 2.0"
36
+ spec.add_runtime_dependency "dotenv", "~> 2.7"
37
+ spec.add_runtime_dependency "git", "~> 1.9"
38
+ spec.add_runtime_dependency "zeitwerk", "~> 2.4"
30
39
 
31
40
  spec.add_development_dependency "rubocop"
32
41
  spec.add_development_dependency "rubocop-performance"
42
+ spec.add_development_dependency "rubocop-rake"
33
43
  spec.add_development_dependency "rubocop-rspec"
34
44
 
35
45
  spec.add_development_dependency "climate_control"
36
46
  spec.add_development_dependency "factory_bot"
47
+ spec.add_development_dependency "fakefs"
37
48
  spec.add_development_dependency "ffaker"
38
49
  spec.add_development_dependency "overcommit"
39
50
  spec.add_development_dependency "pry-byebug"
51
+ spec.add_development_dependency "rake"
40
52
  spec.add_development_dependency "rspec", "~> 3.10"
41
53
  spec.add_development_dependency "shoulda-matchers"
54
+ spec.add_development_dependency "simplecov"
42
55
  spec.add_development_dependency "super_diff"
43
56
  spec.add_development_dependency "timecop"
44
57
  spec.add_development_dependency "webmock"
58
+
59
+ spec.add_development_dependency "jekyll"
45
60
  end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CoreExt
4
+ module Boolean
5
+ def to_b
6
+ self
7
+ end
8
+ end
9
+ end
10
+
11
+ TrueClass.prepend CoreExt::Boolean
12
+ FalseClass.prepend CoreExt::Boolean
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CoreExt
4
+ module NilClass
5
+ def to_b
6
+ self
7
+ end
8
+ end
9
+ end
10
+
11
+ NilClass.prepend CoreExt::NilClass
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CoreExt
4
+ module String
5
+ # Adapted from active_model/types/boolean
6
+ # rubocop:disable Lint/BooleanSymbol
7
+ FALSE_VALUES = [
8
+ false, 0,
9
+ "0", :"0",
10
+ "f", :f,
11
+ "F", :F,
12
+ "false", :false,
13
+ "FALSE", :FALSE,
14
+ "off", :off,
15
+ "OFF", :OFF,
16
+ ].freeze
17
+ # rubocop:enable Lint/BooleanSymbol
18
+
19
+ def to_b
20
+ self == "" ? nil : FALSE_VALUES.exclude?(self)
21
+ end
22
+ end
23
+ end
24
+
25
+ String.prepend CoreExt::String