
Specify the working directory used by the running task. The -classpath option specified in this field overrides the classpath of the module. For example, if you define a variable MY_ENV_VAR, you can pass it to the foo property as follows: You can pass environment variable values to custom Java properties. If an option includes double quotes (as part of the argument), escape the double quotes using backslashes, for example, -Dmy.prop=\"quoted_value\".

If an option includes spaces, enclose the spaces or the argument that contains spaces in double quotes, for example, some" "arg or "some arg". Use spaces to separate individual options, for example, -client -ea -Xmx1024m. When specifying JVM options, follow these rules: Specify the string to be passed to the VM for launching an application, for example, -mx, -verbose, and so on. If the path to a step definition file or directory is relative, it is relative to the Working directory defined in this run/debug configuration. To do that, add -r to the Runner options field. Thus, if you want to make use of the step definitions located elsewhere, you have to specify the required directory with the step definition files, or individual step definition files. It is important to note that step definitions that reside outside the Features directory, can be skipped by IntelliJ IDEA, and the tests will fail to run. Specify the tags to be considered on running tests -t, -tags TAGS. IntelliJ IDEA will execute the feature elements with the names that contain matching substrings -n, -name NAME. This field is only available, when the Feature file option is selected. Specify the name of the script to be executed.

This field is only available, when the All features in folder option is selected. Specify the fully qualified path to the directory that contains the desired features, or click and select the features directory in the dialog that opens. Puts "THERE ARE # USERS" # I have a users modelĬalling with no args: $ be ruby app/jobs/my_job.rbĬalling with an arg shorthand: $ be ruby app/jobs/my_job.rb -t my_argĬalling with an arg long-hand: $ be ruby app/jobs/my_job.Click one of the radio buttons to define the scope of features:Īll features in a folder: Click this button, if you want to run all features in a directory.įeature file: Click this button, if you want to run the specified feature only. Require_relative '././config/environment' Options.on '-t', '-the-arg SOME_ARG', 'Shows that we can take an arg' do |arg| Then you can just write your scripts in there.įor example, I have a script that takes an argument, prints it out if it was provided, and then prints out how many users are in my app:įile: app/jobs/my_job.rb require 'optparse' I assume you're on an older Rails based on script/runner I don't know if this works for older Rails' or not, but in newer Rails, you can just require 'config/environment', and it will load the app. usr/local/lib/ruby/1.8/optparse.rb:1450:in `complete': invalid option: -environment=production (OptionParser::InvalidOption)įrom /usr/local/lib/ruby/1.8/optparse.rb:1448:in `catch'įrom /usr/local/lib/ruby/1.8/optparse.rb:1448:in `complete'įrom /usr/local/lib/ruby/1.8/optparse.rb:1261:in `parse_in_order'įrom /usr/local/lib/ruby/1.8/optparse.rb:1254:in `catch'įrom /usr/local/lib/ruby/1.8/optparse.rb:1254:in `parse_in_order'įrom /usr/local/lib/ruby/1.8/optparse.rb:1248:in `order!'įrom /usr/local/lib/ruby/1.8/optparse.rb:1339:in `permute!'įrom /usr/local/lib/ruby/1.8/optparse.rb:1360:in `parse!'įrom app/jobs/2new_error_log_rt_report.rb:12:in `execute'įrom app/jobs/2new_error_log_rt_report.rb:102įrom /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `eval'įrom /home/`gem_original_require'įrom /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' If the solution doesn't touch (or depends on) Rails or Linux's global environment, it would be much better. I guess this can be solved using some parentheses, but no have an idea. My_job.rb also takes `-environment=production' as its argument, which should be script/runner's argument.

`my_job.rb` is my script, which handles command line arguments. This command is my problem: /usr/local/bin/ruby **script/runner** -environment=production app/jobs/**my_job.rb** -t my_arg
