Skip to content
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

[Truffle] add app/gem runner #3298

Merged
merged 2 commits into from
Sep 1, 2015
Merged

[Truffle] add app/gem runner #3298

merged 2 commits into from
Sep 1, 2015

Conversation

pitr-ch
Copy link
Member

@pitr-ch pitr-ch commented Aug 31, 2015

How to try with activesupport:

  • install the gem
  • truffle --help to see the help
  • truffle --verbose setup (uses default bundled activesupport configuration) and sets the environment
  • truffle -v run test/core_ext/integer_ext_test.rb

We can add config files for libraries we test, plus we get the same environment locally when testing.

The bad path of the bundle issue is solved by symlink, https://github.com/jruby/jruby/pull/3298/files#diff-ebd53ce24fc30c47574135956e30702cR229.

@pitr-ch pitr-ch self-assigned this Aug 31, 2015
@pitr-ch pitr-ch added this to the truffle-dev milestone Aug 31, 2015
@chrisseaton
Copy link
Contributor

This looks like really good work and should be a great step forward in testing gems.

I can't figure out exactly how I'm supposed to use it though. How do I install the gem? Using my dev version of JRuby? How would it get onto my path?

I tried a couple of commands like this (without installing) and it didn't work:

chrisseaton@Chriss-MBP:~/Documents/ruby/psd.rb [master] $ ../jruby/bin/jruby ../jruby/tool/truffle/jruby_truffle_runner/bin/truffle --help
NameError: undefined local variable or method `help' for JRubyTruffleRunner:Class
                 method_missing at org/jruby/RubyBasicObject.java:1592
    block in JRubyTruffleRunner at /Users/chrisseaton/Documents/ruby/jruby/tool/truffle/jruby_truffle_runner/lib/jruby_truffle_runner.rb:25
                           call at org/jruby/RubyProc.java:308
  block in build_option_parsers at /Users/chrisseaton/Documents/ruby/jruby/tool/truffle/jruby_truffle_runner/lib/jruby_truffle_runner.rb:139
                           call at org/jruby/RubyProc.java:308
        block in parse_in_order at /Users/chrisseaton/Documents/ruby/jruby/lib/ruby/stdlib/optparse.rb:1396
                          catch at org/jruby/RubyKernel.java:1098
                 parse_in_order at /Users/chrisseaton/Documents/ruby/jruby/lib/ruby/stdlib/optparse.rb:1383
                         order! at /Users/chrisseaton/Documents/ruby/jruby/lib/ruby/stdlib/optparse.rb:1377
                          order at /Users/chrisseaton/Documents/ruby/jruby/lib/ruby/stdlib/optparse.rb:1369
                     initialize at /Users/chrisseaton/Documents/ruby/jruby/tool/truffle/jruby_truffle_runner/lib/jruby_truffle_runner.rb:107
                          <top> at ../jruby/tool/truffle/jruby_truffle_runner/bin/truffle:4
chrisseaton@Chriss-MBP:~/Documents/ruby/psd.rb [master] $ ../jruby/bin/jruby ../jruby/tool/truffle/jruby_truffle_runner/bin/truffle setup
/Users/chrisseaton/.rbenv/shims/bundle
No value provided for option '--without'
RuntimeError: command failed
       execute_cmd at /Users/chrisseaton/Documents/ruby/jruby/tool/truffle/jruby_truffle_runner/lib/jruby_truffle_runner.rb:268
  subcommand_setup at /Users/chrisseaton/Documents/ruby/jruby/tool/truffle/jruby_truffle_runner/lib/jruby_truffle_runner.rb:227
        initialize at /Users/chrisseaton/Documents/ruby/jruby/tool/truffle/jruby_truffle_runner/lib/jruby_truffle_runner.rb:119
             <top> at ../jruby/tool/truffle/jruby_truffle_runner/bin/truffle:4

Could you post a complete example of use for Active Support?

@@ -0,0 +1,270 @@
require 'optparse'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anything more substantial than a simple configuration file must begin with our standard copyright header - so the JRuby people are clear what we're putting into their repository if nothing else.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

s.platform = Gem::Platform::RUBY
s.authors = ['Petr Chalupa']
s.email = ['git@pitr.ch']
s.homepage = 'http://github.com/jruby/jruby'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May as well make this 'https' and avoid the redirect.

@pitr-ch
Copy link
Member Author

pitr-ch commented Sep 1, 2015

Ah sorry, last minute changes strike again :(. --help option is broken, if you run just truffle without the -h option it will print help, it goes through different path. I'll fix rest in few hours.

@pitr-ch pitr-ch force-pushed the master branch 3 times, most recently from 57030a6 to a93c8ce Compare September 1, 2015 09:13
@pitr-ch
Copy link
Member Author

pitr-ch commented Sep 1, 2015

To run the executable, I either do ruby ../../jruby/tool/truffle/jruby_truffle_runner/bin/truffle --help or I install the gem from my JRuby repo (it'll be on rubygems later):

  • cd tool/truffle/jruby_truffle_runner
  • gem build jruby_truffle_runner.gemspec
  • gem install jruby_truffle_runner-0.0.1.gem
  • cd ../../../../rails/activesupport
  • then truffle --help should work

@pitr-ch
Copy link
Member Author

pitr-ch commented Sep 1, 2015

Regarding usage for activesupport:

  • clone rails
  • cd rails/activesupport
  • install jruby_truffle_runner with a Ruby implementation (MRI or JRuby, for this case it worked both for me)
  • run truffle setup
  • run e.g. truffle run -- -I test test/core_ext/integer_ext_test.rb (assumes jruby on path ../../jruby/bin/ruby, can be changed in .truffle.yaml after setup step)

test: ['-t', '--test', 'Do not use Truffle use plain JRuby', assign_new_value, false],
debug: ['-d', '--debug', 'JVM remote debugging', assign_new_value, false],
require: ['-r', '--require FILE', 'Files to require, same as Ruby\'s -r', add_to_array, []],
load_path: ['-l', '--load-path LOAD_PATH', 'Paths to add to load path, same as Ruby\'s -I', add_to_array, []],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can the shorthand be -I as well?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah probably better.

@eregon
Copy link
Member

eregon commented Sep 1, 2015

Looks great, and it also raises the question what launcher do we want for testing/user/dev and I think it make sense to have sth slightly different for some of them.

#!/usr/bin/env ruby

require_relative '../lib/jruby_truffle_runner.rb'
JRubyTruffleRunner.new
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not executable by default, can you chmod and commit that?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be renamed I think to match with the gem name.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done;

I am not sure, jruby_truffle_runner executable is quite long :/

@pitr-ch pitr-ch force-pushed the master branch 2 times, most recently from f6cf8f1 to b4de35f Compare September 1, 2015 12:05
@pitr-ch
Copy link
Member Author

pitr-ch commented Sep 1, 2015

TODO:

  • rename truffle executable to jruby+truffle

Sorry, something went wrong.

@chrisseaton
Copy link
Contributor

Can we merge this and then keep working on master? It's already very useful.

@pitr-ch
Copy link
Member Author

pitr-ch commented Sep 1, 2015

Please check the last commit if you agree with the new names. After that we can merge.

@chrisseaton
Copy link
Contributor

Looks good to me.

@pitr-ch pitr-ch merged commit 4a08cfe into jruby:master Sep 1, 2015
@enebo enebo added this to the Non-Release milestone Dec 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants