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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ec596bad78ddfeea395b31e3e26965b248b39631b28ac75a0354700ba26546b3
4
- data.tar.gz: 5cc388522848e9ded1d0905ae873f4a59a7412c1e209d1d9b1b1aaa629ce5bb4
3
+ metadata.gz: c364e020bfc8623fb49e13a6453921fdcc49ecb47b4ca36a9315fc5dbc0b5831
4
+ data.tar.gz: 2f7abc80db71e15feb5164a846f24ac0fefa72ee6adfea42893118f38eeb9a6f
5
5
  SHA512:
6
- metadata.gz: ee272f855d5171b03b27900b239b1b9c2d48edaa35fac07cef5a103728bcaf778072885641fc503ac89e734fef74464b2d23fbc51eca84787895f34f1f4a98de
7
- data.tar.gz: b0d2f7e417082dc782c93cd8d7d9017ffda603059dcb72849b955c0f9333843ac1c5818593b5dbd3172791c1f130bbdce7a7e5fcba4933cfcb7998cee2450c0e
6
+ metadata.gz: c6f5683b9671cb3acf34b757f5286763ea397d794fb6bf468a97ab10479ef0d4cf5fd903950a7206ad3b4f32b1af4b8448bc05a39d51fce0b773d1d0a9b42c78
7
+ data.tar.gz: e3dbdef91f3ba1d17526471bb80fa51250eb9d7d3e697098ee95346a78a0fcc4bba62eda2121957108eb5d6408f5f8ced4b37ae506913143314958de497640f1
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## [0.0.5] - 2024-06-19
2
+
3
+ - Add --version
4
+ - Don't assume Bundle is loaded
5
+
1
6
  ## [0.0.3] - 2024-06-18
2
7
 
3
8
  - Fix bug preventing foob from loading
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
- # ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
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
@@ -18,7 +18,7 @@ module Foobara
18
18
  end
19
19
 
20
20
  def known_actions
21
- [*super, "generate"]
21
+ [*super, "generate", "version", "console"]
22
22
  end
23
23
  end
24
24
  end
@@ -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
- Bundler.with_unbundled_env do
73
- exec({ "IRB_PROMPT_PREFIX" => "foob" }, "./bin/console")
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
@@ -5,6 +5,10 @@ module Foobara
5
5
  def action_parser
6
6
  @action_parser ||= ActionParser.new
7
7
  end
8
+
9
+ def globalish_parser
10
+ @globalish_parser ||= GlobalishParser.new
11
+ end
8
12
  end
9
13
  end
10
14
  end
data/version.rb ADDED
@@ -0,0 +1,5 @@
1
+ module Foobara
2
+ module Foob
3
+ VERSION = "0.0.5".freeze
4
+ end
5
+ end
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.3
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-18 00:00:00.000000000 Z
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