skorks / escort Goto Github PK
View Code? Open in Web Editor NEWA library that makes building command-line apps in ruby so easy, you'll feel like an expert is guiding you through it
License: MIT License
A library that makes building command-line apps in ruby so easy, you'll feel like an expert is guiding you through it
License: MIT License
Hi,
I really like Escort! Is it still being developed? If require the escort 0.4.0 gem in a project that is using simplecov for code coverage, I get a error but this has already been fixed in master. Are there any plans to release an updated gem?
The error is encountered after all rspec tests have been run when simplecov is writing its report. Since this is an unhandled error it causes ruby to exit with failed status and marks good builds as bad:
/Users/geoff/.rbenv/versions/2.2.6/lib/ruby/gems/2.2.0/gems/simplecov-html-0.10.0/lib/simplecov-html.rb:25:in `write': closed stream (IOError)
from /Users/geoff/.rbenv/versions/2.2.6/lib/ruby/gems/2.2.0/gems/simplecov-html-0.10.0/lib/simplecov-html.rb:25:in `puts'
from /Users/geoff/.rbenv/versions/2.2.6/lib/ruby/gems/2.2.0/gems/simplecov-html-0.10.0/lib/simplecov-html.rb:25:in `puts'
from /Users/geoff/.rbenv/versions/2.2.6/lib/ruby/gems/2.2.0/gems/simplecov-html-0.10.0/lib/simplecov-html.rb:25:in `format'
from /Users/geoff/.rbenv/versions/2.2.6/lib/ruby/gems/2.2.0/gems/simplecov-0.12.0/lib/simplecov/result.rb:47:in `format!'
from /Users/geoff/.rbenv/versions/2.2.6/lib/ruby/gems/2.2.0/gems/simplecov-0.12.0/lib/simplecov/configuration.rb:172:in `block in at_exit'
from /Users/geoff/.rbenv/versions/2.2.6/lib/ruby/gems/2.2.0/gems/simplecov-0.12.0/lib/simplecov/defaults.rb:67:in `call'
from /Users/geoff/.rbenv/versions/2.2.6/lib/ruby/gems/2.2.0/gems/simplecov-0.12.0/lib/simplecov/defaults.rb:67:in `block in <top (required)>'
/Users/geoff/.rbenv/versions/2.2.6/bin/ruby -I/Users/geoff/.rbenv/versions/2.2.6/lib/ruby/gems/2.2.0/gems/rspec-core-3.5.4/lib:/Users/geoff/.rbenv/versions/2.2.6/lib/ruby/gems/2.2.0/gems/rspec-support-3.5.0/lib /Users/geoff/.rbenv/versions/2.2.6/lib/ruby/gems/2.2.0/gems/rspec-core-3.5.4/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb failed
This is already fixed in master in commit 0ade8fb :
-at_exit do
- Escort::Logger.close
-end
Verbosity level (--verbosity) is only available for app but not for commands.
Caught this issue while fixing failing tests, and thought to put it here maybe someone with more knowledge of the code base could have a look at it.
Environment:
Ruby-2.4.2
RSpec-3.7.0
All gems updated to latest version as of date of issue submission.
$ rspec spec --seed 46460
Run options: include {:focus=>true}
All examples were filtered out; ignoring {:focus=>true}
Randomized with seed 46460
Escort basic app with dependent options
when dependency specification has no 'on' parameter
Problem with syntax of global configuration
Problem with syntax of global configuration (Escort::ClientError)
/Users/idmoussiyoussef/Projects/ruby/escort/lib/escort/setup/dsl/global.rb:9:in `rescue in initialize'
/Users/idmoussiyoussef/Projects/ruby/escort/lib/escort/setup/dsl/global.rb:6:in `initialize'
/Users/idmoussiyoussef/Projects/ruby/escort/lib/escort/setup/dsl/options.rb:9:in `rescue in options': Problem with syntax of global options block (Escort::ClientError)
/Users/idmoussiyoussef/Projects/ruby/escort/lib/escort/setup/dsl/options.rb:65:in `ensure_dependency_specification_syntax': undefined local variable or method `option_name' for #<Escort::Setup::Dsl::Options:0x00007f88761ccba8>
Did you mean? @options (NameError)
/Users/idmoussiyoussef/Projects/ruby/escort/lib/escort/setup/dsl/options.rb:34:in `dependency'
/Users/idmoussiyoussef/Projects/ruby/escort/spec/integration/basic_depends_on_spec.rb:11:in `block (5 levels) in <top (required)>'
/Users/idmoussiyoussef/Projects/ruby/escort/lib/escort/setup/dsl/options.rb:7:in `options'
/Users/idmoussiyoussef/Projects/ruby/escort/lib/escort/setup/dsl/command.rb:16:in `options'
/Users/idmoussiyoussef/Projects/ruby/escort/spec/integration/basic_depends_on_spec.rb:7:in `block (4 levels) in <top (required)>'
/Users/idmoussiyoussef/Projects/ruby/escort/lib/escort/setup/dsl/global.rb:7:in `initialize'
/Users/idmoussiyoussef/Projects/ruby/escort/lib/escort/app.rb:23:in `new'
/Users/idmoussiyoussef/Projects/ruby/escort/lib/escort/app.rb:23:in `setup_application'
/Users/idmoussiyoussef/Projects/ruby/escort/lib/escort/app.rb:6:in `create'
/Users/idmoussiyoussef/Projects/ruby/escort/spec/integration/basic_depends_on_spec.rb:2:in `block (2 levels) in <top (required)>'
/Users/idmoussiyoussef/.rvm/gems/ruby-2.4.2/gems/rspec-core-3.7.0/lib/rspec/core/memoized_helpers.rb:298:in `block (2 levels) in let'
/Users/idmoussiyoussef/.rvm/gems/ruby-2.4.2/gems/rspec-core-3.7.0/lib/rspec/core/memoized_helpers.rb:157:in `block (3 levels) in fetch_or_store'
/Users/idmoussiyoussef/.rvm/gems/ruby-2.4.2/gems/rspec-core-3.7.0/lib/rspec/core/memoized_helpers.rb:157:in `fetch'
/Users/idmoussiyoussef/.rvm/gems/ruby-2.4.2/gems/rspec-core-3.7.0/lib/rspec/core/memoized_helpers.rb:157:in `block (2 levels) in fetch_or_store'
/Users/idmoussiyoussef/.rvm/gems/ruby-2.4.2/gems/rspec-support-3.7.0/lib/rspec/support/reentrant_mutex.rb:23:in `synchronize'
/Users/idmoussiyoussef/.rvm/gems/ruby-2.4.2/gems/rspec-core-3.7.0/lib/rspec/core/memoized_helpers.rb:156:in `block in fetch_or_store'
/Users/idmoussiyoussef/.rvm/gems/ruby-2.4.2/gems/rspec-core-3.7.0/lib/rspec/core/memoized_helpers.rb:155:in `fetch'
/Users/idmoussiyoussef/.rvm/gems/ruby-2.4.2/gems/rspec-core-3.7.0/lib/rspec/core/memoized_helpers.rb:155:in `fetch_or_store'
/Users/idmoussiyoussef/.rvm/gems/ruby-2.4.2/gems/rspec-core-3.7.0/lib/rspec/core/memoized_helpers.rb:298:in `block in let'
/Users/idmoussiyoussef/Projects/ruby/escort/spec/integration/basic_depends_on_spec.rb:20:in `block (3 levels) in <top (required)>'
/Users/idmoussiyoussef/.rvm/gems/ruby-2.4.2/gems/rspec-core-3.7.0/lib/rspec/core/example.rb:254:in `instance_exec'
/Users/idmoussiyoussef/.rvm/gems/ruby-2.4.2/gems/rspec-core-3.7.0/lib/rspec/core/example.rb:254:in `block in run'
/Users/idmoussiyoussef/.rvm/gems/ruby-2.4.2/gems/rspec-core-3.7.0/lib/rspec/core/example.rb:500:in `block in with_around_and_singleton_context_hooks'
/Users/idmoussiyoussef/.rvm/gems/ruby-2.4.2/gems/rspec-core-3.7.0/lib/rspec/core/example.rb:457:in `block in with_around_example_hooks'
/Users/idmoussiyoussef/.rvm/gems/ruby-2.4.2/gems/rspec-core-3.7.0/lib/rspec/core/hooks.rb:466:in `block in run'
/Users/idmoussiyoussef/.rvm/gems/ruby-2.4.2/gems/rspec-core-3.7.0/lib/rspec/core/hooks.rb:604:in `run_around_example_hooks_for'
/Users/idmoussiyoussef/.rvm/gems/ruby-2.4.2/gems/rspec-core-3.7.0/lib/rspec/core/hooks.rb:466:in `run'
/Users/idmoussiyoussef/.rvm/gems/ruby-2.4.2/gems/rspec-core-3.7.0/lib/rspec/core/example.rb:457:in `with_around_example_hooks'
/Users/idmoussiyoussef/.rvm/gems/ruby-2.4.2/gems/rspec-core-3.7.0/lib/rspec/core/example.rb:500:in `with_around_and_singleton_context_hooks'
/Users/idmoussiyoussef/.rvm/gems/ruby-2.4.2/gems/rspec-core-3.7.0/lib/rspec/core/example.rb:251:in `run'
/Users/idmoussiyoussef/.rvm/gems/ruby-2.4.2/gems/rspec-core-3.7.0/lib/rspec/core/example_group.rb:628:in `block in run_examples'
/Users/idmoussiyoussef/.rvm/gems/ruby-2.4.2/gems/rspec-core-3.7.0/lib/rspec/core/example_group.rb:624:in `map'
/Users/idmoussiyoussef/.rvm/gems/ruby-2.4.2/gems/rspec-core-3.7.0/lib/rspec/core/example_group.rb:624:in `run_examples'
/Users/idmoussiyoussef/.rvm/gems/ruby-2.4.2/gems/rspec-core-3.7.0/lib/rspec/core/example_group.rb:590:in `run'
/Users/idmoussiyoussef/.rvm/gems/ruby-2.4.2/gems/rspec-core-3.7.0/lib/rspec/core/example_group.rb:591:in `block in run'
/Users/idmoussiyoussef/.rvm/gems/ruby-2.4.2/gems/rspec-core-3.7.0/lib/rspec/core/example_group.rb:591:in `map'
/Users/idmoussiyoussef/.rvm/gems/ruby-2.4.2/gems/rspec-core-3.7.0/lib/rspec/core/example_group.rb:591:in `run'
/Users/idmoussiyoussef/.rvm/gems/ruby-2.4.2/gems/rspec-core-3.7.0/lib/rspec/core/runner.rb:118:in `block (3 levels) in run_specs'
/Users/idmoussiyoussef/.rvm/gems/ruby-2.4.2/gems/rspec-core-3.7.0/lib/rspec/core/runner.rb:118:in `map'
/Users/idmoussiyoussef/.rvm/gems/ruby-2.4.2/gems/rspec-core-3.7.0/lib/rspec/core/runner.rb:118:in `block (2 levels) in run_specs'
/Users/idmoussiyoussef/.rvm/gems/ruby-2.4.2/gems/rspec-core-3.7.0/lib/rspec/core/configuration.rb:1896:in `with_suite_hooks'
/Users/idmoussiyoussef/.rvm/gems/ruby-2.4.2/gems/rspec-core-3.7.0/lib/rspec/core/runner.rb:113:in `block in run_specs'
/Users/idmoussiyoussef/.rvm/gems/ruby-2.4.2/gems/rspec-core-3.7.0/lib/rspec/core/reporter.rb:79:in `report'
/Users/idmoussiyoussef/.rvm/gems/ruby-2.4.2/gems/rspec-core-3.7.0/lib/rspec/core/runner.rb:112:in `run_specs'
/Users/idmoussiyoussef/.rvm/gems/ruby-2.4.2/gems/rspec-core-3.7.0/lib/rspec/core/runner.rb:87:in `run'
/Users/idmoussiyoussef/.rvm/gems/ruby-2.4.2/gems/rspec-core-3.7.0/lib/rspec/core/runner.rb:71:in `run'
/Users/idmoussiyoussef/.rvm/gems/ruby-2.4.2/gems/rspec-core-3.7.0/lib/rspec/core/runner.rb:45:in `invoke'
/Users/idmoussiyoussef/.rvm/gems/ruby-2.4.2/gems/rspec-core-3.7.0/exe/rspec:4:in `<top (required)>'
/Users/idmoussiyoussef/.rvm/gems/ruby-2.4.2/bin/rspec:23:in `load'
/Users/idmoussiyoussef/.rvm/gems/ruby-2.4.2/bin/rspec:23:in `<main>'
/Users/idmoussiyoussef/.rvm/gems/ruby-2.4.2/bin/ruby_executable_hooks:15:in `eval'
/Users/idmoussiyoussef/.rvm/gems/ruby-2.4.2/bin/ruby_executable_hooks:15:in `<main>'
Escort app failed to execute successfully, due to client setup error
Finished in 0.08564 seconds (files took 0.23726 seconds to load)
1 example, 0 failures
Randomized with seed 46460
When I view the help for a subcommand with --help, I'd like to see documentation for all options that could apply to that command, including options for its parent commands, not just the options for that specific subcommand.
Would be great to be able to export shims for autocomplete :)
When I run $ rspec ./spec/lib/escort/setup/configuration/locator/chaining_spec.rb
everything is green. But when I run the whole spec/lib/escort
folder specs I get this result:
$ rspec spec/lib/escort/ --seed 34021
Run options: include {:focus=>true}
All examples were filtered out; ignoring {:focus=>true}
Randomized with seed 34021
...
Escort::Setup::Configuration::Locator::Chaining
#locate
when descending and current script locators are specified
and file should be found by current script locator
should == "/.blahrc"
and file should not be found
should be nil
and file should be found by descending locator
should == "/Users/idmoussiyoussef/.blahrc"
when executing directory locator specified
and file should not be found by it
should be nil
and file should be found by it
should == "/.blahrc" (FAILED - 1)
when no sub-locators specified
should be nil
#add_locator
should == 1
should == #<Escort::Setup::Configuration::Locator::Chaining:0x00007fc6f796b480 @filename=".blahrc", @locators=["blah"]>
Failures:
1) Escort::Setup::Configuration::Locator::Chaining#locate when executing directory locator specified and file should be found by it should == "/.blahrc"
Failure/Error: it {subject.should == path}
TypeError:
superclass mismatch for class File
# ./spec/lib/escort/setup/configuration/locator/chaining_spec.rb:45:in `block (5 levels) in <top (required)>'
...
Finished in 0.4203 seconds (files took 0.22204 seconds to load)
244 examples, 1 failure
Failed examples:
rspec ./spec/lib/escort/setup/configuration/locator/chaining_spec.rb:45 # Escort::Setup::Configuration::Locator::Chaining#locate when executing directory locator specified and file should be found by it should == "/.blahrc"
Randomized with seed 34021
Any ideas where to start to fix this ?
I have created my actions, however they are returning values that I need in another class. Is it possible to get it somehow?
https://github.com/skorks/escort/blob/master/lib/escort/app.rb#L22
Unless I'm missing something, doesn't this set the default verbosity to DEBUG? --help clearly states that the default is WARN.
I've got a script that converts video files. -l is the short flag for "auto-detect letterboxing and remove if present." I would like to have a corresponding "-nl" flag for "do NOT check for letterboxing." But, what I'm reporting here is that it seems I cannot do "script --no-letterbox filename.mpeg anotherfile.mpeg --letterbox filewithletterboxing.mpeg" because that throws an "unsupported multiple argument type 'TrueClass'" error.
Howdy,
I've got an app with a number of commands and I'd like to display the help if the global action is run. Is there an easy way to do that?
Thanks
yell is a great logging lib.
It is very easy to use and extremely flexible.
It also allows the logging configuration to be defined by the end user via a yaml file.
This is perfect for escort
as it means each person building a cli app with escort can implement logging themselves just via a config file(yaml)
Yell can log to file(s), STDOUT/STDERR, GELF, custom etc via adapters.
require 'yell'
@logger = Yell.load!('config/yell.yml')
# some helpers
# taken from https://github.com/davetron5000/methadone
#
def debug(progname = nil, &block); @logger.debug(progname,&block); end
def info(progname = nil, &block); @logger.info(progname,&block); end
def warn(progname = nil, &block); @logger.warn(progname,&block); end
def error(progname = nil, &block); @logger.error(progname,&block); end
def fatal(progname = nil, &block); @logger.fatal(progname,&block); end
# logging
#
debug('debug message')
info('info message')
warn('warn message')
error('error message')
fatal('fatal message')
production:
:level: 'gte.info'
:adapters:
- :file:
:level: 'lte.warn'
:filename: 'log/production.log'
- :file:
:level: 'gte.error'
:filename: 'log/error.log'
development:
:level: 'gte.info'
:adapters:
- :stdout:
:colors: true
:level: 'lte.warn'
- :stderr:
:colors: true
:level: 'gte.error'
- :file:
:filename: 'log/development.log'
With this, a consumer can now easily tune the yaml file to setup logging however they want, including adding an additional adapter to get logs into a graylog2 server.
Given my app makes use of app.config_file ".foo", :autocreate => true
Then when I invoke the app with foo --no-daemonize -d dbname -u dbuser
I would expect the config file to be generated with the data supplied.
Instead I get a config file with the default data that is hard coded into the app.
The above would let the consumer of my application build out a config file with ease.
Is this project dead?
I would like to submit a pull request but the tests seem dysfunctional?
I would like to have have a loop that gets the input and passes them to my app to validate and execute the command typed in from the user. After the command is executed, the app should read the next command from the command line. Is this somehow possible with your framework? There doesn't seem to be a start or pass method for input, the app starts automatically.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.