How to show help for bundler commands and utilities? - bundler

bundle --help shows a help file that lists commands (i.e. install) and utilities (i.e. show). How do I view the details on how to use a specific command or utility?

I found this through trial and error in the command line:
bundle --help show
Usage:
bundle show [GEM]
Options:
[--paths=List the paths of all gems that are required by your Gemfile.]
[--no-color=Disable colorization in output]
-V, [--verbose=Enable verbose output mode]
Description:
Show lists the names and versions of all gems that are required by your Gemfile. Calling show with [GEM] will list the exact location of that gem on your machine.
So in general, type bundle --help <command or utility name>

Related

How do I install and use apache daffodil?

I know this might be a dumb question, but I cannot figure out how to install and use Apache Daffodil. Any help would be appreciated. I cannot find anything helpful. Thank you!
Download apache Daffodil from below url
https://downloads.apache.org/daffodil/3.0.0/src/apache-daffodil-3.0.0-incubating-src.zip
The binary Daffodil releases contain a /bin directory that contains two scripts: daffodil.bat for Windows and daffodil for Linux. These files must be executed on the command line.
Extract downloaded zip
Path of bin directory export as environment variables.
After that you can verify its installed or not via below cammand it will show the version of daffodil
daffodil --version
Global Options
-d, --debug [FILE]
Enable the interactive debugger. See the Interactive Debugger documentation for more information.
The optional FILE argument contains a list of debugger commands that are provided to the debugger as they were typed by the user.
This option cannot be used with the --trace option.
-t, --trace
Enable a trace mode. This mode prints out helpful information during every stage of parsing.
This option cannot be used with the --debug option.
-v, --verbose
Enable verbose mode and increment verbosity level. Each additional v provides a new level of information.
--version
Display the version of Daffodil.
--help
Display help message.

Does gem log unrecognised options with whitespace?

I'm seeing a somewhat peculiar error in Jenkins where a gem is being invoked correctly, but the error is spitting out an option with a whitespace character between the options identifier (--) and the option name (checksum).
gemname publish_artifact --version 0.1.0 --checksum 01fakechecksum89 --repository release
publish_artifact: unrecognised option -- checksum
I checked the Jenkins node and the option is available. I haven't run the command because the deployment is not mine to make, I'm just on the ops team and am not really that familiar with Ruby yet.
I ran a command with a fake option for a different gem and got a different error response.
$ yard list --fakename blah
[warn]: Unrecognized/invalid option: --fakename
Notice no whitespace between the option specifier and the name. I'm digging into the Jenkins pipeline configuration because it is quite complex, and maybe the command is getting butchered between the master and the node, but it just doesn't make much sense to me.
It turned out to be a rather misleading error. The problem was that gem failed to update to the newest version. The older version didn't have the checksum option.

Gem installed. Gem's command is not found

I installed the ruby-processing gem using:
$ sudo gem install ruby-processing
When I try to run ruby-processing's rp5 command, this is the output I get:
rp5 run twitter_emotion_graphs.rb
No command 'rp5' found, did you mean:
Command 'rpm' from package 'rpm' (main)
Command 'rpl' from package 'rpl' (universe)
rp5: command not found
Here's the context for more information (have a look at the README) :
https://github.com/vishrut/Twitter-Emotion-Graphs
On some systems (e.g., Debian) the path where the gem executables are installed to are not in the $PATH. Dependingmon your distribution, that path is on a different location, on Debian with the system Ruby, it is at /var/lib/gems/1.8/bin. To add that to the system's $PATH, put something like this into a new file in /etc/profile.d/rubygems.sh
export PATH="$PATH:/var/lib/gems/1.8/bin"
Make sure the executable is on your path. You may have to restart your terminal for everything to refresh.

How to set Ruby's load path externally

