- Notifications
You must be signed in to change notification settings - Fork 29
replace mruby-getopts with mruby-docopt#32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base:master
Are you sure you want to change the base?
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
e846802db9162574759a7a00f779a01354fa0646c215e1f6dFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,8 @@ | ||
| FROM hone/mruby-cli | ||
| FROM hone/mruby-cli:15.04 | ||
| RUN apt-get update && \ | ||
| apt-get install -y --no-install-recommends software-properties-common && \ | ||
| add-apt-repository ppa:george-edison55/cmake-3.x && \ | ||
| apt-get update && \ | ||
| apt-get upgrade -y cmake | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,30 +1,42 @@ | ||
| module MRubyCLI | ||
| class CLI | ||
| def initialize(argv, output_io = $stdout, error_io = $stderr) | ||
| @options = setup_options | ||
| @opts = @options.parse(argv) | ||
| @usage = setup_options | ||
| @options = Docopt.parse(@usage, argv) | ||
| @output_io = output_io | ||
| @error_io = error_io | ||
| end | ||
| def run | ||
| if app_name = @options.option(:setup) | ||
| Setup.new(app_name, @output_io).run | ||
| elsif @options.option(:version) | ||
| if @options["setup"] | ||
| Setup.new(@options["<name>"], @output_io).run | ||
| elsif @options["--version"] | ||
| Version.new(@output_io).run | ||
| else | ||
| Help.new(@output_io).run | ||
| Help.new(@usage, @output_io).run | ||
| end | ||
| end | ||
| private | ||
| def setup_options | ||
| options = Options.new | ||
| options.add(Option.new("setup", "s", true)) | ||
| options.add(Option.new("version", "v")) | ||
| options.add(Option.new("help", "h")) | ||
| USAGE = <<USAGE | ||
| mruby-cli. | ||
| options | ||
| Usage: | ||
| mruby-cli setup <name> | ||
| mruby-cli (-v | --version) | ||
| mruby-cli (-h | --help) | ||
| Create your own cli application. | ||
| Setup will scafold your application. | ||
| Arguments: | ||
| name The name of your application | ||
| Options: | ||
| -h --Help Show this screen. | ||
| -v --version Show version. | ||
| USAGE | ||
| end | ||
| end | ||
| end |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,12 @@ | ||
| module MRubyCLI | ||
| class Help | ||
| def initialize(output_io) | ||
| def initialize(usage, output_io) | ||
| @usage = usage | ||
| @output_io = output_io | ||
| end | ||
| def run | ||
| @output_io.puts "mruby-cli [switches] [arguments]" | ||
| @output_io.puts "mruby-cli -h, --help : show this message" | ||
| @output_io.puts "mruby-cli -s<name>, --setup=<name> : setup your app" | ||
| @output_io.puts "mruby-cli -v, --version : print mruby-cli version" | ||
| @output_io.puts @usage | ||
| end | ||
| end | ||
| end |
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a way we can have this flag be autodetected instead of manually being added for anyone who wants to mruby-docopt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just tried without it, and it failed.
http://ruby-doc.org/core-mruby/doc/guides/compile_md.html#label-C-2B-2B+ABI
So it should be detected automatically, moreover, I've enabled it into mruby-docopt. So it seems that it's too late when it detects and enables it.
Should
MRuby::BuildandMRuby::CrossBuildconfiguration of mrbgems infect the project depending on them?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be able to add defines in the mrbgem.rake of mruby-docopt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you explain @zzak ? How does it work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dug into mruby code and find the following:
This issue is the same than previously. As the C++ code has been enabled, some files should be appropriately selected as for vm.cxx and error.cxx
y.tab.cbelongs to mruby-compiler. Its C++ version should be selected, it's not yet enabled when it comes to that gem, explaining why it fails.The patch I've mentioned above:
I don't like it at all, but it helps to understand the problem and what to do.
All of that makes me ask the following question: