YARD CHEATSHEET http://yardoc.org
cribbed from http://pastebin.com/xgzeAmBn
Templates to remind you of the options and formatting for the different types of objects you might want to document using YARD.
| # encoding: utf-8 | |
| class TagSpec | |
| attr_reader :tag | |
| attr_accessor :result | |
| def initialize(tag) | |
| @tag = tag | |
| end | |
| def match?(tag_collection) |
| require "rvm/capistrano" # Load RVM's capistrano plugin. | |
| require "bundler/capistrano" | |
| set :rvm_ruby_string, '1.9.3' | |
| set :rvm_type, :user # Literal ":user" | |
| set :application, "blog_test" | |
| set :repository, "[email protected]:ryancheung/blog.git" | |
| set :scm, :git |
| #!/bin/sh | |
| set -e | |
| # Example init script, this can be used with nginx, too, | |
| # since nginx and unicorn accept the same signals | |
| # Feel free to change any of the following variables for your app: | |
| TIMEOUT=${TIMEOUT-60} | |
| APP_ROOT=$(pwd) | |
| PID=$APP_ROOT/tmp/pids/unicorn.pid | |
| CMD="bundle exec unicorn_rails -D -c $APP_ROOT/config/unicorn.rb" |
| # See http://unicorn.bogomips.org/Unicorn/Configurator.html for complete | |
| # documentation. | |
| # Use at least one worker per core if you're on a dedicated server, | |
| # more will usually help for _short_ waits on databases/caches. | |
| rails_env = ENV["RAILS_ENV"] || "development" | |
| RAILS_ROOT = File.expand_path("../../", __FILE__) | |
| if rails_env == "production" | |
| worker_processes 2 |
| # Resize selenium browser window to avoid Selenium::WebDriver::Error::MoveTargetOutOfBoundsError errors | |
| # | |
| # Example usage with Rspec (in spec/support/spec_helper.rb): | |
| # | |
| # config.before(:each) do | |
| # set_selenium_window_size(1250, 800) if Capybara.current_driver == :selenium | |
| # end | |
| # | |
| def set_selenium_window_size(width, height) | |
| window = Capybara.current_session.driver.browser.manage.window |
| =Navigating= | |
| visit('/projects') | |
| visit(post_comments_path(post)) | |
| =Clicking links and buttons= | |
| click_link('id-of-link') | |
| click_link('Link Text') | |
| click_button('Save') | |
| click('Link Text') # Click either a link or a button | |
| click('Button Value') |
| # http://stackoverflow.com/a/8936202 | |
| # | |
| # ActiveAdmin already includes the necessary jquery in active_admin/base, | |
| # so just add this to javascripts/active_admin.js after //= require active_admin/base | |
| # | |
| # | |
| # Serialize and Sort | |
| # | |
| # model_name - you guessed it, the name of the model we are calling sort on. | |
| # This is the actual variable name, no need to change it. |
| window.ActiveAdminSortableEvent = do -> | |
| eventToListeners = {} | |
| return { | |
| add: (event, callback) -> | |
| if not eventToListeners.hasOwnProperty(event) | |
| eventToListeners[event] = [] | |
| eventToListeners[event].push(callback) | |
| trigger: (event, args) -> |
cribbed from http://pastebin.com/xgzeAmBn
Templates to remind you of the options and formatting for the different types of objects you might want to document using YARD.
| require 'bundler/capistrano' | |
| set :application, "net" | |
| set :repository, "[email protected]:net.git" | |
| set :scm, :git | |
| set :default_environment, { | |
| 'PATH' => "$HOME/.rbenv/shims:$HOME/.rbenv/bin:$PATH" | |
| } |