I have a custom Ruby library directory that I'd like to have automatically added to Ruby's load path whenever Ruby is executed. I know I can use the -I option to Ruby, but is there something like an environment variable that I can set that will globally determine Ruby's load path.
I want to install Ruby Gems on a Linux box where I don't have root privileges, so I need to have a Ruby load path in a non-standard location. I installed RubyGems per "Installing RubyGems in a User Directory", but the gem command isn't picking up the non-standard load path.
Maybe I'm missing something obvious here and making things harder for myself?
See the "Ruby and Its World" chapter from The Pickaxe Book, specifically the section on environment variables. Excerpt:
RUBYLIB
Additional search path for Ruby programs ($SAFE must be 0).
DLN_LIBRARY_PATH
Search path for dynamically loaded modules.
RUBYLIB_PREFIX
(Windows only) Mangle the RUBYLIB search path by adding this
prefix to each component.
Make sure that you've placed the installed bin directory in your $PATH for the gem
command to work. It should modify the RUBYLIB itself, but if not, try Martin's answer to fix that.
Then, you can have your gem home (where the gems that rubygems installs are stored) be local.
Just use $GEM_HOME (or set things up in your ~/.gemrc) and check that everything took with gem environment.
% mkdir ~/.gems
% export GEM_HOME=~/.gems
% gem help environment
Usage: gem environment [arg] [options]
Common Options:
-h, --help Get help on this command
-V, --[no-]verbose Set the verbose level of output
-q, --quiet Silence commands
--config-file FILE Use this config file instead of default
--backtrace Show stack backtrace on errors
--debug Turn on Ruby debugging
Arguments:
packageversion display the package version
gemdir display the path where gems are installed
gempath display path used to search for gems
version display the gem format version
remotesources display the remote gem servers
display everything
Summary:
Display information about the RubyGems environment
Description:
The RubyGems environment can be controlled through command line arguments,
gemrc files, environment variables and built-in defaults.
Command line argument defaults and some RubyGems defaults can be set in
~/.gemrc file for individual users and a /etc/gemrc for all users. A gemrc
is a YAML file with the following YAML keys:
:sources: A YAML array of remote gem repositories to install gems from
:verbose: Verbosity of the gem command. false, true, and :really are the
levels
:update_sources: Enable/disable automatic updating of repository metadata
:backtrace: Print backtrace when RubyGems encounters an error
:bulk_threshold: Switch to a bulk update when this many sources are out of
date (legacy setting)
:gempath: The paths in which to look for gems
gem_command: A string containing arguments for the specified gem command
Example:
:verbose: false
install: --no-wrappers
update: --no-wrappers
RubyGems' default local repository can be overriden with the GEM_PATH and
GEM_HOME environment variables. GEM_HOME sets the default repository to
install into. GEM_PATH allows multiple local repositories to be searched
for
gems.
If you are behind a proxy server, RubyGems uses the HTTP_PROXY,
HTTP_PROXY_USER and HTTP_PROXY_PASS environment variables to discover the
proxy server.
If you are packaging RubyGems all of RubyGems' defaults are in
lib/rubygems/defaults.rb. You may override these in
lib/rubygems/defaults/operating_system.rb
Make life easy and install RVM. It will install whatever version of Ruby you want and let you switch between them and it doesn't require root access. It has many other killer features you will become addicted to after using it for a while.
I used #MartinCarpenter's solution to run a specific/particular/single test method with minitest. Where I normally add the test directory to the $LOAD_PATH with Rake::TestTask, e.g., t.libs << 'test', I was able to do it with the command line, like so:
RUBYLIB=test ruby test/user_test.rb --name test_create
I added test to $LOAD_PATH because user_test.rb calls require 'test_helper' to load lib/test_helper.rb.

Unable to find a tab completion for Rubygem in Bash/Zsh

I have not found a tab-completion script for RubyGem in Bash/Zsh.
Where can you get the tab-completion script for RubyGem in Bahs/Zsh?
Executable RubyGem commands are installed into /usr/bin or /usr/local/bin or whatever prefix Ruby is found under. Tab completion for commands should just work just like any other executable file in your PATH. If it's not working, verify that the directory RubyGems installs commands into is in your PATH.
There is currently no official method of doing tab completion for the parameters to any of these commands. If you need tab completion for a command installed via RubyGems, you'll need to write and/or install it yourself. See the Bash reference manual for details. There may already be a completion system for the specific command you're interested in, so be sure to google for it, but most commands installed via RubyGems do not have any auto-complete written for them.
Try:
http://github.com/oggy/ruby-bash-completion
To install it just copy gem file to /etc/bash_completion.d/
I had errors when trying to tab:
gem install
Because I didn't have some cache files in .gem directory. So I simply disabled it by editing gem file. I changed _gem_all_names function:
function _gem_all_names {
echo ""
}
That github-hosted bash completion is now part of Ubuntu Lucid Lynx. Sweet! If you apt-get install rubygems1.8 then the completion (commands and options!) should just work.
Unfortunately, as installed, it will only complete if it sees invocation of gem1.8, and not the more conventient gem. You can fix that manually if so inclined by extending the last line of /etc/bash_completion.d/gem1.8 to include gem as part of the complete name list. I'm sure there's a cleaner way, but that works.
This is (years) late, but as I was highly unsatisfied with the various completion scripts for gem that seem to be floating around the net, I decided to write my own based (somewhat) on the rather nice git completion script available in git-sh.
https://github.com/pdkl95/rubygems-completion

Resources