sheldr 0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: b8dc1edf17bf535332a8fa207a7a9e7881a564589ce5294a23377fba86d685c7
4
+ data.tar.gz: 2c262463296246ae75a951d10a5f1be1bd7a751e96c85f8c188956862631e00c
5
+ SHA512:
6
+ metadata.gz: 4701f455733cc93f6fd883ecc41805f59e772a82edfc60e2f2cda5ee4336b651e0aea274a503268c3a50a9aca1bfe1c3812b79e3b3160fecea91d8b9c3dc4140
7
+ data.tar.gz: d41bfa537d068cb80e826a9ae5c83cbf1ea715091723da2d35a04ef8cf2c215159607bda6968a005b46177e29ee3e8c03b81cab477dad78fb59f82defbdaf3a3
data/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ ## [v0.1.0]
2
+
3
+ * Initial Release
@@ -0,0 +1,132 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, caste, color, religion, or sexual
10
+ identity and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the overall
26
+ community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or advances of
31
+ any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email address,
35
+ without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official email address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ [INSERT CONTACT METHOD].
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series of
86
+ actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or permanent
93
+ ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within the
113
+ community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.1, available at
119
+ [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
120
+
121
+ Community Impact Guidelines were inspired by
122
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
123
+
124
+ For answers to common questions about this code of conduct, see the FAQ at
125
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
126
+ [https://www.contributor-covenant.org/translations][translations].
127
+
128
+ [homepage]: https://www.contributor-covenant.org
129
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
130
+ [Mozilla CoC]: https://github.com/mozilla/diversity
131
+ [FAQ]: https://www.contributor-covenant.org/faq
132
+ [translations]: https://www.contributor-covenant.org/translations
data/LICENSE.txt ADDED
@@ -0,0 +1,11 @@
1
+ Copyright 2025 Flynn Sol
2
+
3
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4
+
5
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6
+
7
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8
+
9
+ 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10
+
11
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.md ADDED
@@ -0,0 +1,86 @@
1
+ <div align="center">
2
+ <img width="150" src="https://github.com/flynnsol/Sheldr/blob/main/images/logo.png" alt="Sheldr Logo"/>
3
+ </div>
4
+
5
+ ## Why Sheldr?
6
+
7
+ While searching for CLI tools to use in a Ruby project I came across TTY (teletype) and was excited about how it functioned. Unfortunately, TTY hasn't been maintained for years and no longer was able to run when I tried to use it. I also noticed that it had some potential for updating and making things more fluid for an end user, so I started working on Sheldr.
8
+
9
+ ## What does Sheldr do?
10
+
11
+ Sheldr allows you to quickly create new CLI applications while using the Sheldr CLI itself. Below you'll find more instructions on what those commands are and how to utilize them to create projects of different sizes and complexity.
12
+
13
+ ## How to use Sheldr:
14
+
15
+ > [!IMPORTANT]
16
+ > Sheldr is in a very early state of functionality with minor error management.
17
+
18
+ <br>
19
+
20
+ Install Sheldr by using:
21
+
22
+ $ gem install sheldr
23
+
24
+ Navigate to the folder that you want your project to be created in and then run:
25
+
26
+ $ sheldr new app
27
+
28
+ "app" being the name of your application. This will create a new project with a structure like so:
29
+
30
+ ```
31
+ app/
32
+ |-- exe/
33
+ | |-- app
34
+ |-- lib/
35
+ | |-- app/
36
+ | | |-- commands/
37
+ | | | |-- version.rb
38
+ | | |-- commands.rb
39
+ | | |-- version.rb
40
+ | |-- app.rb
41
+ |-- tests/
42
+ |-- .gitignore
43
+ |-- CHANGELOG.md
44
+ |-- CODE_OF_CONDUCT.md
45
+ |-- Gemfile
46
+ |-- Gemfile.lock
47
+ |-- LICENSE.txt
48
+ |-- Rakefile
49
+ |-- app.gemspec
50
+ ```
51
+
52
+ You can now run your application by navigating to app/exe and running:
53
+
54
+ $ ruby app
55
+
56
+ Which will show you the list of commands, currently only having one which you can test with:
57
+
58
+ $ ruby app version
59
+
60
+
61
+ ## Feature Functionality Tracking
62
+
63
+ - [x] "new" command working to create project
64
+ - [x] "add" command working to add commands to project
65
+ - [ ] allow arguments for "new" command
66
+ - [ ] license (do after template files are being used)
67
+ - [x] author
68
+ - [x] email
69
+ - [x] summary
70
+ - [x] description
71
+ - [x] homepage
72
+ - [x] rubyversion
73
+ - [x] allowed_push_host
74
+ - [x] sourcecode_uri
75
+ - [x] chargelog_uri
76
+ - [ ] allow arguments for "add" command
77
+ - [x] description
78
+ - [x] aliases
79
+ - [x] arguments
80
+ - [/] options
81
+ - [ ] subcommands
82
+ - [ ] subcommand arguments
83
+ - [ ] subcommand options
84
+ - [ ] subcommand examples
85
+ - [ ] examples
86
+ - [ ] switch to creating files from template files
data/Rakefile ADDED
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
data/exe/sheldr ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../lib/sheldr.rb'
data/images/logo.png ADDED
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,158 @@
1
+ class Add < Dry::CLI::Command
2
+ attr_reader :call_method, :name, :description, :aliases, :args, :options
3
+
4
+ desc "Creates a new command for your CLI Application"
5
+
6
+ argument :name, required: true, desc: "Name of the Command"
7
+ option :desc, default: "Description", desc: "Description of the Command"
8
+ option :aliases, default: "", desc: "Alises for the Command"
9
+ option :args, default: "", desc: "Arguments for the Command"
10
+ option :options, default: "", desc: "Options for the Command"
11
+ option :examples, default: "", desc: "Examples for the Command"
12
+
13
+ example [
14
+ "command # Creates a new command for the CLI Application with the name 'command'"
15
+ ]
16
+
17
+ def call(name:, **options)
18
+ @call_method = "*"
19
+ @name = name
20
+ @description = options.fetch(:desc)
21
+ # Format Aliases
22
+ alias_input = options.fetch(:aliases)
23
+ alias_final = ""
24
+ if !alias_input.nil?
25
+ alias_split = alias_input.split(", ")
26
+ for alias_name in alias_split do
27
+ alias_final = alias_final + "\"" + alias_name + "\""
28
+ alias_final = alias_final + ", "
29
+ end
30
+ alias_final = alias_final[0...-2]
31
+ end
32
+ # Set Aliases
33
+ @aliases = alias_final
34
+ # Call Method Temp
35
+ call_method_tmp = ""
36
+ # Format Arguments
37
+ args_input = options.fetch(:args)
38
+ args_final = ""
39
+ if !args_input.nil?
40
+ # Update Args and Call Method
41
+ args_split = args_input.split("]")
42
+ for arg in args_split do
43
+ clean_args = arg.delete_prefix("[")
44
+ clean_arg = clean_args.split(", ")
45
+ arg_name = nil
46
+ arg_required = nil
47
+ arg_description = nil
48
+ # Check Name
49
+ if !clean_arg[0].nil?
50
+ arg_name = clean_arg[0]
51
+ # Required
52
+ if !clean_arg[2].nil?
53
+ # if required is there set it and description
54
+ arg_required = clean_arg[1]
55
+ arg_description = clean_arg[2]
56
+ elsif clean_arg[2].nil? && !clean_arg[1].nil?
57
+ # if description is there just set description
58
+ arg_description = clean_arg[1]
59
+ end
60
+ end
61
+ if !arg_description.nil?
62
+ if !arg_required.nil?
63
+ # Required
64
+ args_final = args_final + "argument :#{arg_name}, required: #{arg_required}, desc: \"#{arg_description}\""
65
+ call_method_tmp = call_method_tmp + "#{arg_name}:"
66
+ else
67
+ # Not Required
68
+ args_final = args_final + "argument :#{arg_name}, desc: \"#{arg_description}\""
69
+ call_method_tmp = call_method_tmp + "#{arg_name}: nil"
70
+ end
71
+ end
72
+ args_final = args_final + "\n\t"
73
+ call_method_tmp = call_method_tmp + ", "
74
+ end
75
+ end
76
+ # Set Arguments
77
+ @args = args_final
78
+
79
+ # Format Options
80
+ options_input = options.fetch(:options)
81
+ options_final = ""
82
+ if !options_input.nil?
83
+ options_split = options_input.split("]")
84
+ for command_option in options_split do
85
+ clean_options = command_option.delete_prefix("[")
86
+ clean_option = clean_options.split(", ")
87
+ option_name = nil
88
+ option_default = nil
89
+ option_description = nil
90
+ if clean_option.length() == 3
91
+ option_name = clean_option[0]
92
+ option_default = clean_option[1]
93
+ option_description = clean_option[2]
94
+ options_final = options_final + "option :#{option_name}, default: \"#{option_default}\", desc: \"#{option_description}\""
95
+ options_final = options_final + "\n\t"
96
+ else
97
+ puts "Incorrect Option Format"
98
+ end
99
+ end
100
+ end
101
+
102
+ # Set Call Method
103
+ if !call_method_tmp.nil?
104
+ call_method_tmp = call_method_tmp + "**"
105
+ else
106
+ call_method_tmp = "*"
107
+ end
108
+
109
+ if !options_final.nil?
110
+ if call_method_tmp == "*"
111
+ call_method_tmp = "**options"
112
+ else
113
+ call_method_tmp = call_method_tmp + "options"
114
+ end
115
+ end
116
+
117
+ # Set Options
118
+ @options = options_final
119
+
120
+ @call_method = call_method_tmp
121
+
122
+ create_command
123
+ end
124
+
125
+ def create_command
126
+ capitalized_name = name.capitalize
127
+ current_dir = Dir.pwd
128
+ name_array = current_dir.split("/")
129
+ app_name = name_array[name_array.length() - 1]
130
+ capitalized_app_name = app_name.capitalize
131
+
132
+ # create command file
133
+ puts "Creating #{name}.rb command file."
134
+ Dir.chdir("lib")
135
+ Dir.chdir("#{app_name}")
136
+ Dir.chdir("commands")
137
+ command_file = File.new("#{name}.rb", "w")
138
+ command_file.puts("class #{capitalized_name} < Dry::CLI::Command
139
+ desc \"#{description}\"
140
+
141
+ #{args}
142
+ #{options}
143
+
144
+ def call(#{call_method})
145
+ puts \"This is the new command #{name}.\"
146
+ end
147
+ end")
148
+ Dir.chdir("..")
149
+ # register command in commands.rb
150
+ puts "Registering the new #{name} command."
151
+ commands_file = File.new("commands.rb", "a")
152
+ if aliases.nil?
153
+ commands_file.puts("#{capitalized_app_name}::CLI::Commands.register \"#{name}\", #{capitalized_name}")
154
+ else
155
+ commands_file.puts("#{capitalized_app_name}::CLI::Commands.register \"#{name}\", #{capitalized_name}, aliases: [#{aliases}]")
156
+ end
157
+ end
158
+ end
@@ -0,0 +1,404 @@
1
+ class New < Dry::CLI::Command
2
+ attr_reader :name, :author, :email, :summary, :description, :homepage, :rubyversion, :aph, :sourcecode, :changelog
3
+
4
+ desc "Creates a new CLI Application"
5
+
6
+ argument :name, required: true, desc: "Name of the Application"
7
+ option :author, default: "TODO: Author Name", desc: "Author of the Application"
8
+ option :email, default: "TODO: Email", desc: "Email for the Application"
9
+ option :summary, default: "TODO: Summary", desc: "Summary of the Application"
10
+ option :desc, default: "TODO: Description", desc: "Description of the Application"
11
+ option :homepage, default: "TODO: Homepage URI", desc: "Homepage URI of the Application"
12
+ option :rubyversion, default: ">= 3.1.0", desc: "Ruby Version of the Application"
13
+ option :aph, default: "https://rubygems.org", desc: "Allowed Push Host"
14
+ option :sourcecode, default: "TODO: Sourcecode URI", desc: "Sourcecode URI of the Application"
15
+ option :changelog, default: "TODO: Changelog URI", desc: "Changelog URI of the Application"
16
+
17
+ example [
18
+ "app # Creates a new CLI Application with the name 'app'"
19
+ ]
20
+
21
+ def call(name:, **options)
22
+ # Set Variables
23
+ @name = name
24
+ @author = options.fetch(:author)
25
+ @email = options.fetch(:email)
26
+ @summary = options.fetch(:summary)
27
+ @description = options.fetch(:desc)
28
+ @homepage = options.fetch(:homepage)
29
+ @rubyversion = options.fetch(:rubyversion)
30
+ @aph = options.fetch(:aph)
31
+ @sourcecode = options.fetch(:sourcecode)
32
+ @changelog = options.fetch(:changelog)
33
+
34
+ # Check for main Argument
35
+ create_folder_structure
36
+ end
37
+
38
+ def create_folder_structure
39
+ capitalized_name = name.capitalize
40
+ # create project folder
41
+ puts ("Creating the #{name} directory.")
42
+ system_command("mkdir #{name}")
43
+ Dir.chdir("#{name}")
44
+ # create .github/
45
+ puts ("Creating the .github directory.")
46
+ system_command("mkdir .github")
47
+ Dir.chdir(".github")
48
+ # create .github/workflows
49
+ puts ("Creating the .github/workflows directory.")
50
+ system_command("mkdir workflows")
51
+ Dir.chdir("workflows")
52
+ # create .github/workflows/main.yml
53
+ puts ("Creating the .github/workflows/main.yml file.")
54
+ main_yml = File.new("main.yml", "w")
55
+ main_yml.puts("name: Ruby
56
+
57
+ on:
58
+ push:
59
+ branches:
60
+ - master
61
+
62
+ pull_request:
63
+
64
+ jobs:
65
+ build:
66
+ runs-on: ubuntu-latest
67
+ name: Ruby ${{ matrix.ruby }}
68
+ strategy:
69
+ matrix:
70
+ ruby:
71
+ - '3.4.2'
72
+
73
+ steps:
74
+ - uses: actions/checkout@v4
75
+ - name: Set up Ruby
76
+ uses: ruby/setup-ruby@v1
77
+ with:
78
+ ruby-version: ${{ matrix.ruby }}
79
+ bundler-cache: true
80
+ - name: Run the default task
81
+ run: bundle exec rake
82
+ ")
83
+ Dir.chdir("..")
84
+ Dir.chdir("..")
85
+ # create exe/
86
+ puts ("Creating the exe directory.")
87
+ system_command("mkdir exe")
88
+ Dir.chdir("exe")
89
+ # create executible file
90
+ puts ("Creating the exe/#{name} file.")
91
+ exe_file = File.new("#{name}", "w")
92
+ exe_file.puts("#!/usr/bin/env ruby
93
+
94
+ require_relative '../lib/#{name}.rb'
95
+ ")
96
+ Dir.chdir("..")
97
+ # create lib/
98
+ puts ("Creating the lib directory.")
99
+ system_command("mkdir lib")
100
+ Dir.chdir("lib")
101
+ # create main ruby class file
102
+ puts ("Creating the lib/#{name}.rb file.")
103
+ main_ruby_file = File.new("#{name}.rb", "w")
104
+ main_ruby_file.puts("require \"bundler/setup\"
105
+ require \"dry/cli\"
106
+ require_relative \"./#{name}/commands.rb\"
107
+ require_relative \"./#{name}/version.rb\"
108
+
109
+ Dry::CLI.new(#{capitalized_name}::CLI::Commands).call")
110
+ # create project folder in lib/
111
+ puts ("Creating the lib/#{name} directory.")
112
+ system_command("mkdir #{name}")
113
+ Dir.chdir("#{name}")
114
+ # create version.rb
115
+ puts ("Creating the lib/#{name}/version.rb file.")
116
+ version_file = File.new("version.rb", "w")
117
+ version_file.puts("
118
+ module #{capitalized_name}
119
+ VERSION = \"0.1.0\"
120
+ end
121
+ ")
122
+ # create commands.rb
123
+ puts ("Creating the lib/#{name}/commands.rb file.")
124
+ commands_file = File.new("commands.rb", "w")
125
+ commands_file.puts("# Import All Commands from the Commands Directory
126
+
127
+ Dir[File.expand_path('./commands/*.rb', File.dirname(__FILE__))].each do |file|
128
+ require file
129
+ end
130
+
131
+ # Define Commands Module
132
+
133
+ module #{capitalized_name}
134
+ module CLI
135
+ module Commands
136
+ extend Dry::CLI::Registry
137
+ end
138
+ end
139
+ end
140
+
141
+ # Register Commands
142
+
143
+ #{capitalized_name}::CLI::Commands.register \"version\", Version, aliases: [\"v\", \"-v\", \"--version\"]")
144
+ # create commands/
145
+ puts ("Creating the lib/#{name}/commands directory.")
146
+ system_command("mkdir commands")
147
+ Dir.chdir("commands")
148
+ # create version command
149
+ puts ("Creating the lib/#{name}/commands/version.rb file.")
150
+ version_command_file = File.new("version.rb", "w")
151
+ version_command_file.puts("class Version < Dry::CLI::Command
152
+ desc \"Prints the current Version\"
153
+
154
+ def call(*)
155
+ puts #{capitalized_name}::VERSION
156
+ end
157
+ end")
158
+ Dir.chdir("..")
159
+ Dir.chdir("..")
160
+ Dir.chdir("..")
161
+ # create tests folder
162
+ puts ("Creating the tests directory.")
163
+ system_command("mkdir tests")
164
+ # create .gitignore
165
+ puts ("Creating the .gitignore file.")
166
+ gitignore_file = File.new(".gitignore", "w")
167
+ gitignore_file.puts("*.gem
168
+ *.rbc
169
+ /.config
170
+ /coverage/
171
+ /InstalledFiles
172
+ Gemfile.lock
173
+ /pkg
174
+ /spec/reports/
175
+ /spec/examples.txt
176
+ /test/tmp/
177
+ /test/version_tmp/
178
+ /tmp/
179
+
180
+
181
+ /.bundle/
182
+ /vendor/bundle
183
+ /lib/bundler/man/
184
+ ")
185
+ # create CHANGELOD.md
186
+ puts ("Creating the CHANGELOG.md file.")
187
+ changelog_file = File.new("CHANGELOG.md", "w")
188
+ # create CODE_OF_CONDUCT.md
189
+ puts ("Creating the CODE_OF_CONDUCT.md file.")
190
+ code_of_conduct_file = File.new("CODE_OF_CONDUCT.md", "w")
191
+ code_of_conduct_file.puts("# Contributor Covenant Code of Conduct
192
+
193
+ ## Our Pledge
194
+
195
+ We as members, contributors, and leaders pledge to make participation in our
196
+ community a harassment-free experience for everyone, regardless of age, body
197
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
198
+ identity and expression, level of experience, education, socio-economic status,
199
+ nationality, personal appearance, race, caste, color, religion, or sexual
200
+ identity and orientation.
201
+
202
+ We pledge to act and interact in ways that contribute to an open, welcoming,
203
+ diverse, inclusive, and healthy community.
204
+
205
+ ## Our Standards
206
+
207
+ Examples of behavior that contributes to a positive environment for our
208
+ community include:
209
+
210
+ * Demonstrating empathy and kindness toward other people
211
+ * Being respectful of differing opinions, viewpoints, and experiences
212
+ * Giving and gracefully accepting constructive feedback
213
+ * Accepting responsibility and apologizing to those affected by our mistakes,
214
+ and learning from the experience
215
+ * Focusing on what is best not just for us as individuals, but for the overall
216
+ community
217
+
218
+ Examples of unacceptable behavior include:
219
+
220
+ * The use of sexualized language or imagery, and sexual attention or advances of
221
+ any kind
222
+ * Trolling, insulting or derogatory comments, and personal or political attacks
223
+ * Public or private harassment
224
+ * Publishing others' private information, such as a physical or email address,
225
+ without their explicit permission
226
+ * Other conduct which could reasonably be considered inappropriate in a
227
+ professional setting
228
+
229
+ ## Enforcement Responsibilities
230
+
231
+ Community leaders are responsible for clarifying and enforcing our standards of
232
+ acceptable behavior and will take appropriate and fair corrective action in
233
+ response to any behavior that they deem inappropriate, threatening, offensive,
234
+ or harmful.
235
+
236
+ Community leaders have the right and responsibility to remove, edit, or reject
237
+ comments, commits, code, wiki edits, issues, and other contributions that are
238
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
239
+ decisions when appropriate.
240
+
241
+ ## Scope
242
+
243
+ This Code of Conduct applies within all community spaces, and also applies when
244
+ an individual is officially representing the community in public spaces.
245
+ Examples of representing our community include using an official email address,
246
+ posting via an official social media account, or acting as an appointed
247
+ representative at an online or offline event.
248
+
249
+ ## Enforcement
250
+
251
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
252
+ reported to the community leaders responsible for enforcement at
253
+ [INSERT CONTACT METHOD].
254
+ All complaints will be reviewed and investigated promptly and fairly.
255
+
256
+ All community leaders are obligated to respect the privacy and security of the
257
+ reporter of any incident.
258
+
259
+ ## Enforcement Guidelines
260
+
261
+ Community leaders will follow these Community Impact Guidelines in determining
262
+ the consequences for any action they deem in violation of this Code of Conduct:
263
+
264
+ ### 1. Correction
265
+
266
+ **Community Impact**: Use of inappropriate language or other behavior deemed
267
+ unprofessional or unwelcome in the community.
268
+
269
+ **Consequence**: A private, written warning from community leaders, providing
270
+ clarity around the nature of the violation and an explanation of why the
271
+ behavior was inappropriate. A public apology may be requested.
272
+
273
+ ### 2. Warning
274
+
275
+ **Community Impact**: A violation through a single incident or series of
276
+ actions.
277
+
278
+ **Consequence**: A warning with consequences for continued behavior. No
279
+ interaction with the people involved, including unsolicited interaction with
280
+ those enforcing the Code of Conduct, for a specified period of time. This
281
+ includes avoiding interactions in community spaces as well as external channels
282
+ like social media. Violating these terms may lead to a temporary or permanent
283
+ ban.
284
+
285
+ ### 3. Temporary Ban
286
+
287
+ **Community Impact**: A serious violation of community standards, including
288
+ sustained inappropriate behavior.
289
+
290
+ **Consequence**: A temporary ban from any sort of interaction or public
291
+ communication with the community for a specified period of time. No public or
292
+ private interaction with the people involved, including unsolicited interaction
293
+ with those enforcing the Code of Conduct, is allowed during this period.
294
+ Violating these terms may lead to a permanent ban.
295
+
296
+ ### 4. Permanent Ban
297
+
298
+ **Community Impact**: Demonstrating a pattern of violation of community
299
+ standards, including sustained inappropriate behavior, harassment of an
300
+ individual, or aggression toward or disparagement of classes of individuals.
301
+
302
+ **Consequence**: A permanent ban from any sort of public interaction within the
303
+ community.
304
+
305
+ ## Attribution
306
+
307
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
308
+ version 2.1, available at
309
+ [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
310
+
311
+ Community Impact Guidelines were inspired by
312
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
313
+
314
+ For answers to common questions about this code of conduct, see the FAQ at
315
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
316
+ [https://www.contributor-covenant.org/translations][translations].
317
+
318
+ [homepage]: https://www.contributor-covenant.org
319
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
320
+ [Mozilla CoC]: https://github.com/mozilla/diversity
321
+ [FAQ]: https://www.contributor-covenant.org/faq
322
+ [translations]: https://www.contributor-covenant.org/translations
323
+ ")
324
+ # create Gemfile
325
+ puts ("Creating the Gemfile file.")
326
+ gemfile_file = File.new("Gemfile", "w")
327
+ gemfile_file.puts("source \"https://rubygems.org\"
328
+
329
+ gem \"dry-cli\"")
330
+ # create LICENSE.txt
331
+ puts ("Creating the LICENSE.txt file.")
332
+ license_file = File.new("LICENSE.txt", "w")
333
+ license_file.puts("Copyright [Current Year] #{author}
334
+
335
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
336
+
337
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
338
+
339
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
340
+
341
+ 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
342
+
343
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.")
344
+ # create Rakefile
345
+ puts ("Creating the Rakefile file.")
346
+ rakefile_file = File.new("Rakefile", "w")
347
+ rakefile_file.puts("# frozen_string_literal: true
348
+
349
+ require \"bundler/gem_tasks\"")
350
+ # create gemspec file
351
+ puts ("Creating the #{name}.gemspec file.")
352
+ gemspec_file = File.new("#{name}.gemspec", "w")
353
+ gemspec_file.puts("# frozen_string_literal: true
354
+
355
+ require_relative \"lib/#{name}/version\"
356
+
357
+ Gem::Specification.new do |spec|
358
+ spec.name = \"#{name}\"
359
+ spec.version = #{capitalized_name}::VERSION
360
+ spec.authors = [\"#{author}\"]
361
+ spec.email = [\"#{email}\"]
362
+
363
+ spec.summary = \"#{summary}\"
364
+ spec.description = \"#{description}\"
365
+ spec.homepage = \"#{homepage}\"
366
+ spec.required_ruby_version = \"#{rubyversion}\"
367
+
368
+ spec.metadata[\"allowed_push_host\"] = \"#{aph}\"
369
+
370
+ spec.metadata[\"homepage_uri\"] = spec.homepage
371
+ spec.metadata[\"source_code_uri\"] = \"#{sourcecode}\"
372
+ spec.metadata[\"changelog_uri\"] = \"#{changelog}\"
373
+
374
+ # Specify which files should be added to the gem when it is released.
375
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
376
+ gemspec = File.basename(__FILE__)
377
+ spec.files = IO.popen(%w[git ls-files -z], chdir: __dir__, err: IO::NULL) do |ls|
378
+ ls.readlines(\"\\x0\", chomp: true).reject do |f|
379
+ (f == gemspec) ||
380
+ f.start_with?(*%w[bin/ test/ spec/ features/ .git .github appveyor Gemfile])
381
+ end
382
+ end
383
+ spec.bindir = \"exe\"
384
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
385
+ spec.require_paths = [\"lib\"]
386
+
387
+ # Uncomment to register a new dependency of your gem
388
+ # spec.add_dependency \"example-gem\", \"~> 1.0\"
389
+
390
+ # For more information and examples about making a new gem, check out our
391
+ # guide at: https://bundler.io/guides/creating_gem.html
392
+ end
393
+ ")
394
+ # bundle install to create Gemfile.lock
395
+ puts ("Bundle install command to generate Gemfile.lock file.")
396
+ system_command("bundle install")
397
+ end
398
+
399
+
400
+ # Call a system command
401
+ def system_command(syscmd)
402
+ puts `#{syscmd}`
403
+ end
404
+ end
@@ -0,0 +1,7 @@
1
+ class Version < Dry::CLI::Command
2
+ desc "Prints the current Version"
3
+
4
+ def call(*)
5
+ puts Sheldr::VERSION
6
+ end
7
+ end
@@ -0,0 +1,22 @@
1
+
2
+ # Import All Commands from the Commands Directory
3
+
4
+ Dir[File.expand_path('./commands/*.rb', File.dirname(__FILE__))].each do |file|
5
+ require file
6
+ end
7
+
8
+ # Define Commands Module
9
+
10
+ module Sheldr
11
+ module CLI
12
+ module Commands
13
+ extend Dry::CLI::Registry
14
+ end
15
+ end
16
+ end
17
+
18
+ # Register Commands
19
+
20
+ Sheldr::CLI::Commands.register "version", Version, aliases: ["v", "-v", "--version"]
21
+ Sheldr::CLI::Commands.register "new", New
22
+ Sheldr::CLI::Commands.register "add", Add
@@ -0,0 +1,4 @@
1
+
2
+ module Sheldr
3
+ VERSION = "0.1.0"
4
+ end
data/lib/sheldr.rb ADDED
@@ -0,0 +1,7 @@
1
+
2
+ require "bundler/setup"
3
+ require "dry/cli"
4
+ require_relative "./sheldr/commands.rb"
5
+ require_relative "./sheldr/version.rb"
6
+
7
+ Dry::CLI.new(Sheldr::CLI::Commands).call
metadata ADDED
@@ -0,0 +1,62 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sheldr
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Flynn
8
+ bindir: exe
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies: []
12
+ description: Sheldr is a CLI tool built in Ruby that is designed to assist in creating
13
+ CLI tools/projects.
14
+ email:
15
+ - flynn@flynnsol.com
16
+ executables:
17
+ - sheldr
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - CHANGELOG.md
22
+ - CODE_OF_CONDUCT.md
23
+ - LICENSE.txt
24
+ - README.md
25
+ - Rakefile
26
+ - exe/sheldr
27
+ - images/logo.png
28
+ - images/logoblack.png
29
+ - images/logoonlyblack.png
30
+ - images/logoonlyred.png
31
+ - images/logored.png
32
+ - lib/sheldr.rb
33
+ - lib/sheldr/commands.rb
34
+ - lib/sheldr/commands/add.rb
35
+ - lib/sheldr/commands/new.rb
36
+ - lib/sheldr/commands/version.rb
37
+ - lib/sheldr/version.rb
38
+ homepage: https://github.com/flynnsol/Sheldr
39
+ licenses: []
40
+ metadata:
41
+ allowed_push_host: https://rubygems.org
42
+ homepage_uri: https://github.com/flynnsol/Sheldr
43
+ source_code_uri: https://github.com/flynnsol/Sheldr
44
+ changelog_uri: https://github.com/flynnsol/Sheldr/blob/main/CHANGELOG.md
45
+ rdoc_options: []
46
+ require_paths:
47
+ - lib
48
+ required_ruby_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 3.1.0
53
+ required_rubygems_version: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ requirements: []
59
+ rubygems_version: 3.6.9
60
+ specification_version: 4
61
+ summary: Ruby CLI Building Tool
62
+ test_files: []