bundlegem 1.2.0 → 1.2.1

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: 4d9582c9d97b6654a46d274e6d463dd81b9a6b61418b0930f01ac4174ec87848
4
- data.tar.gz: f1f2f668bed8f34a4e1fcb019ad928a6c6b80dee1b7f03c1591f4c2213268efb
3
+ metadata.gz: 75ed9eaea5c4e2c9cba58d155ec1323b3756d38f8d2d0c67382d8113f7868183
4
+ data.tar.gz: 4b7641e480e6817f9a376fdbc18115276444fec3cd67ed754cf1c1486b9ebc55
5
5
  SHA512:
6
- metadata.gz: 25afe26124dd631077f2d897bf7a537df2a337297ae5ac3efcf37cbe3c54783762e4d301262a4d4e5a9303e53440410b2bf0a6a8046d467947fea10331cd17b1
7
- data.tar.gz: c62f5d22ea1fb68338339d131c9609ba400ca65df3a239f9fc7af21f8c639110333789c632693bcc99952e06fc03a68e9000c175b09bc6ed5d4edaf1f18105b4
6
+ metadata.gz: 907e4dc05d6d5933420125dcc6336669052cbc45bf0b64fc0509f4f6798b9b800b39c81498c46baf898b26da3ce041368b9aee7bfe729f40889555ed1e65e2e0
7
+ data.tar.gz: d298e506be31ce5122a0b9d737fe35655d9e91f53babb689080236cfea28571a9b6a6833c66aac2d270673410f9c61fed50f6a0ee0c2c3a8361a18df04403e32
data/README.md CHANGED
@@ -59,36 +59,49 @@ git config --global user.name YOUR_GH_NAME
59
59
  git config --global user.repo-domain github.com
60
60
  ```
61
61
 
62
- #### Create Your Own Template
62
+ ## Create Your Own Template
63
63
 
64
- You can create a new template for a project class you expect to use more than once:
64
+ ###### Overview
65
+ - Define the project in a repo as you normally would
66
+ - Commit the project once it's building/ testing the way you'd like
67
+ - Add a `bundlegem.yml` file to the template to make it available for use
68
+ - Run `bundlegem --to-template` which adds a `.tt` suffix to the files
69
+ - Add any template variables to the project. See: `bundlegem --cheat-sheet`
70
+ - Use the template to kick off a new project, `bundlegem -t my-template first-test`
71
+
72
+ To create your own template, just create a new project using the technologies you'd like. Place this project in `~/.bundlegem/templates/my-template`. Once it's done, it's a good idea to create a git commit. Then run something to the effect...
65
73
 
66
74
  ```
67
- $ bundlegem --newtemplate
68
- Specify a name for your gem template: my_service
69
- Specify description:
70
- Specify template tag name [MISC]:
71
- Cloning base project structure into ~/.bundlegem/templates/my_service
72
- ...
73
- Complete!
74
- ```
75
+ $ echo "category: frontend" > bundlegem.yml
76
+ $ echo "purpose: frontend" >> bundlegem.yml
77
+ $ echo "language: javascript" >> bundlegem.yml
75
78
 
76
- You can now get to work making changes to the my_service gem. All you need to know is that any file that ends in .tt in that folder will be copied into new projects when you create a new project based on that template, however the .tt extension will obviously be stripped out of the resulting file name.
79
+ $ bundlegem --to-template
80
+ ```
77
81
 
78
- ### Categorizing Your Template
82
+ Change the bundlegem.yml contents to what makes sense for your template. The `--to-template` command will add a `.tt` to the end of all the files in the project. To keep you and I safe, it will only run if there is a `bundlegem.yml` file in the current directory.
79
83
 
80
- Also, you can specify the `category` of the gem by editing the bundlegem.yml file in each template's root. Categories are just used for organizing the output when you run `bundlegem --list`. Here, I'll show you an example:
84
+ #### Categorizing Your Template
81
85
 
