foobara-empty-typescript-react-project-generator 0.0.4 → 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: 7d2de82e547950b5f6874b942d5e53ed8c5ea7a7ae23dac3939f9ff6d4c30e9f
4
- data.tar.gz: a790d1445df69542e132d3004cfc237287847e9a278934ec1da62ef8b0b8fe3f
3
+ metadata.gz: 7b5d5ec6f514295d2155107d01eb5ff63c2b993d8037a6f4681f290646752a54
4
+ data.tar.gz: da3ec2c7d6b2a90b827d5465bb6a728c1dad9da4da313327a749ad1552d2b249
5
5
  SHA512:
6
- metadata.gz: '085b1c412cbc858788160b949916a2d9fc73d15153baa81c20c5bebc155a23306835fb75985ff63d91f466c4b5172d6ff2d9428906858fe1147b85f16c4fa38f'
7
- data.tar.gz: 4c16639faf6219c17b2527f7039e4253af2f2286924cb5bbac15cac36186cc9780cf9fecb15026d81fab64972d6e756a38dfe94eed1ede24893ee8022b13f416
6
+ metadata.gz: 9b04a9eb5e19adc780619a7e812413640f29f7d137370033e41ec05ccc33e8004914632ecba90a8834a3cd57f2e49c1cb2b965b9911053312ef47a789c6d5719
7
+ data.tar.gz: 150141adf7a6013bb6e6b3ba775d102dafe187f651b74ced52fe87933077de3be9cd9b13676c177e32a0c358d36959de0b3fd3a80e065e8dbf544faec12f82e7
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## [0.0.6] - 2025-05-03
2
+
3
+ - Make pushing to github off by default and make failures not stop the generator
4
+
5
+ ## [0.0.5] - 2025-05-03
6
+
7
+ - Create github repositories as private instead of public
8
+
1
9
  ## [0.0.4] - 2025-01-07
2
10
 
3
11
  - Fix bug caused by uncorrectable lint violation in generated project
@@ -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
156
- cmd = "gh repo create --public --push --source=. #{git_repo_path}"
169
+ return if push_to_github_failed?
170
+
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,42 +1,42 @@
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.4
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-01-07 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
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
- - - ">="
16
+ - - "~>"
17
17
  - !ruby/object:Gem::Version
18
- version: '0'
18
+ version: 0.0.116
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
- - - ">="
23
+ - - "~>"
24
24
  - !ruby/object:Gem::Version
25
- version: '0'
25
+ version: 0.0.116
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: foobara-files-generator
28
28
  requirement: !ruby/object:Gem::Requirement
29
29
  requirements:
30
- - - ">="
30
+ - - "~>"
31
31
  - !ruby/object:Gem::Version
32
- version: '0'
32
+ version: 0.0.1
33
33
  type: :runtime
34
34
  prerelease: false
35
35
  version_requirements: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - ">="
37
+ - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '0'
39
+ version: 0.0.1
40
40
  email:
41
41
  - azimux@gmail.com
42
42
  executables: []