foobara-empty-ruby-project-generator 1.0.4 → 1.1.0

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: 69487bb9af39b07be4764e302f0a664e5d797fb12def733e9b6efffb7b16605e
4
- data.tar.gz: 5c8f7cba5c5e3ce7e972077fa83b2ebb566d58a400dd76f32f168146b1e511fe
3
+ metadata.gz: 7e4a3e6022876d316da2d1151570016cefcc0a3e264fab8914f80c98a5884702
4
+ data.tar.gz: 2dcf65b9a6c3d55816a52c02258492544168f89debb55a1839ded3935460c976
5
5
  SHA512:
6
- metadata.gz: 9e6012b705ec17908c11cbdcdb50e582d0c0b068c6300e0efc168be9d182a5d0f7eda9001b1903971d84da7983037578ca0329667b059fb98a7ffe63c137abda
7
- data.tar.gz: 19d597e04921284dddc31fb0eaeb67f207352679b127f8aeaa5f14b98ddf8c84f381af17346f55e6b30a0d8157d0fac5316bd8086d31c0ceca38e2d837eac679
6
+ metadata.gz: '08542c35392d879154eb195d4ecf98a05d950d4a52857e3d05f4835a1c89454f798a038768cb34c0088b1e483ff939b161630610e6abbc8e01d1b1cc396daec7'
7
+ data.tar.gz: ddf08ce714ecd6f0c1b42f0674c1c8890930ad06a6801d5da9691e5a4d68506ba3335d80567ac314b2d409eded691681222d3816515fa6d1882919bcdf241150
data/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ ## [1.1.0] - 2026-10-10
2
+
3
+ - Add Foobara.start! to finish.rb.erb template
4
+ - Eliminate an annoying deprecation warning
5
+ - Use current Foobara version in generated gemspec
6
+ - Set created GitHub repo's description to the --description value
7
+ - Put the correct project name in README.md.erb output
8
+
9
+ ## [1.0.5] - 2026-09-15
10
+
11
+ - Adds ./local_data to generated .gitignore
12
+ - Fixes various deprecation warnings that pop up in newly generated projects
13
+ - Defaults to branch coverage (should probably be optional!)
14
+ - Make sure all deprecation warnings are shown by default in newly generated projects
15
+
1
16
  ## [1.0.4] - 2025-08-24
2
17
 
3
18
  - Scrub cookies in vcr.rb instead of deleting them
data/README.md CHANGED
@@ -1,49 +1,84 @@
1
1
  # Foobara::EmptyRubyProjectGenerator
2
2
 
3
- TODO: Delete this and the text below, and describe your gem
3
+ Generates an empty Ruby project with RuboCop, RSpec, and GitHub Actions already wired up, so you can focus on writing your gem's code rather than setting up boilerplate code.
4
4
 
5
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library
6
- into a gem. Put your Ruby code in the file `lib/foobara/empty_ruby_project_generator`. To experiment with that code,
7
- run `bin/console` for an interactive prompt.
5
+ The generated project is ideally meant to be used with Foobara however, it can also be used for non-Foobara projects by deleting Foobara-specific parts after generation.
8
6
 
9
7
  ## Installation
10
8
 
11
- TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it
12
- to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with
13
- instructions to install your gem from git if you don't plan to release to RubyGems.org.
9
+ The `foobara-empty-ruby-project-generator` is part of the `foob` family of code generators. Installing the `foob` gem will therefore automatically bring in this generator along with all other foobara generators eliminating the need to install the `foobara-empty-ruby-project-generator` gem separately.
14
10
 
15
- Install the gem and add to the application's Gemfile by executing:
11
+ Install the gem directly in the terminal:
16
12
 
17
- $ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
13
+ `$ gem install foob`
18
14
 
19
- If bundler is not being used to manage dependencies, install the gem by executing:
15
+ Or add it to your Gemfile:
20
16
 
21
- $ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
17
+ `$ bundle add foob`
22
18
 
23
19
  ## Usage
24
20
 
25
- TODO: Write usage instructions here
21
+ Run the generator to create a new project:
26
22
 
27
- ## Development
23
+ `$ foob g ruby-project -n NAME [options]`
28
24
 
