foob 0.0.3 → 0.0.4
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
- 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: bcc56eb0bd3a01ac7e3bbd7ec6b7438b8788451d3e4df53f13559a2f55cd923b
|
4
|
+
data.tar.gz: c52ff726a1d78ac0e0574e812240eeb847ad6dc1e5aa0810c0a250988ea789df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6af7bc051e063fd8f8e3b7e0ca6de53dc2593407e967a0a27bc0d753b118489f00c89cb018aee8563b9881e7dcb6ef3d6afaf48bdb446f7c3ed904ce17338d4
|
7
|
+
data.tar.gz: 207982825f084b416308af29ef7c10fa4d2f3cf38abc0a6d642fee5df93594c5de6b224ef03347057aa073f276f8f6f7a3388565d7932be2cb91830da28a2ec9
|
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
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.4
|
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,7 +279,9 @@ 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
|
284
286
|
homepage: https://github.com/foobara/foob
|
285
287
|
licenses:
|