86
+ You can specify the `category` of the gem by editing the `bundlegem.yml` file in each template's root. Categories are just used for organizing the output when you run `bundlegem --list`. Here's an [example](https://github.com/TheNotary/template-html-css-js/blob/main/bundlegem.yml).
82
87
 
83
- ### Customizing Your Own Templates
88
+ #### Customizing Your Own Templates
84
89
 
85
90
  Place your own templates in `~/.bunglegem/templates`. You can populate it with examples by running `bundlegem --install-public-templates` which will effectively clone down a few sample git repos into the templates folder for you such as [Go-cli](https://github.com/TheNotary/template-go-cli) for instance.
86
91
 
87
- You'll get a good idea as to the possibilities by inspecting the files in [templates](https://github.com/TheNotary/bundlegem/tree/master/lib/bundlegem/templates/cli_gem). Check out the [reference](/spec/data/variable_manifest_test.rb) test file to see what kind of interpolations are possible.
92
+ You'll get a good idea as to the possibilities by inspecting the various templates I've opensourced under my github org, e.g. [template-ruby-cli-gem](https://github.com/TheNotary/template-ruby-cli-gem).
93
+
94
+ To pull up a list of available variables, run this command
95
+
96
+ ```
97
+ $ bundlegem --cheat-sheet
98
+ ```
99
+
100
+ If you would find additional variables handy, set me up with a PR and assuming it seems widely helpful, I'll merge it right as soon as I can. The implementation for the variables is largely found in [gem.rb](https://github.com/TheNotary/bundlegem/blob/main/lib/bundlegem/cli/gem.rb#L59).
88
101
 
89
- Quick Tips:
102
+ #### Quick Tips Regarding Project Templates
90
103
 
91
104
  - Files ending with a `.tt` extension will by written to new projects
105
+ - Running `bundlegem --cheat-sheet` will list off available template variables
92
106
  - File **names** containing `#{name}` will have that symbol replaced by the project name defined on the CLI
93
- - Within files, use `<%=config[:namespaced_path]%>` to have that reinterpreted as just the file name with underscores
94
- - Have a look [under the hood](https://github.com/TheNotary/bundlegem/blob/master/lib/bundlegem/cli/gem.rb#L30-L43) to see other options and the context where the ERB.new takes place.
107
+ - Example: within a `.tt` file, use `<%=config[:namespaced_path]%>` to have that reinterpreted as just the file name with underscores
data/bin/bundlegem CHANGED
@@ -20,6 +20,11 @@ parser = OptionParser.new do |opts|
20
20
  exit
21
21
  end
22
22
 
23
+ opts.on("-c", "--cheat-sheet", "Show list of variables available in templates") do
24
+ puts Bundlegem.cheat_sheet
25
+ exit
26
+ end
27
+
23
28
  opts.on("-v", "--version", "Show version") do
24
29
  puts Bundlegem.version
25
30
  exit
@@ -35,7 +40,7 @@ parser = OptionParser.new do |opts|
35
40
  exit
36
41
  end
37
42
 
38
- opts.on("--help", "Show help") do
43
+ opts.on(nil, "--help", "Show help") do
39
44
  puts opts
40
45
  puts Bundlegem::HELP_MSG
41
46
  exit
@@ -45,7 +50,7 @@ end
45
50
  parser.parse!
46
51
 
47
52
  if ARGV.empty?
48
- puts "Error: you need to specify a name for the project being created\n\n"
53
+ puts parser
49
54
  puts Bundlegem::HELP_MSG
50
55
  exit 1
51
56
  end
@@ -0,0 +1,14 @@
1
+
2
+
3
+ module Bundlegem::CLI
4
+ module CheatSheet
5
+ class << self
6
+
7
+ def go
8
+ gem_root = File.expand_path("../../../..", __FILE__)
9
+ File.read("#{gem_root}/spec/data/variable_manifest_test.rb").lines[3..-1].join
10
+ end
11
+
12
+ end
13
+ end
14
+ end
@@ -1 +1,2 @@
1
1
  require 'bundlegem/cli/dir_to_template'
2
+ require 'bundlegem/cli/cheat_sheet'
@@ -52,6 +52,8 @@ module Bundlegem::CLI
52
52
  # git_repo_url = https://provider.com/user/name
53
53
  git_repo_url = "https://#{git_repo_domain}/#{git_user_name}/#{name}"
54
54
 
55
+ image_path = "#{git_user_name}/#{name}".downcase
56
+
55
57
  config = {
56
58
  :name => name,
57
59
  :title => title,
@@ -70,6 +72,7 @@ module Bundlegem::CLI
70
72
  :git_repo_domain => git_repo_domain,
71
73
  :git_repo_url => git_repo_url,
72
74
  :git_repo_path => git_repo_path,
75
+ :image_path => image_path,
73
76
  :template => @options[:template],
74
77
  :test => @options[:test],
75
78
  :ext => @options[:ext],
@@ -18,3 +18,4 @@ config[:email]: <%= config[:email] %>
18
18
  config[:git_repo_domain]: <%= config[:git_repo_domain] %>
19
19
  config[:git_repo_url]: <%= config[:git_repo_url] %>
20
20
  config[:git_repo_path]: <%= config[:git_repo_path] %>
21
+ config[:image_path]: <%= config[:image_path] %>
@@ -1,3 +1,3 @@
1
1
  module Bundlegem
2
- VERSION = "1.2.0"
2
+ VERSION = "1.2.1"
3
3
  end
data/lib/bundlegem.rb CHANGED
@@ -17,6 +17,10 @@ module Bundlegem
17
17
  Bundlegem::VERSION
18
18
  end
19
19
 
20
+ def cheat_sheet
21
+ CLI::CheatSheet.go
22
+ end
23
+
20
24
  # lists available templates
21
25
  def list
22
26
  configurator = Configurator.new
@@ -14,6 +14,14 @@ describe Bundlegem do
14
14
  expect(Bundlegem::VERSION).not_to be nil
15
15
  end
16
16
 
17
+ it 'has a cheat sheet it will share' do
18
+ output = Bundlegem.cheat_sheet
19
+
20
+ expect(output).to include("config[:name]: good-dog")
21
+ expect(output).to include("config[:screamcase_name]: GOOD_DOG")
22
+ expect(output).to include("config[:image_path]: test/good-dog")
23
+ end
24
+
17
25
  # List
18
26
 
19
27
  it 'gives the user a helpful output when there are no templates installed' do
@@ -18,3 +18,4 @@ config[:email]: you@example.com
18
18
  config[:git_repo_domain]: github.com
19
19
  config[:git_repo_url]: https://github.com/Test/good-dog
20
20
  config[:git_repo_path]: github.com/test/good-dog
21
+ config[:image_path]: test/good-dog
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bundlegem
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - TheNotary
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-08-11 00:00:00.000000000 Z
10
+ date: 2025-10-30 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: bundler
@@ -85,6 +85,7 @@ files:
85
85
  - changelog
86
86
  - config/config
87
87
  - lib/bundlegem.rb
88
+ - lib/bundlegem/cli/cheat_sheet.rb
88
89
  - lib/bundlegem/cli/cli.rb
89
90
  - lib/bundlegem/cli/dir_to_template.rb
90
91
  - lib/bundlegem/cli/gem.rb
@@ -116,9 +117,9 @@ licenses:
116
117
  - MIT
117
118
  metadata:
118
119
  bug_tracker_uri: https://github.com/TheNotary/bundlegem/issues
119
- changelog_uri: https://github.com/TheNotary/bundlegem/releases/tag/v1.2.0
120
- documentation_uri: https://api.rubyonrails.org/v1.2.0/
121
- source_code_uri: https://github.com/TheNotary/bundlegem/tree/v1.2.0
120
+ changelog_uri: https://github.com/TheNotary/bundlegem/releases/tag/v1.2.1
121
+ documentation_uri: https://api.rubyonrails.org/v1.2.1/
122
+ source_code_uri: https://github.com/TheNotary/bundlegem/tree/v1.2.1
122
123
  rdoc_options: []
123
124
  require_paths:
124
125
  - lib