29
- ```bash
30
- bundle config --global local.foobara /path/to/foobara
31
- bundle config set disable_local_branch_check true
32
- ```
25
+ The `-n` flag represents the name of the project to be generated and is required. It accepts either a plain project name or a name in the
26
+ `org/project` format:
33
27
 
34
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can
35
- also run `bin/console` for an interactive prompt that will allow you to experiment.
28
+ - **Individual account:** `-n my-gem` — creates a project with a single
29
+ module e.g. `MyGem`
30
+ - **Organization:** `-n my-org/my-gem` — creates a project with a nested
31
+ module e.g. `MyOrg::MyGem` and uses `my-org` as the GitHub organization
36
32
 
37
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the
38
- version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version,
39
- push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
33
+ For a full list of available options run:
34
+
35
+ `$ foob g ruby-project --help`
36
+
37
+ or
38
+
39
+ `$ foob help ruby-project`
40
+
41
+ **Commonly used options:**
42
+
43
+ | Flag | Description |
44
+ |------|-------------|
45
+ | `-n, --name` | Project name or org/project (required) |
46
+ | `-d, --description` | Project description. Defaults to `"No description. Add one."` |
47
+ | `-a, --author-names` | Author name(s) |
48
+ | `--author-emails` | Author email(s) |
49
+ | `-l, --license` | One of: `MIT`, `Apache-2.0`, `MPL-2.0`, `Apache-2.0 OR MIT` |
50
+ | `-u, --use-git` | Initialize a git repository |
51
+ | `--push-to-github` | Create a private GitHub repo and push to it |
52
+ | `-o, --output-directory` | Where to generate the project. Defaults to the project name |
53
+
54
+ **Example:**
55
+
56
+ `$ foob g ruby-project -n my-org/my-gem -d "Does something useful" -l MIT --use-git`
57
+
58
+ The above generator example when run will put the project in the `my-org/my-gem` folder.
59
+
60
+ Upon running the generator, all projects will have the following structure:
61
+
62
+ - `lib/` - Contains all files that are loaded via `require` and based on the name you provided when generating the project, this folder will be structured as either `lib/my_org/my_gem.rb` for an organisation project name OR `lib/my_gem.rb` for a plain project name.
63
+
64
+ - `src/` - Contains your ruby gem code. This is a Foobara-specific convention whereby instead of putting all your code in the `lib/` folder, the actual implementation code lives in `src/` folder while the `lib/` folder is reserved for code that can be required.
65
+
66
+ If you used the `foobara-empty-ruby-project-generator` gem to generate a non-Foobara Ruby project, you can delete the `src/` folder and place all your code in the `lib/` folder as well as delete any associated Foobara-specific parts.
40
67
 
41
68
  ## Contributing
42
69
 
43
- Bug reports and pull requests are welcome on GitHub
44
- at https://github.com/[USERNAME]/foobara-empty_ruby_project_generator.
70
+ Contributions in the form of PRs and issues are always welcome.
71
+
72
+ To work on an existing issue or submit a PR:
73
+
74
+ 1. Fork the repo and clone it to your local machine
75
+ 2. Run `bundle install` to install dependencies
76
+ 3. Run `rake` to ensure that everything works as expected before making any changes.
77
+ 4. Implement your changes and add tests where applicable
78
+ 5. Re-run `rake` to make sure that all tests and rubocop pass.
79
+ 6. Commit, push to GitHub and open a PR for review
45
80
 
46
81
  ## License
47
82
 
48
- This project is licensed under your choice of the Apache-2.0 license or the MIT license.
49
- See [LICENSE.txt](LICENSE.txt) for more info about licensing.
83
+ This project is licensed under your choice of the Apache-2.0 license or
84
+ the MIT license. See [LICENSE.txt](LICENSE.txt) for more info.
@@ -12,6 +12,10 @@ module Foobara
12
12
  def target_path
13
13
  "#{kebab_case_full_project_name}.gemspec"
14
14
  end
15
+
16
+ def current_foobara_version
17
+ Gem.loaded_specs["foobara"].version
18
+ end
15
19
  end
16
20
  end
17
21
  end
@@ -27,9 +27,9 @@ module Foobara
27
27
  when "MPL-2.0"
28
28
  Mpl2LicenseGenerator
29
29
  else
30
- # :nocov:
30
+ # simplecov:disable
31
31
  raise "Unknown license string #{license_string}"
