foob 0.0.3 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/bin/foob +1 -2
- data/src/action_parser.rb +3 -1
- data/src/commands/help.rb +1 -1
- data/src/commands/version.rb +23 -0
- data/src/foob.rb +9 -2
- data/src/globalish_parser.rb +16 -0
- data/src/request.rb +4 -0
- data/version.rb +5 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c364e020bfc8623fb49e13a6453921fdcc49ecb47b4ca36a9315fc5dbc0b5831
|
4
|
+
data.tar.gz: 2f7abc80db71e15feb5164a846f24ac0fefa72ee6adfea42893118f38eeb9a6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6f5683b9671cb3acf34b757f5286763ea397d794fb6bf468a97ab10479ef0d4cf5fd903950a7206ad3b4f32b1af4b8448bc05a39d51fce0b773d1d0a9b42c78
|
7
|
+
data.tar.gz: e3dbdef91f3ba1d17526471bb80fa51250eb9d7d3e697098ee95346a78a0fcc4bba62eda2121957108eb5d6408f5f8ced4b37ae506913143314958de497640f1
|
data/CHANGELOG.md
CHANGED
data/bin/foob
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
# TODO: maybe just check for presence of ./Gemfile??
|
4
3
|
if File.exist?("../Gemfile")
|
5
|
-
|
4
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
|
6
5
|
end
|
7
6
|
|
8
7
|
require "bundler/setup"
|
data/src/action_parser.rb
CHANGED
@@ -4,11 +4,13 @@ module Foobara
|
|
4
4
|
class ActionParser < ShCliConnector::ActionParser
|
5
5
|
def supported_actions
|
6
6
|
# TODO: implement a shortcut feature for this stuff
|
7
|
-
[*super, "generate", "console"]
|
7
|
+
[*super, "generate", "console", "version"]
|
8
8
|
end
|
9
9
|
|
10
10
|
def normalize_action(action)
|
11
11
|
case action
|
12
|
+
when "v"
|
13
|
+
"version"
|
12
14
|
when "c"
|
13
15
|
# :nocov:
|
14
16
|
"console"
|
data/src/commands/help.rb
CHANGED
@@ -0,0 +1,23 @@
|
|
1
|
+
require_relative "../../version"
|
2
|
+
|
3
|
+
module Foobara
|
4
|
+
module CommandConnectors
|
5
|
+
class Foob < ShCliConnector
|
6
|
+
module Commands
|
7
|
+
class Version < Foobara::Command
|
8
|
+
def execute
|
9
|
+
set_version
|
10
|
+
|
11
|
+
version
|
12
|
+
end
|
13
|
+
|
14
|
+
attr_accessor :version
|
15
|
+
|
16
|
+
def set_version
|
17
|
+
self.version = Foobara::Foob::VERSION
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/src/foob.rb
CHANGED
@@ -41,6 +41,9 @@ module Foobara
|
|
41
41
|
transformed_command_class = nil
|
42
42
|
|
43
43
|
case action
|
44
|
+
when "version"
|
45
|
+
transformed_command_class = Commands::Version
|
46
|
+
request.command_class = transformed_command_class
|
44
47
|
when "generate"
|
45
48
|
generator_key = request.argument
|
46
49
|
|
@@ -69,8 +72,12 @@ module Foobara
|
|
69
72
|
when "console"
|
70
73
|
# Not going to bother creating a command for this one
|
71
74
|
# :nocov:
|
72
|
-
|
73
|
-
|
75
|
+
run_console = -> { exec({ "IRB_PROMPT_PREFIX" => "foob" }, "./bin/console") }
|
76
|
+
|
77
|
+
if Bundler.respond_to?(:with_unbundled_env)
|
78
|
+
Bundler.with_unbundled_env(&run_console)
|
79
|
+
else
|
80
|
+
run_console.call
|
74
81
|
end
|
75
82
|
# :nocov:
|
76
83
|
else
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Foobara
|
2
|
+
module CommandConnectors
|
3
|
+
class Foob < ShCliConnector
|
4
|
+
class GlobalishParser < ShCliConnector::GlobalishParser
|
5
|
+
def setup_parser
|
6
|
+
super
|
7
|
+
|
8
|
+
# TODO: just move this to ShCliConnector::GlobalishParser?
|
9
|
+
parser.on("-v", "--version", "Show version information") do
|
10
|
+
result.parsed[:action] = "version"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/src/request.rb
CHANGED
data/version.rb
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foob
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
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-06-
|
11
|
+
date: 2024-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: foobara
|
@@ -279,8 +279,11 @@ files:
|
|
279
279
|
- lib/foobara/foob.rb
|
280
280
|
- src/action_parser.rb
|
281
281
|
- src/commands/help.rb
|
282
|
+
- src/commands/version.rb
|
282
283
|
- src/foob.rb
|
284
|
+
- src/globalish_parser.rb
|
283
285
|
- src/request.rb
|
286
|
+
- version.rb
|
284
287
|
homepage: https://github.com/foobara/foob
|
285
288
|
licenses:
|
286
289
|
- Apache-2.0
|