foobara-command-generator 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +1 -1
- data/templates/spec/command_spec.rb.erb +16 -0
- data/templates/src/command.rb.erb +38 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d5d496c5142aa65002dbad1b4f55e9ba9435e02732a8ccf6d6f5226c220be6c
|
4
|
+
data.tar.gz: 6b0c8fe9d97ce69eb70eacbdf4f09c8290b99738768a259cd96862d867d54b52
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4875237fba09e29210bf70eb7e3c338352732eb8eee154e9582541eb23e93ad269a0443055a0fd3939689f9c072f87675cade25a474e34af03f5b5a6400bcf20
|
7
|
+
data.tar.gz: a80dbed202909e234b2a60391f39bb956c13befe83048e256c32ac2f8782352dc3338c5e5e4476e9d880789d52d2fa917f6bc0193a5dfdcd7b7cd786dd0b60ed
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -48,4 +48,4 @@ at https://github.com/[USERNAME]/foobara-command-generator.
|
|
48
48
|
## License
|
49
49
|
|
50
50
|
This project is licensed under your choice of the Apache-2.0 license or the MIT license.
|
51
|
-
See [LICENSE.txt](LICENSE
|
51
|
+
See [LICENSE.txt](LICENSE.txt) for more info about licensing.
|
@@ -0,0 +1,16 @@
|
|
1
|
+
RSpec.describe <%= full_module_name %> do
|
2
|
+
let(:command) { described_class.new(inputs) }
|
3
|
+
let(:outcome) { command.run }
|
4
|
+
let(:result) { outcome.result }
|
5
|
+
let(:errors) { outcome.errors }
|
6
|
+
let(:errors_hash) { outcome.errors_hash }
|
7
|
+
|
8
|
+
let(:inputs) do
|
9
|
+
{ foo: "bar" }
|
10
|
+
end
|
11
|
+
|
12
|
+
it "is successful" do
|
13
|
+
expect(outcome).to be_success
|
14
|
+
expect(result).to eq("bar")
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
<% module_path[..-2].each do |part| %>
|
2
|
+
module <%= part %>
|
3
|
+
<% end %>
|
4
|
+
|
5
|
+
class <%= module_path.last %> < Foobara::Command
|
6
|
+
# class SomeError < RuntimeError
|
7
|
+
# class << self
|
8
|
+
# def context_type_declaration
|
9
|
+
# { foo: :string }
|
10
|
+
# end
|
11
|
+
# end
|
12
|
+
# end
|
13
|
+
|
14
|
+
# possible_error SomeError
|
15
|
+
|
16
|
+
inputs do
|
17
|
+
foo :string, default: "bar"
|
18
|
+
end
|
19
|
+
|
20
|
+
result :string
|
21
|
+
|
22
|
+
# depends_on SomeOtherCommand
|
23
|
+
|
24
|
+
def execute
|
25
|
+
do_something
|
26
|
+
end
|
27
|
+
|
28
|
+
# def validate
|
29
|
+
# add_runtime_error SomeError.new(message: "kaboom", context: {foo: :bar})
|
30
|
+
# end
|
31
|
+
|
32
|
+
def do_something
|
33
|
+
foo
|
34
|
+
end
|
35
|
+
|
36
|
+
<% module_path.size.times do %>
|
37
|
+
end
|
38
|
+
<% end %>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foobara-command-generator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miles Georgi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: foobara
|
@@ -56,6 +56,8 @@ files:
|
|
56
56
|
- src/command_spec_generator.rb
|
57
57
|
- src/generate_command.rb
|
58
58
|
- src/write_command_to_disk.rb
|
59
|
+
- templates/spec/command_spec.rb.erb
|
60
|
+
- templates/src/command.rb.erb
|
59
61
|
homepage: https://github.com/foobara/generators-command-generator
|
60
62
|
licenses:
|
61
63
|
- Apache-2.0
|