32
- # :nocov:
32
+ # simplecov:enable
33
33
  end
34
34
  end.map do |klass|
35
35
  klass.new(relevant_manifest)
@@ -54,9 +54,9 @@ module Foobara
54
54
  "This project is dual licensed under your choice of the " \
55
55
  "#{licenses.first} license and the #{licenses.last} license."
56
56
  else
57
- # :nocov:
57
+ # simplecov:disable
58
58
  raise "Not sure what to do with #{licenses.size} licenses"
59
- # :nocov:
59
+ # simplecov:enable
60
60
  end
61
61
  end
62
62
  end
@@ -24,9 +24,9 @@ module Foobara
24
24
  Generators::VersionGenerator
25
25
  ]
26
26
  else
27
- # :nocov:
27
+ # simplecov:disable
28
28
  raise "Not sure how build a generator for a #{manifest}"
29
- # :nocov:
29
+ # simplecov:enable
30
30
  end
31
31
  end
32
32
  end
@@ -38,8 +38,12 @@ module Foobara
38
38
  end
39
39
 
40
40
  def org_slash_project_kebab(organization_name = self.organization_name, project_name = self.project_name)
41
- org_part = Util.kebab_case(organization_name)&.gsub("::", "-")
42
- project_part = Util.kebab_case(project_name).gsub("::", "-")
41
+ org_part = if organization_name
42
+ Util.kebab_case(organization_name)&.gsub("::", "-")
43
+ end
44
+ project_part = if project_name
45
+ Util.kebab_case(project_name).gsub("::", "-")
46
+ end
43
47
 
44
48
  if org_part.nil? || org_part.empty?
45
49
  project_part
@@ -99,7 +103,7 @@ module Foobara
99
103
  # TODO: implement #[] or move it up to Model from Entity if it exists there.
100
104
  @author_names ||= read_attribute(:author_names) || begin
101
105
  # TODO: dump a git config file in CI so we don't have to skip this
102
- # :nocov:
106
+ # simplecov:disable
103
107
  name = `git config --get user.name`
104
108
 
105
109
  if $CHILD_STATUS.exitstatus == 0
@@ -107,13 +111,13 @@ module Foobara
107
111
  else
108
112
  raise "Must set author_names because we can't get it from git for some reason"
109
113
  end
110
- # :nocov:
114
+ # simplecov:enable
111
115
  end
112
116
  end
113
117
 
114
118
  def author_emails
115
119
  @author_emails ||= read_attribute(:author_emails) || begin
116
- # :nocov:
120
+ # simplecov:disable
117
121
  email = `git config --get user.email`
118
122
 
119
123
  if $CHILD_STATUS.exitstatus == 0
@@ -121,7 +125,7 @@ module Foobara
121
125
  else
122
126
  raise "Must set author_emails because we can't get it from git for some reason"
123
127
  end
124
- # :nocov:
128
+ # simplecov:enable
125
129
  end
126
130
  end
127
131
 
@@ -1,5 +1,6 @@
1
1
  require "fileutils"
2
2
  require "extract_repo"
3
+ require "shellwords"
3
4
  require_relative "generate_empty_ruby_project"
4
5
 
5
6
  module Foobara
@@ -115,9 +116,9 @@ module Foobara
115
116
  run_cmd_and_return_output(cmd)
116
117
  end
117
118
  else
118
- # :nocov:
119
+ # simplecov:disable
119
120
  run_cmd_and_return_output(cmd)
120
- # :nocov:
121
+ # simplecov:enable
121
122
  end
122
123
  end
123
124
 
@@ -131,14 +132,14 @@ module Foobara
131
132
  run_cmd_and_return_output(cmd)
132
133
  end
133
134
  else
134
- # :nocov:
135
+ # simplecov:disable
135
136
  run_cmd_and_return_output(cmd)
136
- # :nocov:
137
+ # simplecov:enable
137
138
  end
138
139
  rescue CouldNotExecuteError => e
139
- # :nocov:
140
+ # simplecov:disable
140
141
  warn e.message
141
- # :nocov:
142
+ # simplecov:enable
142
143
  end
143
144
 
144
145
  def make_bin_files_executable
@@ -148,9 +149,9 @@ module Foobara
148
149
  begin
149
150
  run_cmd_and_return_output(cmd)
150
151
  rescue CouldNotExecuteError => e
