cmdlet 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.builders/_.rb +1 -0
- data/.builders/boot.rb +68 -0
- data/.builders/generators/01-bootstrap.rb +132 -0
- data/.releaserc.json +40 -0
- data/.rspec +3 -0
- data/.rubocop.yml +89 -0
- data/CHANGELOG.md +12 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +21 -0
- data/Guardfile +30 -0
- data/LICENSE.txt +21 -0
- data/README.md +82 -0
- data/Rakefile +34 -0
- data/bin/console +16 -0
- data/bin/setup +11 -0
- data/lib/cmdlet/version.rb +5 -0
- data/lib/cmdlet.rb +17 -0
- data/package-lock.json +10766 -0
- data/package.json +14 -0
- data/sig/cmdlet.rbs +4 -0
- metadata +80 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d66542098bfbb9641d3c40c9de148303dc603be24fac2c1b7bbd1c20ef76a362
|
4
|
+
data.tar.gz: bd50bf086ba1c020f30986152fe0a8fc3084391d03f86416862cf8c8713d53ed
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7a8d4b61be26278b044e61d702741c1ce9317e32ff9f731e3bf4e1beacd1e4c474607071d552ddc854bbba65817d110c38b543f4858b6a51669a7ea4578754f6
|
7
|
+
data.tar.gz: 59f3bcd0f17b54a3e4044c14656ee6ebde73e7f434fcd2b82e14ed79206c26bb8651ec6b7921bb16adc1ad88c00a0d994e8f2c5bb93da65f4289e2a17e0a4613
|
data/.builders/_.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# require_relative './path/here'
|
data/.builders/boot.rb
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
# Boot Sequence
|
2
|
+
|
3
|
+
include KLog::Logging
|
4
|
+
|
5
|
+
CONFIG_KEY = :cmdlet
|
6
|
+
|
7
|
+
log.kv 'working folder', Dir.pwd
|
8
|
+
|
9
|
+
Handlebars::Helpers.configure do |config|
|
10
|
+
config.helper_config_file = File.join(Gem.loaded_specs['handlebars-helpers'].full_gem_path, '.handlebars_helpers.json')
|
11
|
+
config.string_formatter_config_file = File.join(Gem.loaded_specs['handlebars-helpers'].full_gem_path, '.handlebars_string_formatters.json')
|
12
|
+
end
|
13
|
+
|
14
|
+
def camel
|
15
|
+
require 'handlebars/helpers/string_formatting/camel'
|
16
|
+
Handlebars::Helpers::StringFormatting::Camel.new
|
17
|
+
end
|
18
|
+
|
19
|
+
def titleize
|
20
|
+
require 'handlebars/helpers/string_formatting/titleize'
|
21
|
+
Handlebars::Helpers::StringFormatting::Titleize.new
|
22
|
+
end
|
23
|
+
|
24
|
+
def pluralize
|
25
|
+
require 'handlebars/helpers/inflection/pluralize'
|
26
|
+
Handlebars::Helpers::Inflection::Pluralize.new
|
27
|
+
end
|
28
|
+
|
29
|
+
def singularize
|
30
|
+
require 'handlebars/helpers/inflection/singularize'
|
31
|
+
Handlebars::Helpers::Inflection::Singularize.new
|
32
|
+
end
|
33
|
+
|
34
|
+
def dasherize
|
35
|
+
require 'handlebars/helpers/string_formatting/dasherize'
|
36
|
+
Handlebars::Helpers::StringFormatting::Dasherize.new
|
37
|
+
end
|
38
|
+
|
39
|
+
def k_builder
|
40
|
+
@k_builder ||= KBuilder::BaseBuilder.init(KConfig.configuration(CONFIG_KEY))
|
41
|
+
end
|
42
|
+
|
43
|
+
KConfig.configure(CONFIG_KEY) do |config|
|
44
|
+
builder_folder = Dir.pwd
|
45
|
+
base_folder = File.expand_path('../', builder_folder)
|
46
|
+
global_template = File.expand_path('~/dev/kgems/k_templates/templates')
|
47
|
+
|
48
|
+
config.template_folders.add(:global_template , global_template)
|
49
|
+
config.template_folders.add(:template , File.expand_path('.templates', Dir.pwd))
|
50
|
+
|
51
|
+
config.target_folders.add(:app , base_folder)
|
52
|
+
config.target_folders.add(:lib , :app, 'lib/funcky')
|
53
|
+
config.target_folders.add(:spec , :app, 'spec/funcky')
|
54
|
+
config.target_folders.add(:builder , builder_folder)
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
KConfig.configuration(CONFIG_KEY).debug
|
59
|
+
|
60
|
+
area = KManager.add_area(CONFIG_KEY)
|
61
|
+
resource_manager = area.resource_manager
|
62
|
+
resource_manager
|
63
|
+
.fileset
|
64
|
+
.glob('*.rb', exclude: ['boot.rb'])
|
65
|
+
.glob('generators/**/*.rb')
|
66
|
+
resource_manager.add_resources
|
67
|
+
|
68
|
+
KManager.boot
|
@@ -0,0 +1,132 @@
|
|
1
|
+
KManager.action :bootstrap do
|
2
|
+
action do
|
3
|
+
application_name = :cmdlet
|
4
|
+
|
5
|
+
# Ruby Gem Bootstrap
|
6
|
+
director = KDirector::Dsls::RubyGemDsl
|
7
|
+
.init(k_builder,
|
8
|
+
on_exist: :skip, # %i[skip write compare]
|
9
|
+
on_action: :queue # %i[queue execute]
|
10
|
+
)
|
11
|
+
.data(
|
12
|
+
ruby_version: '2.7',
|
13
|
+
application: application_name,
|
14
|
+
application_description: 'Cmdlet provides a set of functions (wrapped in the command pattern) that perform simple actions',
|
15
|
+
application_lib_path: application_name.to_s,
|
16
|
+
application_lib_namespace: 'Cmdlet',
|
17
|
+
namespaces: ['Cmdlet'],
|
18
|
+
author: 'David Cruwys',
|
19
|
+
author_email: 'david@ideasmen.com.au',
|
20
|
+
initial_semver: '0.0.1',
|
21
|
+
main_story: 'As a Developer, I want to use simple categorized functions so that I can easily add commonplace functionality to my application',
|
22
|
+
copyright_date: '2022',
|
23
|
+
website: 'http://appydave.com/gems/cmdlet'
|
24
|
+
)
|
25
|
+
.github(
|
26
|
+
active: false,
|
27
|
+
repo_name: application_name
|
28
|
+
) do
|
29
|
+
create_repository
|
30
|
+
# delete_repository
|
31
|
+
# list_repositories
|
32
|
+
open_repository
|
33
|
+
# run_command('git init')
|
34
|
+
end
|
35
|
+
.blueprint(
|
36
|
+
active: false,
|
37
|
+
name: :bin_hook,
|
38
|
+
description: 'initialize repository',
|
39
|
+
on_exist: :write) do
|
40
|
+
|
41
|
+
cd(:app)
|
42
|
+
|
43
|
+
run_template_script('bin/runonce/git-setup.sh', dom: dom)
|
44
|
+
|
45
|
+
add('.githooks/commit-msg').run_command('chmod +x .githooks/commit-msg')
|
46
|
+
add('.githooks/pre-commit').run_command('chmod +x .githooks/pre-commit')
|
47
|
+
|
48
|
+
add('.gitignore')
|
49
|
+
|
50
|
+
run_command('git config core.hooksPath .githooks') # enable sharable githooks (developer needs to turn this on before editing rep)
|
51
|
+
|
52
|
+
run_command("git add .; git commit -m 'chore: #{self.options.description.downcase}'; git push")
|
53
|
+
run_command("gh repo edit -d \"#{dom[:application_description]}\"")
|
54
|
+
end
|
55
|
+
.package_json(
|
56
|
+
active: false,
|
57
|
+
name: :package_json,
|
58
|
+
description: 'Set up the package.json file for semantic versioning'
|
59
|
+
) do
|
60
|
+
self
|
61
|
+
.add('package.json', dom: dom)
|
62
|
+
.play_actions
|
63
|
+
|
64
|
+
self
|
65
|
+
.add_script('release', 'semantic-release')
|
66
|
+
.sort
|
67
|
+
.development
|
68
|
+
.npm_add_group('semver-ruby')
|
69
|
+
|
70
|
+
run_command("git add .; git commit -m 'chore: #{self.options.description.downcase}'; git push")
|
71
|
+
end
|
72
|
+
.blueprint(
|
73
|
+
active: false,
|
74
|
+
name: :opinionated,
|
75
|
+
description: 'opinionated GEM files',
|
76
|
+
on_exist: :write) do
|
77
|
+
|
78
|
+
cd(:app)
|
79
|
+
|
80
|
+
add('bin/setup')
|
81
|
+
add('bin/console')
|
82
|
+
|
83
|
+
add("lib/#{typed_dom.application}.rb" , template_file: 'lib/applet_name.rb' , dom: dom)
|
84
|
+
add("lib/#{typed_dom.application}/version.rb" , template_file: 'lib/applet_name/version.rb' , dom: dom)
|
85
|
+
|
86
|
+
add('spec/spec_helper.rb')
|
87
|
+
add("spec/#{typed_dom.application}_spec.rb" , template_file: 'spec/applet_name_spec.rb', dom: dom)
|
88
|
+
|
89
|
+
add("#{typed_dom.application}.gemspec" , template_file: 'applet_name.gemspec', dom: dom)
|
90
|
+
add('Gemfile', dom: dom)
|
91
|
+
add('Guardfile', dom: dom)
|
92
|
+
add('Rakefile', dom: dom)
|
93
|
+
add('.rspec', dom: dom)
|
94
|
+
add('.rubocop.yml', dom: dom)
|
95
|
+
add('README.md', dom: dom)
|
96
|
+
add('CODE_OF_CONDUCT.md', dom: dom)
|
97
|
+
add('LICENSE.txt', dom: dom)
|
98
|
+
|
99
|
+
run_command("rubocop -a")
|
100
|
+
|
101
|
+
run_command("git add .; git commit -m 'chore: #{self.options.description.downcase}'; git push")
|
102
|
+
end
|
103
|
+
.blueprint(
|
104
|
+
active: true,
|
105
|
+
name: :ci_cd,
|
106
|
+
description: 'github actions (CI/CD)',
|
107
|
+
on_exist: :write) do
|
108
|
+
|
109
|
+
cd(:app)
|
110
|
+
|
111
|
+
run_command("gh secret set SLACK_WEBHOOK --body \"$SLACK_REPO_WEBHOOK\"")
|
112
|
+
run_command("gh secret set GEM_HOST_API_KEY --body \"$GEM_HOST_API_KEY\"")
|
113
|
+
|
114
|
+
add('.github/workflows/main.yml')
|
115
|
+
add('.releaserc.json')
|
116
|
+
|
117
|
+
run_command("git add .; git commit -m 'chore: #{self.options.description.downcase}'; git push")
|
118
|
+
end
|
119
|
+
|
120
|
+
director.play_actions
|
121
|
+
# director.builder.logit
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
KManager.opts.app_name = 'cmdlet'
|
126
|
+
KManager.opts.sleep = 2
|
127
|
+
KManager.opts.reboot_on_kill = 0
|
128
|
+
KManager.opts.reboot_sleep = 4
|
129
|
+
KManager.opts.exception_style = :short
|
130
|
+
KManager.opts.show.time_taken = true
|
131
|
+
KManager.opts.show.finished = true
|
132
|
+
KManager.opts.show.finished_message = 'FINISHED :)'
|
data/.releaserc.json
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
{
|
2
|
+
"branches": [
|
3
|
+
"main"
|
4
|
+
],
|
5
|
+
"plugins": [
|
6
|
+
"@semantic-release/commit-analyzer",
|
7
|
+
"@semantic-release/release-notes-generator",
|
8
|
+
[
|
9
|
+
"@semantic-release/npm",
|
10
|
+
{
|
11
|
+
"npmPublish": false
|
12
|
+
}
|
13
|
+
],
|
14
|
+
[
|
15
|
+
"@klueless-js/semantic-release-rubygem",
|
16
|
+
{
|
17
|
+
"gemPublish": true
|
18
|
+
}
|
19
|
+
],
|
20
|
+
[
|
21
|
+
"@semantic-release/changelog",
|
22
|
+
{
|
23
|
+
"changelogFile": "CHANGELOG.md",
|
24
|
+
"changelogFileTitle": "Cmdlet Changelog"
|
25
|
+
}
|
26
|
+
],
|
27
|
+
[
|
28
|
+
"@semantic-release/git",
|
29
|
+
{
|
30
|
+
"assets": [
|
31
|
+
"lib/cmdlet/version.rb",
|
32
|
+
"CHANGELOG.md"
|
33
|
+
],
|
34
|
+
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
|
35
|
+
}
|
36
|
+
],
|
37
|
+
"@semantic-release/github"
|
38
|
+
],
|
39
|
+
"repositoryUrl": "git@github.com:klueless-io/cmdlet.git"
|
40
|
+
}
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
inherit_mode:
|
2
|
+
merge:
|
3
|
+
- Exclude # see: https://stackoverflow.com/a/70818366/473923
|
4
|
+
- AllowedNames
|
5
|
+
AllCops:
|
6
|
+
TargetRubyVersion: 2.7
|
7
|
+
DisplayCopNames: true
|
8
|
+
ExtraDetails: true
|
9
|
+
NewCops: enable
|
10
|
+
Exclude:
|
11
|
+
- ".builders/**/*"
|
12
|
+
- "spec/samples/**/*"
|
13
|
+
|
14
|
+
Metrics/BlockLength:
|
15
|
+
Exclude:
|
16
|
+
- "**/spec/**/*"
|
17
|
+
- "*.gemspec"
|
18
|
+
IgnoredMethods:
|
19
|
+
- configure
|
20
|
+
- context
|
21
|
+
- define
|
22
|
+
- describe
|
23
|
+
- draw
|
24
|
+
- factory
|
25
|
+
- feature
|
26
|
+
- guard
|
27
|
+
- included
|
28
|
+
- it
|
29
|
+
- let
|
30
|
+
- let!
|
31
|
+
- scenario
|
32
|
+
- setup
|
33
|
+
- shared_context
|
34
|
+
- shared_examples
|
35
|
+
- shared_examples_for
|
36
|
+
- transaction
|
37
|
+
|
38
|
+
Metrics/MethodLength:
|
39
|
+
Max: 25
|
40
|
+
|
41
|
+
Layout/LineLength:
|
42
|
+
Max: 200
|
43
|
+
# Ignores annotate output
|
44
|
+
# IgnoredPatterns: ['\A# \*\*'] # this is renamed to AllowedPatterns and I need to come up with a template for this
|
45
|
+
IgnoreCopDirectives: true
|
46
|
+
|
47
|
+
Lint/UnusedMethodArgument:
|
48
|
+
AllowUnusedKeywordArguments: true
|
49
|
+
|
50
|
+
Style/BlockComments:
|
51
|
+
Enabled: false
|
52
|
+
Include:
|
53
|
+
- "**/spec/*"
|
54
|
+
|
55
|
+
# My Preferences - Start
|
56
|
+
Metrics/ClassLength:
|
57
|
+
Enabled: false
|
58
|
+
Metrics/ModuleLength:
|
59
|
+
Exclude:
|
60
|
+
- "**/spec/**/*"
|
61
|
+
Naming/MemoizedInstanceVariableName:
|
62
|
+
Enabled: false
|
63
|
+
Naming/VariableNumber:
|
64
|
+
Exclude:
|
65
|
+
- "**/spec/**/*"
|
66
|
+
Naming/MethodParameterName:
|
67
|
+
AllowedNames:
|
68
|
+
- as
|
69
|
+
Style/EmptyMethod:
|
70
|
+
Exclude:
|
71
|
+
- "**/spec/**/*"
|
72
|
+
Metrics/ParameterLists:
|
73
|
+
Exclude:
|
74
|
+
- "**/spec/**/*"
|
75
|
+
Layout/EmptyLineBetweenDefs:
|
76
|
+
Exclude:
|
77
|
+
- "**/spec/**/*"
|
78
|
+
|
79
|
+
Lint/AmbiguousBlockAssociation:
|
80
|
+
Exclude:
|
81
|
+
- "**/spec/**/*"
|
82
|
+
|
83
|
+
Style/AccessorGrouping:
|
84
|
+
Enabled: false
|
85
|
+
|
86
|
+
Layout/SpaceBeforeComma:
|
87
|
+
Enabled: false
|
88
|
+
# My Preferences - End
|
89
|
+
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
## [0.0.2](https://github.com/klueless-io/cmdlet/compare/v0.0.1...v0.0.2) (2022-07-08)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* base files for new GEM ([91d29b6](https://github.com/klueless-io/cmdlet/commit/91d29b6a9fdbfc168610623481a364463c6e5f06))
|
7
|
+
|
8
|
+
## [Unreleased]
|
9
|
+
|
10
|
+
## [0.1.0] - 2022-07-08
|
11
|
+
|
12
|
+
- Initial release
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
- Using welcoming and inclusive language
|
18
|
+
- Being respectful of differing viewpoints and experiences
|
19
|
+
- Gracefully accepting constructive criticism
|
20
|
+
- Focusing on what is best for the community
|
21
|
+
- Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
- The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
- Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
- Public or private harassment
|
29
|
+
- Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
- Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at david.cruwys@bugcrowd.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source 'https://rubygems.org'
|
4
|
+
|
5
|
+
gemspec
|
6
|
+
|
7
|
+
group :development, :test do
|
8
|
+
gem 'guard-bundler'
|
9
|
+
gem 'guard-rspec'
|
10
|
+
gem 'guard-rubocop'
|
11
|
+
gem 'rake'
|
12
|
+
gem 'rake-compiler', require: false
|
13
|
+
gem 'rspec', '~> 3.0'
|
14
|
+
gem 'rubocop'
|
15
|
+
gem 'rubocop-rake', require: false
|
16
|
+
gem 'rubocop-rspec', require: false
|
17
|
+
end
|
18
|
+
|
19
|
+
group :test do
|
20
|
+
gem 'simplecov', require: false
|
21
|
+
end
|
data/Guardfile
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
guard :bundler, cmd: 'bundle install' do
|
4
|
+
watch('Gemfile')
|
5
|
+
watch('.gemspec')
|
6
|
+
end
|
7
|
+
|
8
|
+
group :green_pass_then_cop, halt_on_fail: true do
|
9
|
+
guard :rspec, cmd: 'bundle exec rspec -f doc' do
|
10
|
+
require 'guard/rspec/dsl'
|
11
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
12
|
+
|
13
|
+
# RSpec files
|
14
|
+
rspec = dsl.rspec
|
15
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
16
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
17
|
+
watch(rspec.spec_files)
|
18
|
+
|
19
|
+
# Ruby files
|
20
|
+
ruby = dsl.ruby
|
21
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
22
|
+
watch(%r{^lib//(.+)\.rb$}) { |m| "spec/unit/#{m[1]}_spec.rb" }
|
23
|
+
watch(%r{^lib//commands/(.+)\.rb$}) { |m| "spec/unit/commands/#{m[1]}_spec.rb" }
|
24
|
+
end
|
25
|
+
|
26
|
+
guard :rubocop, all_on_start: false, cli: ['--format', 'clang'] do
|
27
|
+
watch(/{.+\.rb$/)
|
28
|
+
watch(%r{(?:.+/)?\.rubocop(?:_todo)?\.yml$}) { |m| File.dirname(m[0]) }
|
29
|
+
end
|
30
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2022 David Cruwys
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
# Cmdlet
|
2
|
+
|
3
|
+
> Cmdlet provides a set of functions (wrapped in the command pattern) that perform simple actions
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'cmdlet'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
```bash
|
16
|
+
bundle install
|
17
|
+
```
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
```bash
|
22
|
+
gem install cmdlet
|
23
|
+
```
|
24
|
+
|
25
|
+
## Stories
|
26
|
+
|
27
|
+
### Main Story
|
28
|
+
|
29
|
+
As a Developer, I want to use simple categorized functions so that I can easily add commonplace functionality to my application
|
30
|
+
|
31
|
+
See all [stories](./STORIES.md)
|
32
|
+
|
33
|
+
|
34
|
+
## Usage
|
35
|
+
|
36
|
+
See all [usage examples](./USAGE.md)
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
## Development
|
41
|
+
|
42
|
+
Checkout the repo
|
43
|
+
|
44
|
+
```bash
|
45
|
+
git clone https://github.com/klueless-io/cmdlet
|
46
|
+
```
|
47
|
+
|
48
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests.
|
49
|
+
|
50
|
+
You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
51
|
+
|
52
|
+
```bash
|
53
|
+
bin/console
|
54
|
+
|
55
|
+
Aaa::Bbb::Program.execute()
|
56
|
+
# => ""
|
57
|
+
```
|
58
|
+
|
59
|
+
`cmdlet` is setup with Guard, run `guard`, this will watch development file changes and run tests automatically, if successful, it will then run rubocop for style quality.
|
60
|
+
|
61
|
+
To release a new version, update the version number in `version.rb`, build the gem and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
62
|
+
|
63
|
+
```bash
|
64
|
+
rake publish
|
65
|
+
rake clean
|
66
|
+
```
|
67
|
+
|
68
|
+
## Contributing
|
69
|
+
|
70
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/klueless-io/cmdlet. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
71
|
+
|
72
|
+
## License
|
73
|
+
|
74
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
75
|
+
|
76
|
+
## Code of Conduct
|
77
|
+
|
78
|
+
Everyone interacting in the Cmdlet project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/klueless-io/cmdlet/blob/master/CODE_OF_CONDUCT.md).
|
79
|
+
|
80
|
+
## Copyright
|
81
|
+
|
82
|
+
Copyright (c) David Cruwys. See [MIT License](LICENSE.txt) for further details.
|
data/Rakefile
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# source: https://stephenagrice.medium.com/making-a-command-line-ruby-gem-write-build-and-push-aec24c6c49eb
|
4
|
+
|
5
|
+
GEM_NAME = 'cmdlet'
|
6
|
+
|
7
|
+
require 'bundler/gem_tasks'
|
8
|
+
require 'rspec/core/rake_task'
|
9
|
+
require 'cmdlet/version'
|
10
|
+
|
11
|
+
RSpec::Core::RakeTask.new(:spec)
|
12
|
+
|
13
|
+
require 'rake/extensiontask'
|
14
|
+
|
15
|
+
desc 'Compile all the extensions'
|
16
|
+
task build: :compile
|
17
|
+
|
18
|
+
Rake::ExtensionTask.new('cmdlet') do |ext|
|
19
|
+
ext.lib_dir = 'lib/cmdlet'
|
20
|
+
end
|
21
|
+
|
22
|
+
desc 'Publish the gem to RubyGems.org'
|
23
|
+
task :publish do
|
24
|
+
version = Cmdlet::VERSION
|
25
|
+
system 'gem build'
|
26
|
+
system "gem push #{GEM_NAME}-#{version}.gem"
|
27
|
+
end
|
28
|
+
|
29
|
+
desc 'Remove old *.gem files'
|
30
|
+
task :clean do
|
31
|
+
system 'rm *.gem'
|
32
|
+
end
|
33
|
+
|
34
|
+
task default: %i[clobber compile spec]
|
data/bin/console
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# frozen_string_literal: true
|
4
|
+
|
5
|
+
require 'bundler/setup'
|
6
|
+
require 'cmdlet'
|
7
|
+
|
8
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
9
|
+
# with your gem easier. You can also use a different console, if you like.
|
10
|
+
|
11
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
12
|
+
# require 'pry'
|
13
|
+
# Pry.start
|
14
|
+
|
15
|
+
require 'irb'
|
16
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/lib/cmdlet.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'cmdlet/version'
|
4
|
+
|
5
|
+
module Cmdlet
|
6
|
+
# raise Cmdlet::Error, 'Sample message'
|
7
|
+
Error = Class.new(StandardError)
|
8
|
+
|
9
|
+
# Your code goes here...
|
10
|
+
end
|
11
|
+
|
12
|
+
if ENV.fetch('KLUE_DEBUG', 'false').downcase == 'true'
|
13
|
+
namespace = 'Cmdlet::Version'
|
14
|
+
file_path = $LOADED_FEATURES.find { |f| f.include?('cmdlet/version') }
|
15
|
+
version = Cmdlet::VERSION.ljust(9)
|
16
|
+
puts "#{namespace.ljust(35)} : #{version.ljust(9)} : #{file_path}"
|
17
|
+
end
|