code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
#!/usr/bin/env ruby
$:.unshift File.join(File.dirname(__FILE__), '..', '..')
# Copyright (C) 2007-2011 Martin A. Hansen.
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of t... | Ruby |
#!/usr/bin/env ruby
$:.unshift File.join(File.dirname(__FILE__), '..', '..')
# Copyright (C) 2007-2011 Martin A. Hansen.
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of t... | Ruby |
#!/usr/bin/env ruby
$:.unshift File.join(File.dirname(__FILE__), '..', '..')
# Copyright (C) 2007-2010 Martin A. Hansen.
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of t... | Ruby |
#!/usr/bin/env ruby
$:.unshift File.join(File.dirname(__FILE__), '..', '..')
# Copyright (C) 2007-2013 Martin A. Hansen.
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of t... | Ruby |
#!/usr/bin/env ruby
$:.unshift File.join(File.dirname(__FILE__), '..', '..')
# Copyright (C) 2007-2010 Martin A. Hansen.
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of t... | Ruby |
#!/usr/bin/env ruby
$:.unshift File.join(File.dirname(__FILE__), '..', '..')
# Copyright (C) 2007-2010 Martin A. Hansen.
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of t... | Ruby |
#!/usr/bin/env ruby
$:.unshift File.join(File.dirname(__FILE__), '..', '..')
# Copyright (C) 2011 Martin A. Hansen.
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the Li... | Ruby |
#!/usr/bin/env ruby
$:.unshift File.join(File.dirname(__FILE__), '..', '..')
# Copyright (C) 2007-2011 Martin A. Hansen.
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of t... | Ruby |
#!/usr/bin/env ruby
$:.unshift File.join(File.dirname(__FILE__), '..', '..')
# Copyright (C) 2011 Martin A. Hansen.
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the Li... | Ruby |
#!/usr/bin/env ruby
$:.unshift File.join(File.dirname(__FILE__), '..', '..')
# Copyright (C) 2011 Martin A. Hansen.
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the Li... | Ruby |
#!/usr/bin/env ruby
$:.unshift File.join(File.dirname(__FILE__), '..', '..')
# Copyright (C) 2011 Martin A. Hansen.
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the Li... | Ruby |
#!/usr/bin/env ruby
$:.unshift File.join(File.dirname(__FILE__), '..', '..')
# Copyright (C) 2011 Martin A. Hansen.
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the Li... | Ruby |
#!/usr/bin/env ruby
$:.unshift File.join(File.dirname(__FILE__), '..', '..')
# Copyright (C) 2007-2013 Martin A. Hansen.
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of t... | Ruby |
#!/usr/bin/env ruby
$:.unshift File.join(File.dirname(__FILE__), '..', '..')
# Copyright (C) 2011 Martin A. Hansen.
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the Li... | Ruby |
#!/usr/bin/env ruby
$:.unshift File.join(File.dirname(__FILE__), '..', '..')
# Copyright (C) 2007-2010 Martin A. Hansen.
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of t... | Ruby |
#!/usr/bin/env ruby
$:.unshift File.join(File.dirname(__FILE__), '..', '..')
# Copyright (C) 2007-2011 Martin A. Hansen.
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of t... | Ruby |
#!/usr/bin/env ruby
$:.unshift File.join(File.dirname(__FILE__), '..', '..')
# Copyright (C) 2011 Martin A. Hansen.
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the Li... | Ruby |
#!/usr/bin/env ruby
$:.unshift File.join(File.dirname(__FILE__), '..', '..')
# Copyright (C) 2013 Martin A. Hansen.
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the Li... | Ruby |
#!/usr/bin/env ruby
$:.unshift File.join(File.dirname(__FILE__), '..', '..')
# Copyright (C) 2013 Martin A. Hansen.
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the Li... | Ruby |
#!/usr/bin/env ruby
$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
# Copyright (C) 2012 Martin A. Hansen.
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of ... | Ruby |
#!/usr/bin/env ruby
$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
# Copyright (C) 2013 Martin A. Hansen.
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of ... | Ruby |
#!/usr/bin/env ruby
$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
# Copyright (C) 2013 Martin A. Hansen.
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of ... | Ruby |
#!/usr/bin/env ruby
$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
# Copyright (C) 2012 Martin A. Hansen.
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of ... | Ruby |
#!/usr/bin/env ruby
$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
# Copyright (C) 2013 Martin A. Hansen.
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of ... | Ruby |
#!/usr/bin/env ruby
$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
# Copyright (C) 2013 Martin A. Hansen.
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of ... | Ruby |
#!/usr/bin/env ruby
$:.unshift File.join(File.dirname(__FILE__), '..', '..')
# Copyright (C) 2007-2013 Martin A. Hansen.
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of t... | Ruby |
#!/usr/bin/env ruby
$:.unshift File.join(File.dirname(__FILE__), '..', '..')
# Copyright (C) 2007-2010 Martin A. Hansen.
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of t... | Ruby |
#!/usr/bin/env ruby
$:.unshift File.join(File.dirname(__FILE__), '..', '..')
# Copyright (C) 2011 Martin A. Hansen.
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the Li... | Ruby |
#!/usr/bin/env ruby
$:.unshift File.join(File.dirname(__FILE__), '..', '..')
# Copyright (C) 2013 Martin A. Hansen.
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the Li... | Ruby |
#!/usr/bin/env ruby
$:.unshift File.join(File.dirname(__FILE__), '..', '..')
# Copyright (C) 2013 Martin A. Hansen.
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the Li... | Ruby |
#!/usr/bin/env ruby
$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
require 'maasha/seq'
require 'test/unit'
require 'test/helper'
require 'pp'
class TestTrim < Test::Unit::TestCase
def setup
@entry = Seq.new
end
test "Seq.quality_trim with missing seq raises" do
@entry.qual = "hhhh"
... | Ruby |
#!/usr/bin/env ruby
$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
# Copyright (C) 2007-2011 Martin A. Hansen.
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
... | Ruby |
#!/usr/bin/env ruby
$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
# Copyright (C) 2007-2010 Martin A. Hansen.
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
... | Ruby |
#!/usr/bin/env ruby
$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
require 'maasha/seq/assemble'
require 'test/unit'
require 'test/helper'
require 'pp'
class TestAssemble < Test::Unit::TestCase
test "Assemble.pair without overlap returns nil" do
assert_nil(Assemble.pair(Seq.new(seq: "aaaa"), Se... | Ruby |
#!/usr/bin/env ruby
$:.unshift File.join(File.dirname(__FILE__), '..', '..')
# Copyright (C) 2013 Martin A. Hansen.
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the Li... | Ruby |
#!/usr/bin/env ruby
$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
# Copyright (C) 2007-2011 Martin A. Hansen.
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
... | Ruby |
#!/usr/bin/env ruby
$:.unshift File.join(File.dirname(__FILE__), '..', '..')
# Copyright (C) 2013 Martin A. Hansen.
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the Li... | Ruby |
#!/usr/bin/env ruby
$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
# Copyright (C) 2007-2011 Martin A. Hansen.
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
... | Ruby |
#!/usr/bin/env ruby
$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
# Copyright (C) 2007-2013 Martin A. Hansen.
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
... | Ruby |
#!/usr/bin/env ruby
$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
require 'maasha/seq'
require 'test/unit'
require 'test/helper'
require 'pp'
class TestTrim < Test::Unit::TestCase
def setup
@entry = Seq.new
end
test "Seq.quality_trim with missing seq raises" do
@entry.qual = "hhhh"
... | Ruby |
#!/usr/bin/env ruby
$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
require 'maasha/seq/assemble'
require 'test/unit'
require 'test/helper'
require 'pp'
class TestAssemble < Test::Unit::TestCase
test "Assemble.pair without overlap returns nil" do
assert_nil(Assemble.pair(Seq.new(seq: "aaaa"), Se... | Ruby |
#!/usr/bin/env ruby
$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
# Copyright (C) 2007-2010 Martin A. Hansen.
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
... | Ruby |
#!/usr/bin/env ruby
$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
# Copyright (C) 2007-2011 Martin A. Hansen.
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
... | Ruby |
#!/usr/bin/env ruby
$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
# Copyright (C) 2007-2013 Martin A. Hansen.
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
... | Ruby |
class Test::Unit::TestCase
def self.test(desc, &impl)
define_method("test #{desc}", &impl)
end
end
| Ruby |
#!/usr/bin/env ruby
# Copyright (C) 2011 Martin A. Hansen (mail@maasha.dk).
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later ver... | Ruby |
#!/usr/bin/env ruby
# Copyright (C) 2012 Martin A. Hansen (mail@maasha.dk).
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later ver... | Ruby |
#!/usr/bin/env ruby
# Copyright (C) 2011 Martin A. Hansen (mail@maasha.dk).
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later ver... | Ruby |
#!/usr/bin/env ruby
# Copyright (C) 2012 Martin A. Hansen (mail@maasha.dk).
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later ver... | Ruby |
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format
# (all these examples are active by default):
# ActiveSupport::Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', ... | Ruby |
require "#{Rails.root}/lib/fusion_tables_client_wrapper.rb" | Ruby |
# Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone
| Ruby |
# Be sure to restart your server when you modify this file.
# Your secret key for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attac... | Ruby |
# Be sure to restart your server when you modify this file.
Ftadmin::Application.config.session_store :cookie_store, :key => '_ftadmin_session'
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with "rake... | Ruby |
# A Site key gives additional protection against a dictionary attack if your
# DB is ever compromised. With no site key, we store
# DB_password = hash(user_password, DB_user_salt)
# If your database were to be compromised you'd be vulnerable to a dictionary
# attack on all your stupid users' passwords. With a site... | Ruby |
# Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
# You can also remove all the silencers if you're trying to debug a probl... | Ruby |
require "bundler/capistrano"
set :application, "bioblitz"
set :repository, "http://bioblitz.googlecode.com/svn/trunk/ftadmin"
set :scm, :subversion
default_run_options[:pty] = true
role :app, "178.79.142.149"
set :keep_releases, 5
set :user, 'ubuntu'
set :deploy_to, "/home/ubuntu/www/#{application}"
desc "Restart... | Ruby |
Ftadmin::Application.configure do
# Settings specified here will take precedence over those in config/environment.rb
# The production environment is meant for finished, "live" apps.
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on... | Ruby |
Ftadmin::Application.configure do
# Settings specified here will take precedence over those in config/environment.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the webse... | Ruby |
Ftadmin::Application.configure do
# Settings specified here will take precedence over those in config/environment.rb
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test ... | Ruby |
# Load the rails application
require File.expand_path('../application', __FILE__)
# Initialize the rails application
Ftadmin::Application.initialize!
| Ruby |
require 'rubygems'
# Set up gems listed in the Gemfile.
gemfile = File.expand_path('../../Gemfile', __FILE__)
begin
ENV['BUNDLE_GEMFILE'] = gemfile
require 'bundler'
Bundler.setup
rescue Bundler::GemNotFound => e
STDERR.puts e.message
STDERR.puts "Try running `bundle install`."
exit!
end if File.exist?(gem... | Ruby |
require File.expand_path('../boot', __FILE__)
require 'rails/all'
# If you have a Gemfile, require the gems listed there, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env) if defined?(Bundler)
module Ftadmin
class Application < Rails::Application
... | Ruby |
Ftadmin::Application.routes.draw do |map|
root :to =>'web#show'
resources :users
resource :session, :only => [:create, :destroy]
match 'auth' => 'users#new', :as => :auth
match 'register' => 'users#create', :as => :register
match 'logout' => 'sessions#destroy', :as => :logout
namespace :api do
get... | Ruby |
Autotest.add_discovery { "rails" }
Autotest.add_discovery { "rspec2" }
| Ruby |
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
load 'config/deploy' # remove this line to skip loading any of the default tasks | Ruby |
module ApplicationHelper
end
| Ruby |
module UsersHelper
#
# Use this to wrap view elements that the user can't access.
# !! Note: this is an *interface*, not *security* feature !!
# You need to do all access control at the controller level.
#
# Example:
# <%= if_authorized?(:index, User) do link_to('List all users', users_path) end %> ... | Ruby |
module WebHelper
end
| Ruby |
module MainHelper
end
| Ruby |
module VisualizationHelper
end
| Ruby |
module SessionsHelper
end | Ruby |
module TaxonomizerHelper
end
| Ruby |
class Identification < FusionTablesClientWrapper
table_name 'Bioblitz2010Identifications'
field :observationRowId
field :scientificName
field :identificationTime
field :author
field :application
field :colId
field :colLsid
field :kingdom
field :phylum
field :class
field :order
field :fam... | Ruby |
class Occurrence < FusionTablesClientWrapper
table_name 'occurrences_clone'
field :row_ID
field :event_ID
field :scientificName
field :vernacular_name
field :taxonConceptID
field :occurrenceRemarks
field :individualCount
field :sex
field :lifeStage
field :reproductiveCondition
field :behaviour... | Ruby |
require 'digest/sha1'
class User < ActiveRecord::Base
include Authentication
include Authentication::ByPassword
include Authentication::ByCookieToken
set_table_name 'users'
validates :name, :format => { :with => Authentication.name_regex, :message => Authentication.bad_name_message },
... | Ruby |
class FlickertaggerController < ApplicationController
layout false
def show
end
end
| Ruby |
class WebController < ApplicationController
layout false
def show
end
end
| Ruby |
class TaxonomizerController < ApplicationController
before_filter :login_required
layout false
def show
end
end
| Ruby |
# This controller handles the login/logout function of the site.
class SessionsController < ApplicationController
def create
logout_keeping_session!
@user = User.authenticate(params[:email], params[:password])
if @user
# Protects against session fixation attacks, causes request forgery
# prot... | Ruby |
class MainController < ApplicationController
def show
end
end
| Ruby |
class Api::TaxonomyController < ApplicationController
def index
conn = PGconn.connect( :dbname => 'col',:user=>'postgres' )
limit = (params[:limit])?params[:limit]:3
if(params[:query])
result =conn.exec("select id,lsid,k,c,o,p,f,id_col,g,s from taxonomy where s like '#{escape_sql(params[:... | Ruby |
class Api::ProxyController < ApplicationController
def show
render :text => Net::HTTP.get(URI.parse(params[:url]))
end
end | Ruby |
class Api::IdentificationsController < ApplicationController
#Provide an identification
def update
Identification.create_and_update_occurrences(params, session[:location])
respond_to do |format|
format.json { render :json => 'ok'.to_json }
end
end
end | Ruby |
require 'zip/zipfilesystem'
class Api::DwcArchiveController < ApplicationController
def new
tmp_file_name = "dwca_#{randomFileNameSuffix(7)}"
open("#{Rails.root}/tmp/#{tmp_file_name}.zip", "wb") { |file|
file.write(Net::HTTP.get(URI.parse(params[:url])))
}
unzip("#{... | Ruby |
class ApplicationController < ActionController::Base
protect_from_forgery
layout 'application'
include AuthenticatedSystem
before_filter :get_location_from_ip
def show
end
protected
def get_location_from_ip
unless session[:location].present?
begin
user_location = get_i... | Ruby |
class UsersController < ApplicationController
layout false
def new
@user = User.new
end
def create
logout_keeping_session!
@user = User.new(params[:user])
success = @user && @user.save
if success && @user.errors.empty?
# Protects against session fixation attacks, causes reques... | Ruby |
class VisualizationController < ApplicationController
layout false
def index
end
end
| Ruby |
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
require 'rake'
Ftadmin::Application.load_tasks
| Ruby |
#!/usr/bin/env ruby
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
APP_PATH = File.expand_path('../../config/application', __FILE__)
require File.expand_path('../../config/boot', __FILE__)
require 'rails/commands'
| Ruby |
#!/usr/bin/env ruby
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
APP_PATH = File.expand_path('../../config/application', __FILE__)
require File.expand_path('../../config/boot', __FILE__)
require 'rails/commands'
| Ruby |
source 'http://rubygems.org'
gem 'rails', '3.0.0'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3-ruby', :require => 'sqlite3'
# Use unicorn as the web server
# gem 'unicorn'
# Bundle the extra gems:
# gem 'bj'
# gem 'nokogiri'
# gem 'sqlite3-ruby', :require => '... | Ruby |
class CreateUsers < ActiveRecord::Migration
def self.up
create_table "users" do |t|
t.column :name, :string, :limit => 100, :default => '', :null => true
t.column :email, :string, :limit => 100
t.column :crypted_password, :string, :limit => 40
... | Ruby |
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
# Mayor.create(:name =>... | Ruby |
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.jo... | Ruby |
module Factories
def create_user(attrs = {})
attrs[:name] ||= 'Darwin'
attrs[:email] ||= 'charles.darwin@bioblizt.com'
attrs[:password] ||= 'secret'
attrs[:password_confirmation] ||= 'secret'
User.create!(attrs)
end
end
RSpec.configure {|config| con... | Ruby |
require 'spec_helper'
describe Api::IdentificationsController do
include RSpec::Rails::ControllerExampleGroup
before do
request.env["HTTP_ACCEPT"] = 'application/json'
end
it "should add a new identification with taxonomer ip geo-location" do
assert_difference "Identification.all.length", 1 do
... | Ruby |
module HelperMethods
def peich
save_and_open_page
end
def enable_javascript
Capybara.current_driver = :selenium
end
def darwin
User.where('name' => 'Darwin').first || create_user
end
def login_as(user)
fill_in('email', :with => user.email)
fill_in('password', :with => user.pas... | Ruby |
module NavigationHelpers
# Put here the helper methods related to the paths of your applications
def homepage
"/"
end
def taxonomizer
"/taxonomizer"
end
end
Rspec.configuration.include(NavigationHelpers)
| Ruby |
require File.dirname(__FILE__) + "/../spec_helper"
require "steak"
require 'capybara/rails'
Capybara.default_driver = :selenium
Capybara.default_selector = :css
Capybara.default_wait_time = 5
DatabaseCleaner.strategy = :truncation
RSpec.configure do |config|
config.include Capybara
config.before(:each) do
... | Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.