Skip to content

Commit

Permalink
add ostruct dependency and default options configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
dorianmariecom committed Sep 6, 2024
1 parent e0af513 commit 2d71d05
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ PATH
dorian-to_struct
git
json
ostruct
parallel
yaml

Expand Down Expand Up @@ -57,6 +58,7 @@ GEM
language_server-protocol (3.17.0.3)
logger (1.6.1)
minitest (5.25.1)
ostruct (0.6.0)
parallel (1.26.3)
parser (3.3.5.0)
ast (~> 2.4.1)
Expand Down
27 changes: 27 additions & 0 deletions bin/rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# This file was generated by Bundler.
#
# The application 'rspec' is installed as part of a gem, and
# this file is here to facilitate running it.
#

ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)

bundle_binstub = File.expand_path("bundle", __dir__)

if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
end
end

require "rubygems"
require "bundler/setup"

load Gem.bin_path("rspec-core", "rspec")
1 change: 1 addition & 0 deletions dorian.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Gem::Specification.new do |s|
s.add_dependency "json"
s.add_dependency "parallel"
s.add_dependency "yaml"
s.add_dependency "ostruct"

s.metadata = { "rubygems_mfa_required" => "true" }
s.required_ruby_version = ">= 3.3"
Expand Down
8 changes: 5 additions & 3 deletions lib/dorian/bin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ def initialize
default: true
},
fast: {
alias: :f
alias: :f,
default: true
},
input: {
type: :string,
Expand All @@ -50,7 +51,8 @@ def initialize
alias: :o
},
parallel: {
alias: :p
alias: :p,
default: true
},
parallel_type: {
alias: :pt,
Expand Down Expand Up @@ -85,7 +87,7 @@ def initialize
alias: :d
},
progress: :boolean,
headers: :boolean,
headers: { default: true },
progress_format: {
alias: :pf,
type: :string
Expand Down
2 changes: 1 addition & 1 deletion spec/dorian_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@
describe "each" do
it "works" do
input = "echo [1, 2, 3]"
command = "bin/dorian each --io json"
command = "bin/dorian each --io json --parallel false --fast false"
input_command = "#{input} | #{command}"
expect(`#{input_command} "p it"`).to eq(<<~OUTPUT)
1
Expand Down

0 comments on commit 2d71d05

Please sign in to comment.