foobara-empty-typescript-react-project-generator 0.0.5 → 0.0.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c5940c4aa607a20e7805e0831aab864ce43d8d642b9802ddf580b43685f26eee
4
- data.tar.gz: ec421e1f68e9b2ddb7facbb88c34f174671d6f68ef8a2ac7b03b8ae66127b174
3
+ metadata.gz: 7b5d5ec6f514295d2155107d01eb5ff63c2b993d8037a6f4681f290646752a54
4
+ data.tar.gz: da3ec2c7d6b2a90b827d5465bb6a728c1dad9da4da313327a749ad1552d2b249
5
5
  SHA512:
6
- metadata.gz: ce1889fdc2e9599251be17054ef9fcb034ea263dfa52f55d05aa9e5676a7e3dea539d565fdfbdbaab94f4934fa229530e75bc50e14f86aa4b380b033df1b63b0
7
- data.tar.gz: dc4dc2e84ca927f290eb34102f0fb036213dd98d25303a7fb9d41abfd5f3e72fe55a86ddd7fd6f328deec129f26fcec01a4578ef4b64a0fd5d643c1a941f6c6e
6
+ metadata.gz: 9b04a9eb5e19adc780619a7e812413640f29f7d137370033e41ec05ccc33e8004914632ecba90a8834a3cd57f2e49c1cb2b965b9911053312ef47a789c6d5719
7
+ data.tar.gz: 150141adf7a6013bb6e6b3ba775d102dafe187f651b74ced52fe87933077de3be9cd9b13676c177e32a0c358d36959de0b3fd3a80e065e8dbf544faec12f82e7
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [0.0.6] - 2025-05-03
2
+
3
+ - Make pushing to github off by default and make failures not stop the generator
4
+
1
5
  ## [0.0.5] - 2025-05-03
2
6
 
3
7
  - Create github repositories as private instead of public
@@ -7,6 +7,7 @@ module Foobara
7
7
  attributes do
8
8
  project_dir :string, :required
9
9
  github_organization :string
10
+ push_to_github :boolean, default: false
10
11
  end
11
12
  end
12
13
  end
@@ -44,6 +44,10 @@ module Foobara
44
44
  Pathname.new(path).realpath.to_s
45
45
  end
46
46
 
47
+ def push_to_github?
48
+ empty_typescript_react_project_config.push_to_github
49
+ end
50
+
47
51
  def generate_file_contents
48
52
  self.paths_to_source_code = run_subcommand!(GenerateEmptyTypescriptReactProject,
49
53
  empty_typescript_react_project_config.attributes)
@@ -91,10 +95,13 @@ module Foobara
91
95
  eslint_fix
92
96
  git_add_all
93
97
  git_commit_generated_files
94
- gh_repo_create
95
- git_add_remote_origin
96
98
  git_branch_main
97
- push_to_github
99
+
100
+ if push_to_github?
101
+ gh_repo_create
102
+ git_add_remote_origin
103
+ push_to_github
104
+ end
98
105
  end
99
106
 
100
107
  def fix_uncorrectable_lint_violations
@@ -152,15 +159,29 @@ module Foobara
152
159
  "#{org}/#{empty_typescript_react_project_config.project_dir}"
153
160
  end
154
161
 
162
+ attr_accessor :push_to_github_failed
163
+
164
+ def push_to_github_failed?
165
+ push_to_github_failed
166
+ end
167
+
155
168
  def gh_repo_create
169
+ return if push_to_github_failed?
170
+
156
171
  cmd = "gh repo create --private --push --source=. #{git_repo_path}"
157
172
 
158
173
  Dir.chdir project_directory do
159
- run_cmd_and_write_output(cmd, raise_if_fails: false)
174
+ exit_status = run_cmd_and_write_output(cmd, raise_if_fails: false)
175
+
176
+ unless exit_status&.success?
177
+ self.push_to_github_failed = true
178
+ end
160
179
  end
161
180
  end
162
181
 
163
182
  def git_add_remote_origin
183
+ return if push_to_github_failed?
184
+
164
185
  git_remote_cmd = "git remote"
165
186
  git_remote_add_cmd = "git remote add origin git@github.com:#{git_repo_path}.git"
166
187
 
@@ -168,9 +189,20 @@ module Foobara
168
189
  remotes = run_cmd_and_return_output(git_remote_cmd)
169
190
 
170
191
  if remotes !~ /^origin$/
171
- run_cmd_and_write_output(git_remote_add_cmd)
192
+ exit_status = run_cmd_and_write_output(git_remote_add_cmd)
193
+
194
+ unless exit_status&.success?
195
+ # :nocov:
196
+ self.push_to_github_failed = true
197
+ # :nocov:
198
+ end
172
199
  end
173
200
  end
201
+ rescue CouldNotExecuteError => e
202
+ # :nocov:
203
+ self.push_to_github_failed = true
204
+ warn e.message
205
+ # :nocov:
174
206
  end
175
207
 
176
208
  def git_branch_main
@@ -185,7 +217,11 @@ module Foobara
185
217
  cmd = "git push -u origin main"
186
218
 
187
219
  Dir.chdir project_directory do
188
- run_cmd_and_write_output(cmd, raise_if_fails: false)
220
+ exit_status = run_cmd_and_write_output(cmd, raise_if_fails: false)
221
+
222
+ unless exit_status&.success?
223
+ self.push_to_github_failed = true
224
+ end
189
225
  end
190
226
  end
191
227
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foobara-empty-typescript-react-project-generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Georgi
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-05-03 00:00:00.000000000 Z
10
+ date: 2025-05-04 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: foobara