151
- # :nocov:
152
+ # simplecov:disable
152
153
  warn e.message
153
- # :nocov:
154
+ # simplecov:enable
154
155
  end
155
156
  end
156
157
  end
@@ -162,10 +163,10 @@ module Foobara
162
163
  cmd = "git init"
163
164
  run_cmd_and_return_output(cmd)
164
165
  rescue CouldNotExecuteError => e
165
- # :nocov:
166
+ # simplecov:disable
166
167
  self.use_git_failed = true
167
168
  warn e.message
168
- # :nocov:
169
+ # simplecov:enable
169
170
  end
170
171
 
171
172
  def git_add_all
@@ -174,10 +175,10 @@ module Foobara
174
175
  cmd = "git add ."
175
176
  run_cmd_and_return_output(cmd)
176
177
  rescue CouldNotExecuteError => e
177
- # :nocov:
178
+ # simplecov:disable
178
179
  self.use_git_failed = true
179
180
  warn e.message
180
- # :nocov:
181
+ # simplecov:enable
181
182
  end
182
183
 
183
184
  def git_commit
@@ -186,10 +187,10 @@ module Foobara
186
187
  cmd = "git commit -m 'Create ruby project files'"
187
188
  run_cmd_and_return_output(cmd)
188
189
  rescue CouldNotExecuteError => e
189
- # :nocov:
190
+ # simplecov:disable
190
191
  self.use_git_failed = true
191
192
  warn e.message
192
- # :nocov:
193
+ # simplecov:enable
193
194
  end
194
195
 
195
196
  def github_create_repo
@@ -197,7 +198,8 @@ module Foobara
197
198
 
198
199
  puts "pushing to github..."
199
200
 
200
- cmd = "gh repo create --private #{project_config.org_slash_project_kebab}"
201
+ description = Shellwords.escape(project_config.description)
202
+ cmd = "gh repo create --private #{project_config.org_slash_project_kebab} --description #{description}"
201
203
  exit_status = run_cmd_and_write_output(cmd, raise_if_fails: false)
202
204
 
203
205
  unless exit_status&.success?
@@ -212,9 +214,9 @@ module Foobara
212
214
  exit_status = run_cmd_and_write_output(cmd, raise_if_fails: false)
213
215
 
214
216
  unless exit_status&.success?
215
- # :nocov:
217
+ # simplecov:disable
216
218
  self.push_to_github_failed = true
217
- # :nocov:
219
+ # simplecov:enable
218
220
  end
219
221
  end
220
222
 
@@ -225,9 +227,9 @@ module Foobara
225
227
  exit_status = run_cmd_and_write_output(cmd, raise_if_fails: false)
226
228
 
227
229
  unless exit_status&.success?
228
- # :nocov:
230
+ # simplecov:disable
229
231
  self.use_git_failed = true
230
- # :nocov:
232
+ # simplecov:enable
231
233
  end
232
234
  end
233
235
 
@@ -13,3 +13,5 @@
13
13
  /.idea/
14
14
  /.env.*.local
15
15
  /.env.local
16
+
17
+ /local_data
@@ -3,7 +3,7 @@
3
3
  TODO: Delete this and the text below, and describe your gem
4
4
 
5
5
  Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library
6
- into a gem. Put your Ruby code in the file `lib/foobara/empty_ruby_project_generator`. To experiment with that code,
6
+ into a gem. Put your Ruby code in the file `lib/<%= org_slash_project_underscore %>.rb`. To experiment with that code,
7
7
  run `bin/console` for an interactive prompt.
8
8
 
9
9
 
@@ -1,9 +1,3 @@
1
- require "dotenv"
2
-
3
1
  require "foobara/load_dotenv"
4
2
 
