foobara-empty-ruby-project-generator 0.0.20 → 0.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/src/write_empty_ruby_project_to_disk.rb +75 -60
- data/templates/Rakefile +1 -1
- data/templates/boot/start.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d54c42677019038cc9b9265a2ccd89ff7642c72054cadd81c70d134b4343c2f4
|
4
|
+
data.tar.gz: 0d1c890589a1b4e0c7c30cfaaf2117eb7f90b139aba29e6ff53bd32871f4c179
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59e1f40a50d33313d88c9a5afbe046b52bf4f44af75d448874daf8dae5356e234c86edd5156eaa348e1436bc127d60e4a4ad7622aee2c77e5c5ce046aa1d8634
|
7
|
+
data.tar.gz: 5859021ff5ff1ada1c6146f30593532558afc9177239579cdc608f6e9991452231e904b33f3963065e6aa5e1320e8a0b3a020421026971f9091ea4d2028406c0
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
## [0.0.22] - 2025-05-07
|
2
|
+
|
3
|
+
- Do not stop just because rubocop fails
|
4
|
+
|
5
|
+
## [0.0.21] - 2025-05-03
|
6
|
+
|
7
|
+
- Make optional things fail-safe when shelling out and simplify the code a bit, too
|
8
|
+
|
1
9
|
## [0.0.20] - 2025-05-03
|
2
10
|
|
3
11
|
- Add use_git, push_to_github, and turn_on_rbenv_bundler options and default them to false
|
@@ -35,6 +35,8 @@ module Foobara
|
|
35
35
|
output
|
36
36
|
end
|
37
37
|
|
38
|
+
attr_accessor :use_git_failed, :push_to_github_failed
|
39
|
+
|
38
40
|
def create_output_directory_if_needed
|
39
41
|
FileUtils.mkdir_p output_directory
|
40
42
|
end
|
@@ -106,22 +108,15 @@ module Foobara
|
|
106
108
|
|
107
109
|
def bundle_install
|
108
110
|
puts "bundling..."
|
109
|
-
|
110
|
-
Open3.popen3("bundle install") do |_stdin, _stdout, stderr, wait_thr|
|
111
|
-
exit_status = wait_thr.value
|
112
|
-
unless exit_status.success?
|
113
|
-
# :nocov:
|
114
|
-
raise "could not bundle install. #{stderr.read}"
|
115
|
-
# :nocov:
|
116
|
-
end
|
117
|
-
end
|
118
|
-
end
|
111
|
+
cmd = "bundle install"
|
119
112
|
|
120
113
|
if Bundler.respond_to?(:with_unbundled_env)
|
121
|
-
Bundler.with_unbundled_env
|
114
|
+
Bundler.with_unbundled_env do
|
115
|
+
run_cmd_and_return_output(cmd)
|
116
|
+
end
|
122
117
|
else
|
123
118
|
# :nocov:
|
124
|
-
|
119
|
+
run_cmd_and_return_output(cmd)
|
125
120
|
# :nocov:
|
126
121
|
end
|
127
122
|
end
|
@@ -129,106 +124,126 @@ module Foobara
|
|
129
124
|
def rubocop_autocorrect
|
130
125
|
puts "linting..."
|
131
126
|
|
132
|
-
|
127
|
+
cmd = "bundle exec rubocop --no-server -A"
|
133
128
|
|
134
129
|
if Bundler.respond_to?(:with_unbundled_env)
|
135
130
|
Bundler.with_unbundled_env do
|
136
|
-
|
131
|
+
run_cmd_and_return_output(cmd)
|
137
132
|
end
|
138
133
|
else
|
139
134
|
# :nocov:
|
140
|
-
|
135
|
+
run_cmd_and_return_output(cmd)
|
141
136
|
# :nocov:
|
142
137
|
end
|
138
|
+
rescue CouldNotExecuteError => e
|
139
|
+
# :nocov:
|
140
|
+
warn e.message
|
141
|
+
# :nocov:
|
143
142
|
end
|
144
143
|
|
145
144
|
def make_bin_files_executable
|
146
145
|
Dir["bin/*"].each do |file|
|
147
146
|
if File.file?(file)
|
148
|
-
|
147
|
+
cmd = "chmod u+x #{file}"
|
148
|
+
begin
|
149
|
+
run_cmd_and_return_output(cmd)
|
150
|
+
rescue CouldNotExecuteError => e
|
151
|
+
# :nocov:
|
152
|
+
warn e.message
|
153
|
+
# :nocov:
|
154
|
+
end
|
149
155
|
end
|
150
156
|
end
|
151
157
|
end
|
152
158
|
|
153
159
|
def git_init
|
154
|
-
|
160
|
+
return if use_git_failed
|
155
161
|
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
end
|
162
|
+
cmd = "git init"
|
163
|
+
run_cmd_and_return_output(cmd)
|
164
|
+
rescue CouldNotExecuteError => e
|
165
|
+
# :nocov:
|
166
|
+
self.use_git_failed = true
|
167
|
+
warn e.message
|
168
|
+
# :nocov:
|
164
169
|
end
|
165
170
|
|
166
171
|
def git_add_all
|
167
|
-
|
172
|
+
return if use_git_failed
|
168
173
|
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
end
|
174
|
+
cmd = "git add ."
|
175
|
+
run_cmd_and_return_output(cmd)
|
176
|
+
rescue CouldNotExecuteError => e
|
177
|
+
# :nocov:
|
178
|
+
self.use_git_failed = true
|
179
|
+
warn e.message
|
180
|
+
# :nocov:
|
177
181
|
end
|
178
182
|
|
179
183
|
def git_commit
|
180
|
-
|
184
|
+
return if use_git_failed
|
185
|
+
|
186
|
+
cmd = "git commit -m 'Create ruby project files'"
|
187
|
+
run_cmd_and_return_output(cmd)
|
188
|
+
rescue CouldNotExecuteError => e
|
181
189
|
# :nocov:
|
182
|
-
|
183
|
-
|
184
|
-
unless exit_status.success?
|
185
|
-
raise "could not git commit -m 'Initial commit'. OUTPUT\n#{stdout.read}\nERROR:#{stderr.read}"
|
186
|
-
end
|
187
|
-
end
|
190
|
+
self.use_git_failed = true
|
191
|
+
warn e.message
|
188
192
|
# :nocov:
|
189
193
|
end
|
190
194
|
|
191
195
|
def github_create_repo
|
196
|
+
return if push_to_github_failed
|
197
|
+
|
192
198
|
puts "pushing to github..."
|
193
199
|
|
194
200
|
cmd = "gh repo create --private #{project_config.org_slash_project_kebab}"
|
195
|
-
run_cmd_and_write_output(cmd, raise_if_fails: false)
|
201
|
+
exit_status = run_cmd_and_write_output(cmd, raise_if_fails: false)
|
202
|
+
|
203
|
+
unless exit_status&.success?
|
204
|
+
self.push_to_github_failed = true
|
205
|
+
end
|
196
206
|
end
|
197
207
|
|
198
208
|
def git_add_remote_origin
|
199
|
-
|
209
|
+
return if push_to_github_failed
|
210
|
+
|
211
|
+
cmd = "git remote add origin git@github.com:#{project_config.org_slash_project_kebab}.git"
|
212
|
+
exit_status = run_cmd_and_write_output(cmd, raise_if_fails: false)
|
213
|
+
|
214
|
+
unless exit_status&.success?
|
200
215
|
# :nocov:
|
201
|
-
|
216
|
+
self.push_to_github_failed = true
|
202
217
|
# :nocov:
|
203
218
|
end
|
204
219
|
end
|
205
220
|
|
206
221
|
def git_branch_main
|
207
|
-
|
222
|
+
return if use_git_failed
|
223
|
+
|
224
|
+
cmd = "git branch -M main"
|
225
|
+
exit_status = run_cmd_and_write_output(cmd, raise_if_fails: false)
|
226
|
+
|
227
|
+
unless exit_status&.success?
|
208
228
|
# :nocov:
|
209
|
-
|
229
|
+
self.use_git_failed = true
|
210
230
|
# :nocov:
|
211
231
|
end
|
212
232
|
end
|
213
233
|
|
214
234
|
def push_to_github
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
235
|
+
return if push_to_github_failed
|
236
|
+
|
237
|
+
cmd = "git push -u origin main"
|
238
|
+
run_cmd_and_return_output(cmd)
|
239
|
+
rescue CouldNotExecuteError => e
|
240
|
+
self.push_to_github_failed = true
|
241
|
+
warn e.message
|
221
242
|
end
|
222
243
|
|
223
244
|
def rbenv_bundler_on
|
224
|
-
|
225
|
-
|
226
|
-
exit_status = wait_thr.value
|
227
|
-
unless exit_status.success?
|
228
|
-
warn "WARNING: could not rbenv bundler on \n #{stderr.read}"
|
229
|
-
end
|
230
|
-
end
|
231
|
-
# :nocov:
|
245
|
+
cmd = "rbenv bundler on"
|
246
|
+
run_cmd_and_write_output(cmd, raise_if_fails: false)
|
232
247
|
end
|
233
248
|
|
234
249
|
def output
|
data/templates/Rakefile
CHANGED
data/templates/boot/start.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foobara-empty-ruby-project-generator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miles Georgi
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-05-
|
10
|
+
date: 2025-05-08 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: extract-repo
|