Skip to content

Commit

Permalink
Make use of CommandConnector
Browse files Browse the repository at this point in the history
  • Loading branch information
azimux committed Sep 13, 2024
1 parent 0f50f67 commit f6de3ae
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 25 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [unreleased]

- Make use of CommandConnector

## [0.0.2] - 2024-08-25

- Include extract-repo executable
Expand Down
44 changes: 23 additions & 21 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,31 @@ PATH
specs:
extract-repo (0.0.2)
foobara
foobara-sh-cli-connector

GEM
remote: https://rubygems.org/
specs:
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
ast (2.4.2)
base64 (0.2.0)
bigdecimal (3.1.8)
byebug (11.1.3)
coderay (1.1.3)
crack (1.0.0)
bigdecimal
rexml
diff-lcs (1.5.1)
docile (1.4.0)
docile (1.4.1)
ffi (1.17.0-x86_64-linux-gnu)
foobara (0.0.2)
foobara (0.0.9)
foobara-util
foobara-rubocop-rules (0.0.3)
foobara-rubocop-rules (0.0.4)
rubocop
rubocop-rspec
foobara-sh-cli-connector (0.0.3)
foobara
foobara-spec-helpers (0.0.3)
foobara-util
foobara-util (0.0.4)
Expand All @@ -42,7 +46,7 @@ GEM
guard (~> 2.1)
guard-compat (~> 1.1)
rspec (>= 2.99.0, < 4.0)
hashdiff (1.1.0)
hashdiff (1.1.1)
json (2.7.2)
language_server-protocol (3.17.0.3)
listen (3.9.0)
Expand All @@ -54,8 +58,8 @@ GEM
notiffany (0.1.3)
nenv (~> 0.1)
shellany (~> 0.0)
parallel (1.25.1)
parser (3.3.4.0)
parallel (1.26.3)
parser (3.3.5.0)
ast (~> 2.4.1)
racc
pry (0.14.2)
Expand All @@ -64,23 +68,22 @@ GEM
pry-byebug (3.10.1)
byebug (~> 11.0)
pry (>= 0.13, < 0.15)
public_suffix (6.0.0)
racc (1.8.0)
public_suffix (6.0.1)
racc (1.8.1)
rainbow (3.1.1)
rake (13.2.1)
rb-fsevent (0.11.2)
rb-inotify (0.11.1)
ffi (~> 1.0)
regexp_parser (2.9.2)
rexml (3.3.2)
strscan
rexml (3.3.7)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.0)
rspec-core (3.13.1)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.1)
rspec-expectations (3.13.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-its (1.3.0)
Expand All @@ -90,22 +93,21 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.1)
rubocop (1.65.0)
rubocop (1.66.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.4, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-ast (>= 1.32.2, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.31.3)
rubocop-ast (1.32.3)
parser (>= 3.3.1.0)
rubocop-rake (0.6.0)
rubocop (~> 1.0)
rubocop-rspec (3.0.3)
rubocop-rspec (3.0.5)
rubocop (~> 1.61)
ruby-prof (1.7.0)
ruby-progressbar (1.13.0)
Expand All @@ -114,12 +116,12 @@ GEM
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3)
simplecov-html (0.13.1)
simplecov_json_formatter (0.1.4)
strscan (3.1.0)
thor (1.3.1)
thor (1.3.2)
unicode-display_width (2.5.0)
vcr (6.2.0)
vcr (6.3.1)
base64
webmock (3.23.1)
addressable (>= 2.8.0)
crack (>= 0.3.2)
Expand Down
11 changes: 8 additions & 3 deletions bin/extract-repo
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#!/usr/bin/env ruby

require_relative "../lib/extract_repo"
require_relative "../boot"

repo_url, *paths = ARGV
ExtractRepo.run!(repo_url:, paths:)
require "foobara/sh_cli_connector"

command_connector = Foobara::CommandConnectors::ShCliConnector.new(single_command_mode: true)

command_connector.connect(ExtractRepo)

command_connector.run(ARGV)
1 change: 1 addition & 0 deletions extract-repo.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Gem::Specification.new do |spec|
spec.executables = ["extract-repo"]

spec.add_dependency "foobara"
spec.add_dependency "foobara-sh-cli-connector"

spec.require_paths = ["lib"]
spec.metadata["rubygems_mfa_required"] = "true"
Expand Down
4 changes: 3 additions & 1 deletion lib/extract_repo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
require "English"
require "foobara/all"

# TODO: allow extracting from a local repo and default to that repo as "."
class ExtractRepo < Foobara::Command
inputs do
repo_url :string, :required
paths [:string], :required
output_path :string, default: "/#{Dir.home}/tmp/extract"
output_path :string, default: "#{Dir.home}/tmp/extract"
delete_extracted :boolean, default: true
end

attr_accessor :file_paths
Expand Down

0 comments on commit f6de3ae

Please sign in to comment.