5
- Dotenv.require_keys("FOOBARA_ENV")
6
-
7
- env = ENV.fetch("FOOBARA_ENV", nil)
8
-
9
- Foobara::LoadDotenv.run!(env:)
3
+ Foobara::LoadDotenv.run!(env: ENV.fetch("FOOBARA_ENV"))
@@ -9,16 +9,24 @@ last = %w[
9
9
 
10
10
  skip = ["start.rb", "finish.rb", *first, *last]
11
11
 
12
+ # simplecov:disable
12
13
  first.each { |f| require_relative f if File.exist?("#{__dir__}/#{f}") }
14
+ # simplecov:enable
13
15
 
14
16
  require "<%= project_lib_file_path %>"
15
17
 
16
18
  Dir.entries(__dir__).each do |boot_file|
17
19
  next unless boot_file.end_with?(".rb")
18
20
  next if skip.include?(boot_file)
21
+ # simplecov:disable
19
22
  next unless File.exist?("#{__dir__}/#{boot_file}")
23
+ # simplecov:enable
20
24
 
21
25
  require_relative boot_file
22
26
  end
23
27
 
28
+ # simplecov:disable
24
29
  last.each { |f| require_relative f if File.exist?("#{__dir__}/#{f}") }
30
+ # simplecov:enable
31
+
32
+ Foobara.start!
@@ -3,8 +3,18 @@ ENV["FOOBARA_ENV"] ||= "development"
3
3
  require "bundler/setup"
4
4
 
5
5
  if ["development", "test"].include?(ENV["FOOBARA_ENV"])
6
- require "pry"
7
- require "pry-byebug"
6
+ # simplecov:disable
7
+ if ENV["CI"] != "true"
8
+ if ENV["RUBY_DEBUG"] == "true"
9
+ require "debug"
10
+ elsif ENV["USE_PRY"] == "true"
11
+ require "pry"
12
+ elsif ENV["USE_PRY_BYEBUG"] == "true"
13
+ require "pry"
14
+ require "pry-byebug"
15
+ end
16
+ end
17
+ # simplecov:enable
8
18
  end
9
19
 
10
20
  require_relative "config"
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
23
23
  "CHANGELOG.md"
24
24
  ]
25
25
 
26
- spec.add_dependency "foobara", ">= 0.0.136", "< 2.0.0"
26
+ spec.add_dependency "foobara", ">= <%= current_foobara_version %>", "< 2.0.0"
27
27
 
28
28
  spec.require_paths = ["lib"]
29
29
  spec.metadata["rubygems_mfa_required"] = "true"
@@ -6,6 +6,8 @@ require "pry"
6
6
  require "pry-byebug"
7
7
  require "rspec/its"
8
8
 
9
+ Warning[:deprecated] = true
10
+
9
11
  require_relative "support/simplecov"
10
12
  require_relative "../boot/start"
11
13
 
@@ -1,9 +1,8 @@
1
1
  require "simplecov"
2
2
 
3
3
  SimpleCov.start do
4
- add_filter "spec/support"
5
- # enable_coverage :branch
6
- minimum_coverage line: 100
7
- # TODO: enable this? worth it to get to 100% branch coverage?
8
- # minimum_coverage line: 100, branch: 100
4
+ skip "spec/support"
5
+
6
+ enable_coverage :branch
7
+ minimum_coverage line: 100, branch: 100
9
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foobara-empty-ruby-project-generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Georgi
@@ -29,7 +29,7 @@ dependencies:
29
29
  requirements:
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 0.1.1
32
+ version: 0.7.3
33
33
  - - "<"
34
34
  - !ruby/object:Gem::Version
35
35
  version: 2.0.0
@@ -39,7 +39,7 @@ dependencies:
39
39
  requirements:
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
- version: 0.1.1
42
+ version: 0.7.3
43
43
  - - "<"
44
44
  - !ruby/object:Gem::Version
45
45
  version: 2.0.0
@@ -47,6 +47,9 @@ dependencies:
47
47
  name: foobara-files-generator
48
48
  requirement: !ruby/object:Gem::Requirement
49
49
  requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 0.2.4
50
53
  - - "<"
51
54
  - !ruby/object:Gem::Version
52
55
  version: 2.0.0
@@ -54,6 +57,9 @@ dependencies:
54
57
  prerelease: false
55
58
  version_requirements: !ruby/object:Gem::Requirement
56
59
  requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: 0.2.4
57
63
  - - "<"
58
64
  - !ruby/object:Gem::Version
59
65
  version: 2.0.0
@@ -143,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
143
149
  - !ruby/object:Gem::Version
144
150
  version: '0'
145
151
  requirements: []
146
- rubygems_version: 3.6.9
152
+ rubygems_version: 4.0.20
147
153
  specification_version: 4
148
154
  summary: Generates empty ruby project boilerplate code from a template
149
155
  test_files: []