Command Reference - RubyGems Guides What each gem command does, and how to use it. This reference was automatically generated from RubyGems version 2.5.1. gem build Build a gem from a gemspec Usage gem build GEMSPEC_FILE [options] Options: --force - skip validation of the spec 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 GEMSPEC_FILE - gemspec file name to build a gem for Description The build command allows you to create a gem from a ruby gemspec. The best way to build a gem is to use a Rakefile and the Gem::PackageTask which ships with RubyGems. The gemspec can either be created by hand or extracted from an existing gem with gem spec: $ gem unpack my_gem-1.0.gem Unpacked gem: '... gem cert Manage RubyGems certificates and signing settings gem cert [options] gem cert --build you@example or:
Ruby Gem Management with RVM and Bundler When I started learning Ruby, managing gems was a huge problem to the point I would make fun of it. Now I use RVM which helps you install multiple versions of ruby on one computer. Not only does it do that, but it makes gem management a breeze as well! Beyond RVM, Rails 3 provides us with bundler, which allows you to install gems based on a list of dependancies automatically. Very slick. Here I will outline how to install and configure RVM as well as manage your gems with RVM and the Rails 3 bundler. Installing RVM Install RVM by running this in terminal. Then drop this into your ~/.profile file. Run it with . ~/.profile in terminal. Installing Ruby 1.9.2 Use RVM to install the version of ruby you want. You can make double-sure by typing ruby -v and checking what version is currently loaded. Gem Management with RVM Now that we are up and running on ruby 1.9.2 lets talk about managing your gems. RVM has “gemsets” which allow you to organize different sets of gems. Create the global gemset.
Stream Parsing with REXML Hi (again, sort of) :) I am still on my quest to write a program that parses a large XML file. After having tried to do it in tree mode, I had to realize that the performance was simply abysmal. So back to the drawing board. But, and here is the thing...I could find a good straight-forward tutorial on how to write a stream parser using REXML. The official tutorial is pretty much mute on that part and the only other example I found (or rather was pointed to - was way too complex for someone like me who is still pretty much a beginner in ruby. So, what I am looking for is either a brief description of how to write an event driven parser or else a link to a good and simple tutorial. dusty (Guest) on 2008-01-12 19:56 I have found that hpricot works very well with large xml files. Bob Hutchison (Guest) on 2008-01-13 04:51 on 2008-01-13 06:26 on 2008-01-13 06:40 On Jan 12, 9:58 am, Marc Hoeppner <marc.hoepp... Thanks for the great responses!
jarmo/require_all Do YOU know Resque? Do YOU know Resque? This guest post is by Dave Hoover, who authored the book Apprenticeship Patterns: Guidance for the Aspiring Software Craftsman for O’Reilly, instigated the Software Craftsmanship North America conference, and is the Chief Craftsman at Obtiva. Dave began teaching himself to program in 2000, back when he was a family therapist. Dave lives near Chicago with his wife and three children. In his spare time, Dave competes in endurance sports. Web developers can sometimes forget the importance of doing as little work as possible during the HTTP request-response life-cycle. One nice thing about Resque is that it’s not dependant on Rails or any web framework. If I named this program idea_analyzer.rb and it was in my current working directory, I could run it like this: $ ruby idea_analyzer.rb I will learn ruby Analyzing your idea: I will learn ruby Asking for a job to analyze: I Asking for a job to analyze: will Asking for a job to analyze: learn Asking for a job to analyze: ruby
RubyBindings - selenium - Ruby bindings - Browser automation framework The Ruby bindings for Selenium/WebDriver are available as the selenium-webdriver gem. The web page explains how to install the selenium-webdriver gem. On Mac OSX and linux you may need to prefix the rest of the command with the sudo command if the installation fails because of security restrictions on your computer. There are many other Selenium gems out there, but this is the only official, maintained gem. The bindings support Ruby 1.9.2 through 2.0.0, JRuby and Rubinius. The gem also includes the older selenium-client gem for use with Selenium RC. Selenium::WebDriver - the WebDriver API Selenium::Client - Selenium RC API (previously released as the selenium-client gem) The WebDriver API is the successor to the Selenium RC API. For people who already have tests written against the Selenium RC API, it's possible to use WebDriver-backed Selenium to ease the migration. The bindings provide a slightly rubified version of the WebDriver API: require "selenium-webdriver" puts driver.title Chrome
rb is YAML for Ruby | Cookbook at the YamlForRuby site Welcome to the Yaml Cookbook for Ruby. This version of the Yaml Cookbook focuses on the Ruby implementation of Yaml by comparing Yaml documents with their Ruby counterparts. YAML(tm) is a readable text format for data structures. As you'll see below, YAML can handle many common data types and structures. You can learn more about YAML at YAML.org or the YAML WikiWiki. Simple Sequence Brief You can specify a list in YAML by placing each member of the list on a new line with an opening dash. Yaml Ruby Nested Sequences You can include a sequence within another sequence by giving the sequence an empty dash, followed by an indented list. Mixed Sequences Sequences can contain any YAML data, including strings and other sequences. Deeply Nested Sequences Sequences can be nested even deeper, with each level of indentation representing a level of depth. Simple Mapping Sequence in a Mapping A value in a mapping can be a sequence. Nested Mappings A value in a mapping can be another mapping.
Introduction to Rails Screencast Isn't it funny how most "introduction to Ruby on Rails" screencasts are overly simplistic, and rely on generators like scaffolding? The teacher typically follows up the tutorial by stating that most Rails developer don't use scaffolding generators. Well that's not much help then! Create models and generatorsUse test-driven development to plan and test an application’s featuresWork with ActiveRecordAutotest with Guard Use Rspec and Capybara to simulate the user.Create partialsTake advantage of Flash notices…and plenty more If you watched the entire screencast, I hope you enjoyed it!
Cucumber Introduction (comprehensive) Or: How I Learned to Stop Worrying and Love Testing Start Behaving Introduction Cucumber is a tool that implements a Behaviour Driven Design (BDD) workflow. This document deals principally with initial set up and first use of the Cucumber-Rails and Cucumber Rubygems. It takes as its background the Ruby on Rails (RoR) web application framework. Detailed discussion of Behaviour Driven (BDD), Test Driven (TDD), and Panic Driven Development (SNAFU aka Cowboy Coding) can be found elsewhere. You will find some familiarity with the Ruby language helpful and of the RoR framework somewhat less so. Details regarding installing the Cucumber Rubygem and its recommended support tools for RoR are found on this wiki under the heading Ruby on Rails. Note that in this document I often use the terms testing and test where BDD practitioners prefer the terms behaviour and expectation. Where to Start? Before anything else make sure that you have the cucumber-rails installed properly into your RoR project.
README - Mocha 0.13.3 Description A Ruby library for mocking and stubbing.A unified, simple and readable syntax for both full & partial mocking.Built-in support for MiniTest and Test::Unit.Supported by many other test frameworks. Installation Gem Install the latest version of the gem with the following command... $ gem install mocha Note: If you are intending to use Mocha with Test::Unit or MiniTest, you should only setup Mocha after loading the relevant test library... Test::Unit require 'rubygems'gem 'mocha'require 'test/unit'require 'mocha/test_unit' MiniTest require 'rubygems'gem 'mocha'require 'minitest/unit'require 'mocha/mini_test' Bundler If you're using Bundler, include Mocha in the Gemfile and then setup Mocha later once you know the test library has been loaded... gem "mocha" require "test/unit"require "mocha/test_unit" gem "mocha" require "minitest/unit"require "mocha/mini_test" Rails gem 'mocha' require 'mocha/mini_test' Rails Plugin Install the Rails plugin... require 'mocha/mini_test' Know Issues Usage Quick Start