Unverified Commit 6b681650 by Andrew W. Lee Committed by GitHub

Remove unworking integration tests (#725)

`spec/integration` contains a lot of files that were used for integration tests. They stopped were [disabled in 2014](https://github.com/ctran/annotate_models/commit/9540121243da58cad3ab3c0ba444f22445a995ed#diff-78ddf877ecc2a9344997ef077a77955a) and haven't been working since. Removing because those tests don't run, don't work, and are outdated. The plan is to re-introduce integration tests sometime in the future.
parent 407ace64
##
# Usage:
#
# # build the image
# docker build -t annotate-docker .
#
# # run a bash login shell in a container running that image
# docker run -it annotate-docker bash -l
#
# References:
# https://github.com/ms-ati/docker-rvm/blob/master/Dockerfile
# https://hub.docker.com/r/instructure/rvm/dockerfile
##
FROM ubuntu:18.04
ARG RVM_USER=docker
# RVM version to install
ARG RVM_VERSION=stable
# Directorry path
ARG PROJECT_PATH=/annotate_models
# Install RVM
RUN apt-get update \
&& apt-get install -y \
curl \
git \
gnupg2 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/
RUN addgroup --gid 9999 ${RVM_USER} \
&& adduser --uid 9999 --gid 9999 --disabled-password --gecos "Docker User" ${RVM_USER} \
&& usermod -L ${RVM_USER}
# No ipv6 support in container (https://github.com/inversepath/usbarmory-debian-base_image/issues/)
RUN mkdir ~/.gnupg && echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf
# https://superuser.com/questions/954509/what-are-the-correct-permissions-for-the-gnupg-enclosing-folder-gpg-warning
RUN chmod 700 ~/.gnupg && chmod 600 ~/.gnupg/*
# Install + verify RVM with gpg (https://rvm.io/rvm/security)
RUN gpg2 --quiet --no-tty --logger-fd 1 --keyserver hkp://keys.gnupg.net \
--recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 \
7D2BAF1CF37B13E2069D6956105BD0E739499BDB \
&& echo 409B6B1796C275462A1703113804BB82D39DC0E3:6: | \
gpg2 --quiet --no-tty --logger-fd 1 --import-ownertrust \
&& curl -sSO https://raw.githubusercontent.com/rvm/rvm/${RVM_VERSION}/binscripts/rvm-installer \
&& curl -sSO https://raw.githubusercontent.com/rvm/rvm/${RVM_VERSION}/binscripts/rvm-installer.asc \
&& gpg2 --quiet --no-tty --logger-fd 1 --verify rvm-installer.asc \
&& bash rvm-installer ${RVM_VERSION} \
&& rm rvm-installer rvm-installer.asc \
&& echo "bundler" >> /usr/local/rvm/gemsets/global.gems \
&& echo "rvm_silence_path_mismatch_check_flag=1" >> /etc/rvmrc \
&& echo "install: --no-document" > /etc/gemrc
# Workaround tty check, see https://github.com/hashicorp/vagrant/issues/1673#issuecomment-26650102
RUN sed -i 's/^mesg n/tty -s \&\& mesg n/g' /root/.profile
# Switch to a bash login shell to allow simple 'rvm' in RUN commands
SHELL ["/bin/bash", "-l", "-c"]
RUN rvm group add rvm "${RVM_USER}"
# Create project directory and copy path
RUN mkdir -p /${PROJECT_PATH} && chown ${RVM_USER}:${RVM_USER} /${PROJECT_PATH}
COPY . /${PROJECT_PATH}
# Switch to user
USER ${RVM_USER}
RUN echo ". /etc/profile.d/rvm.sh" >> ~/.bashrc
WORKDIR ${PROJECT_PATH}
module Annotate
module Validations
module Common
def self.test_commands
'bin/annotate && bin/annotate --routes'
end
def self.verify_output(output)
output.should =~ /Annotated \(1\): Task/
output.should =~ /Route file annotated./
end
def self.verify_files(which_files, test_rig, schema_annotation, routes_annotation, place_before = true)
check_task_model(test_rig, schema_annotation, place_before) if which_files[:model]
check_task_unittest(test_rig, schema_annotation, place_before) if which_files[:test]
check_task_fixture(test_rig, schema_annotation, place_before) if which_files[:fixture]
check_task_factory(test_rig, schema_annotation, place_before) if which_files[:factory]
check_routes(test_rig, routes_annotation, place_before) if which_files[:routes]
end
def self.check_task_model(test_rig, annotation, place_before = true)
model = apply_annotation(test_rig, 'app/models/task.rb', annotation, place_before)
File.read('app/models/task.rb').should == model
end
def self.check_routes(test_rig, annotation, place_before = true)
routes = apply_annotation(test_rig, 'config/routes.rb', annotation, place_before)
File.read('config/routes.rb')
.sub(/\d{4}-\d{2}-\d{2} \d{2}:\d{2}/, 'YYYY-MM-DD HH:MM')
.should == routes
end
def self.check_task_unittest(test_rig, annotation, place_before = true)
unittest = apply_annotation(test_rig, 'test/unit/task_test.rb', annotation, place_before)
File.read('test/unit/task_test.rb').should == unittest
end
def self.check_task_modeltest(test_rig, annotation, place_before=true)
unittest = apply_annotation(test_rig, 'test/models/task_test.rb', annotation, place_before)
File.read('test/models/task_test.rb').should == unittest
end
def self.check_task_factory(test_rig, annotation, place_before=true)
fixture = apply_annotation(test_rig, 'test/factories/tasks.rb', annotation, place_before)
File.read('test/factories/tasks.rb').should == fixture
end
def self.check_task_fixture(test_rig, annotation, place_before = true)
fixture = apply_annotation(test_rig, 'test/fixtures/tasks.yml', annotation, place_before)
File.read('test/fixtures/tasks.yml').should == fixture
end
def self.apply_annotation(test_rig, fname, annotation, place_before = true)
corpus = File.read(File.join(test_rig, fname))
if place_before
annotation + "\n" + corpus
else
corpus + "\n" + annotation
end
end
end
end
end
module Annotate
module Validations
class Base
def self.test_commands
Annotate::Validations::Common.test_commands
end
def self.verify_output(output)
Annotate::Validations::Common.verify_output(output)
end
def self.verify_files(test_rig)
Annotate::Validations::Common.verify_files(
{
model: true,
test: true,
fixture: true,
factory: false,
routes: true
}, test_rig, schema_annotation, route_annotation, true
)
end
def self.foo
require 'pry'
require 'pry-coolline'
end
end
end
end
# Smoke test to assure basic functionality works on a variety of Rails versions.
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'spec_helper'
require 'files'
require 'wrong'
require 'rake'
include Files
include Wrong::D
BASEDIR = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
RVM_BIN = `which rvm`.chomp
USING_RVM = (RVM_BIN != '')
CURRENT_RUBY = `rvm-prompt i v p 2>/dev/null`.chomp
ENV['rvm_pretty_print_flag'] = '0'
ENV['BUNDLE_GEMFILE'] = './Gemfile'
describe "annotate inside Rails, using #{CURRENT_RUBY}" do
chosen_scenario = nil
unless ENV['SCENARIO'].blank?
chosen_scenario = File.expand_path(ENV['SCENARIO'])
raise "Can't find specified scenario '#{chosen_scenario}'!" unless File.directory?(chosen_scenario)
end
Annotate::Integration::SCENARIOS.each do |test_rig, base_dir, test_name|
next if chosen_scenario && chosen_scenario != test_rig
it "works under #{test_name}" do
unless USING_RVM
skip 'Must have RVM installed.'
next
end
# Don't proceed if the working copy is dirty!
expect(Annotate::Integration.clean?(test_rig)).to eq(true)
skip 'temporarily ignored until Travis can run them'
Bundler.with_clean_env do
dir base_dir do
temp_dir = Dir.pwd
expect(File.basename(temp_dir)).to eq(base_dir)
# Delete cruft from hands-on debugging...
Annotate::Integration.nuke_cruft(test_rig)
# Copy everything to our test directory...
exclusions = ["#{test_rig}/.", "#{test_rig}/.."]
files = (FileList["#{test_rig}/*", "#{test_rig}/.*"] - exclusions).to_a
# We want to NOT preserve symlinks during this copy...
system("rsync -aL #{files.shelljoin} #{temp_dir.shellescape}")
# By default, rvm_ruby_string isn't inherited over properly, so let's
# make sure it's there so our .rvmrc will work.
ENV['rvm_ruby_string'] = CURRENT_RUBY
require base_dir.to_s # Will get "#{base_dir}.rb"...
klass = "Annotate::Validations::#{base_dir.tr('.', '_').classify}".constantize
Dir.chdir(temp_dir) do
# bash is required by rvm
# the shopt command forces us out of "strict sh" mode
commands = <<-BASH
export AUTOMATED_TEST="#{BASEDIR}";
shopt -u -o posix;
source .rvmrc &&
(bundle check || bundle install) &&
#{klass.test_commands}
BASH
output = `/usr/bin/env bash -c '#{commands}' 2>&1`.chomp
klass.verify_output(output)
klass.verify_files(test_rig)
end
end
end
end
end
end
require 'common_validation'
module Annotate
module Validations
class Rails23WithBundler < Base
def self.schema_annotation
<<-RUBY
# == Schema Information
#
# Table name: tasks
#
# id :integer not null, primary key
# content :string(255)
# created_at :datetime
# updated_at :datetime
#
RUBY
end
def self.route_annotation
<<-RUBY
# == Route Map (Updated YYYY-MM-DD HH:MM)
#
# tasks GET /tasks(.:format) {:controller=>"tasks", :action=>"index"}
# POST /tasks(.:format) {:controller=>"tasks", :action=>"create"}
# new_task GET /tasks/new(.:format) {:controller=>"tasks", :action=>"new"}
# edit_task GET /tasks/:id/edit(.:format) {:controller=>"tasks", :action=>"edit"}
# task GET /tasks/:id(.:format) {:controller=>"tasks", :action=>"show"}
# PUT /tasks/:id(.:format) {:controller=>"tasks", :action=>"update"}
# DELETE /tasks/:id(.:format) {:controller=>"tasks", :action=>"destroy"}
#
RUBY
end
end
end
end
../../fixtures/rvmrc.sh
\ No newline at end of file
# This file is a hybrid file meant for live debugging without going through an
# actual RSpec run, and for being used in an RSpec run. To change it, change
# template.Gemfile and run 'rake templates:rebuild' which will do so for all
# templates in all build scenarios.
#
# ALSO, be sure NOT to commit any changes that happen in app/* or config/*
# when debugging this way as that will defeat the point of the automated tests!
#
# In fact, before running RSpec again after manual testing, you should run
# 'rake integration:clober' to reset modified files to their pristine state,
# and remove cruft that may interfere with the build.
source 'https://rubygems.org'
gem 'bundler'
gem 'rake', '~>0.8.7', :require => false
gem 'rails', '~>2.3.14'
gem 'sqlite3'
group :development do
if(ENV['AUTOMATED_TEST'] && ENV['AUTOMATED_TEST'] != '')
gem 'annotate', :path => ENV['AUTOMATED_TEST']
else
gem 'annotate', :path => '../../..'
end
end
PATH
remote: ../../..
specs:
annotate (2.5.0)
activerecord
rake
GEM
remote: https://rubygems.org/
specs:
actionmailer (2.3.14)
actionpack (= 2.3.14)
actionpack (2.3.14)
activesupport (= 2.3.14)
rack (~> 1.1.0)
activerecord (2.3.14)
activesupport (= 2.3.14)
activeresource (2.3.14)
activesupport (= 2.3.14)
activesupport (2.3.14)
rack (1.1.3)
rails (2.3.14)
actionmailer (= 2.3.14)
actionpack (= 2.3.14)
activerecord (= 2.3.14)
activeresource (= 2.3.14)
activesupport (= 2.3.14)
rake (>= 0.8.3)
rake (0.8.7)
sqlite3 (1.3.5)
PLATFORMS
ruby
DEPENDENCIES
annotate!
bundler
rails (~> 2.3.14)
rake (~> 0.8.7)
sqlite3
# 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.join(File.dirname(__FILE__), 'config', 'boot'))
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'tasks/rails'
# Don't change this file!
# Configure your app in config/environment.rb and config/environments/*.rb
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
module Rails
class << self
def boot!
unless booted?
preinitialize
pick_boot.run
end
end
def booted?
defined? Rails::Initializer
end
def pick_boot
(vendor_rails? ? VendorBoot : GemBoot).new
end
def vendor_rails?
File.exist?("#{RAILS_ROOT}/vendor/rails")
end
def preinitialize
load(preinitializer_path) if File.exist?(preinitializer_path)
end
def preinitializer_path
"#{RAILS_ROOT}/config/preinitializer.rb"
end
end
class Boot
def run
load_initializer
Rails::Initializer.run(:set_load_path)
end
end
class VendorBoot < Boot
def load_initializer
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
Rails::Initializer.run(:install_gem_spec_stubs)
Rails::GemDependency.add_frozen_gem_path
end
end
class GemBoot < Boot
def load_initializer
self.class.load_rubygems
load_rails_gem
require 'initializer'
end
def load_rails_gem
if version = self.class.gem_version
gem 'rails', version
else
gem 'rails'
end
rescue Gem::LoadError => e
if e.message =~ /Could not find RubyGem rails/
$stderr.puts "Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed."
exit 1
else
raise
end
end
class << self
def rubygems_version
Gem::RubyGemsVersion rescue nil
end
def gem_version
if defined? RAILS_GEM_VERSION
RAILS_GEM_VERSION
elsif ENV.include?('RAILS_GEM_VERSION')
ENV['RAILS_GEM_VERSION']
else
parse_gem_version(read_environment_rb)
end
end
def load_rubygems
min_version = '1.3.2'
require 'rubygems'
unless rubygems_version >= min_version
$stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
exit 1
end
rescue LoadError
$stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
exit 1
end
def parse_gem_version(text)
$1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
end
private
def read_environment_rb
File.read("#{RAILS_ROOT}/config/environment.rb")
end
end
end
end
# All that for this:
class Rails::Boot
def run
load_initializer
Rails::Initializer.class_eval do
def load_gems
@bundler_loaded ||= Bundler.require :default, Rails.env
end
end
Rails::Initializer.run(:set_load_path)
end
end
Rails.boot!
# SQLite version 3.x
# gem install sqlite3-ruby (not necessary on OS X Leopard)
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 1
timeout: 5000
test:
adapter: sqlite3
database: db/test.sqlite3
pool: 1
timeout: 5000
# Be sure to restart your server when you modify this file
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.3.14' unless defined? RAILS_GEM_VERSION
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
Rails::Initializer.run do |config|
config.frameworks -= [ :active_resource, :action_mailer ]
end
config.cache_classes = false
config.whiny_nils = true
config.action_controller.consider_all_requests_local = true
config.action_controller.perform_caching = false
config.action_view.debug_rjs = true
config.action_mailer.raise_delivery_errors = false
config.cache_classes = true
config.whiny_nils = true
config.action_controller.consider_all_requests_local = true
config.action_controller.perform_caching = false
config.action_controller.allow_forgery_protection = false
config.action_view.cache_template_loading = true
config.action_mailer.delivery_method = :test
# new_rails_defaults.rb
if defined?(ActiveRecord)
ActiveRecord::Base.include_root_in_json = true
ActiveRecord::Base.store_full_sti_class = true
end
ActionController::Routing.generate_best_match = false
ActiveSupport.use_standard_json_time_format = true
ActiveSupport.escape_html_entities_in_json = false
# session_store.rb
ActionController::Base.session = {
:key => '_session',
:secret => 'a61ce930be7219beee70d3e3411e0794d90ab22d12e87a1f7f50c98ad7b08771ed92e72e1a7299c8ec4795d45d566a39e0a0a1f7e7095e2eeb31320a0c5d7ee5'
}
# cookie_verification_secret.rb
ActionController::Base.cookie_verifier_secret = '1b2363a161fbf01041bd9d0b0d9a332e5c7445503c9e89585c8a248698d28054e3918fa77a0206e662629ee9a00d2831949e74801f27ee85ba2116b62b675935';
# Hacks for Ruby 1.9.3...
MissingSourceFile::REGEXPS << [/^cannot load such file -- (.+)$/i, 1]
ActionController::Routing::Routes.draw do |map|
map.resources :tasks
end
class CreateTasks < ActiveRecord::Migration
def self.up
create_table :tasks do |t|
t.string :content
t.timestamps
end
end
def self.down
drop_table :tasks
end
end
# This file is auto-generated from the current state of the database. Instead of editing this file,
# please use the migrations feature of Active Record to incrementally modify your database, and
# then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your database schema. If you need
# to create the application database on another system, you should be using db:schema:load, not running
# all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20120816085200) do
create_table "tasks", :force => true do |t|
t.string "content"
t.datetime "created_at"
t.datetime "updated_at"
end
end
#!/usr/bin/env ruby
require File.expand_path('../../config/boot', __FILE__)
require 'commands/console'
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
one:
content: MyString
two:
content: MyString
ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'test_help'
class ActiveSupport::TestCase
end
require 'test_helper'
class TaskTest < ActiveSupport::TestCase
# Replace this with your real tests.
test "the truth" do
assert true
end
end
require 'common_validation'
module Annotate
module Validations
class Rails322 < Base
def self.schema_annotation
<<-RUBY
# == Schema Information
#
# Table name: tasks
#
# id :integer not null, primary key
# content :string(255)
# created_at :datetime not null
# updated_at :datetime not null
#
RUBY
end
def self.route_annotation
<<-RUBY
# == Route Map (Updated YYYY-MM-DD HH:MM)
#
# tasks GET /tasks(.:format) tasks#index
# POST /tasks(.:format) tasks#create
# new_task GET /tasks/new(.:format) tasks#new
# edit_task GET /tasks/:id/edit(.:format) tasks#edit
# task GET /tasks/:id(.:format) tasks#show
# PUT /tasks/:id(.:format) tasks#update
# DELETE /tasks/:id(.:format) tasks#destroy
#
RUBY
end
end
end
end
../../fixtures/rvmrc.sh
\ No newline at end of file
# This file is a hybrid file meant for live debugging without going through an
# actual RSpec run, and for being used in an RSpec run. To change it, change
# template.Gemfile and run 'rake templates:rebuild' which will do so for all
# templates in all build scenarios.
#
# ALSO, be sure NOT to commit any changes that happen in app/* or config/*
# when debugging this way as that will defeat the point of the automated tests!
#
# In fact, before running RSpec again after manual testing, you should run
# 'rake integration:clober' to reset modified files to their pristine state,
# and remove cruft that may interfere with the build.
source 'https://rubygems.org'
gem 'rails', '3.2.2'
gem 'sqlite3'
group :development do
if(ENV['AUTOMATED_TEST'] && ENV['AUTOMATED_TEST'] != '')
gem 'annotate', :path => ENV['AUTOMATED_TEST']
else
gem 'annotate', :path => '../../..'
end
end
PATH
remote: ../../..
specs:
annotate (2.5.0)
activerecord
rake
GEM
remote: https://rubygems.org/
specs:
actionmailer (3.2.2)
actionpack (= 3.2.2)
mail (~> 2.4.0)
actionpack (3.2.2)
activemodel (= 3.2.2)
activesupport (= 3.2.2)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.1)
rack (~> 1.4.0)
rack-cache (~> 1.1)
rack-test (~> 0.6.1)
sprockets (~> 2.1.2)
activemodel (3.2.2)
activesupport (= 3.2.2)
builder (~> 3.0.0)
activerecord (3.2.2)
activemodel (= 3.2.2)
activesupport (= 3.2.2)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activeresource (3.2.2)
activemodel (= 3.2.2)
activesupport (= 3.2.2)
activesupport (3.2.2)
i18n (~> 0.6)
multi_json (~> 1.0)
arel (3.0.2)
builder (3.0.0)
erubis (2.7.0)
hike (1.2.1)
i18n (0.6.0)
journey (1.0.4)
json (1.7.4)
mail (2.4.4)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.19)
multi_json (1.3.6)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2)
rack (>= 0.4)
rack-ssl (1.3.2)
rack
rack-test (0.6.1)
rack (>= 1.0)
rails (3.2.2)
actionmailer (= 3.2.2)
actionpack (= 3.2.2)
activerecord (= 3.2.2)
activeresource (= 3.2.2)
activesupport (= 3.2.2)
bundler (~> 1.0)
railties (= 3.2.2)
railties (3.2.2)
actionpack (= 3.2.2)
activesupport (= 3.2.2)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (~> 0.14.6)
rake (0.9.2.2)
rdoc (3.12)
json (~> 1.4)
sprockets (2.1.3)
hike (~> 1.2)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.6)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.33)
PLATFORMS
ruby
DEPENDENCIES
annotate!
rails (= 3.2.2)
sqlite3
../../fixtures/rails_32_rakefile
\ No newline at end of file
../../../fixtures/rails_32old_application.rb
\ No newline at end of file
../../../fixtures/rails32_boot.rb
\ No newline at end of file
../../../fixtures/database.yml
\ No newline at end of file
../../../fixtures/rails_32_environment.rb
\ No newline at end of file
../../../../fixtures/rails_32_development.rb
\ No newline at end of file
../../../../fixtures/rails_32_test.rb
\ No newline at end of file
../../../../fixtures/rails32_unified_initializer.rb
\ No newline at end of file
TestApp::Application.routes.draw do
resources :tasks
end
../../../../fixtures/20120816164927_create_tasks.rb
\ No newline at end of file
../../../fixtures/rails_32_schema.rb
\ No newline at end of file
../../../fixtures/rails_32_rails
\ No newline at end of file
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
one:
content: MyString
two:
content: MyString
../../../fixtures/rails_32_test_helper.rb
\ No newline at end of file
require 'test_helper'
class TaskTest < ActiveSupport::TestCase
# Replace this with your real tests.
test "the truth" do
assert true
end
end
require 'common_validation'
module Annotate
module Validations
class Rails328 < Base
def self.schema_annotation
<<-RUBY
# == Schema Information
#
# Table name: tasks
#
# id :integer not null, primary key
# content :string(255)
# created_at :datetime not null
# updated_at :datetime not null
#
RUBY
end
def self.route_annotation
<<-RUBY
# == Route Map (Updated YYYY-MM-DD HH:MM)
#
# tasks GET /tasks(.:format) tasks#index
# POST /tasks(.:format) tasks#create
# new_task GET /tasks/new(.:format) tasks#new
# edit_task GET /tasks/:id/edit(.:format) tasks#edit
# task GET /tasks/:id(.:format) tasks#show
# PUT /tasks/:id(.:format) tasks#update
# DELETE /tasks/:id(.:format) tasks#destroy
#
RUBY
end
end
end
end
../../fixtures/rvmrc.sh
\ No newline at end of file
../../fixtures/rails_328_gemfile
\ No newline at end of file
../../fixtures/rails_328_gemfile.lock
\ No newline at end of file
../../fixtures/rails_32_rakefile
\ No newline at end of file
class Task < ActiveRecord::Base
attr_accessible :content
end
require File.expand_path('../boot', __FILE__)
require "active_record/railtie"
require "rails/test_unit/railtie"
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require(*Rails.groups(:assets => %w(development test)))
end
module TestApp
class Application < Rails::Application
config.active_record.whitelist_attributes = true
config.active_support.escape_html_entities_in_json = true
config.assets.enabled = false
end
end
../../../fixtures/rails32_boot.rb
\ No newline at end of file
../../../fixtures/database.yml
\ No newline at end of file
../../../fixtures/rails_32_environment.rb
\ No newline at end of file
../../../../fixtures/rails_32_development.rb
\ No newline at end of file
../../../../fixtures/rails_32_test.rb
\ No newline at end of file
../../../../fixtures/rails32_unified_initializer.rb
\ No newline at end of file
TestApp::Application.routes.draw do
resources :tasks
end
../../../../fixtures/20120816164927_create_tasks.rb
\ No newline at end of file
../../../fixtures/rails_32_schema.rb
\ No newline at end of file
../../../fixtures/rails_32_rails
\ No newline at end of file
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
one:
content: MyString
two:
content: MyString
../../../fixtures/rails_32_test_helper.rb
\ No newline at end of file
require 'test_helper'
class TaskTest < ActiveSupport::TestCase
# Replace this with your real tests.
test "the truth" do
assert true
end
end
require 'common_validation'
module Annotate
module Validations
class Rails32AutoloadingFactoryGirl < Base
def self.schema_annotation
<<-RUBY
# == Schema Information
#
# Table name: tasks
#
# id :integer not null, primary key
# content :string(255)
# created_at :datetime not null
# updated_at :datetime not null
#
RUBY
end
def self.route_annotation
<<-RUBY
# == Route Map (Updated YYYY-MM-DD HH:MM)
#
# tasks GET /tasks(.:format) tasks#index
# POST /tasks(.:format) tasks#create
# new_task GET /tasks/new(.:format) tasks#new
# edit_task GET /tasks/:id/edit(.:format) tasks#edit
# task GET /tasks/:id(.:format) tasks#show
# PUT /tasks/:id(.:format) tasks#update
# DELETE /tasks/:id(.:format) tasks#destroy
#
RUBY
end
def self.verify_files(test_rig)
Annotate::Validations::Common.verify_files(
{
model: true,
test: true,
fixture: false,
factory: true,
routes: true
}, test_rig, schema_annotation, route_annotation, true
)
end
end
end
end
../../fixtures/rvmrc.sh
\ No newline at end of file
# This file is a hybrid file meant for live debugging without going through an
# actual RSpec run, and for being used in an RSpec run. To change it, change
# template.Gemfile and run 'rake templates:rebuild' which will do so for all
# templates in all build scenarios.
#
# ALSO, be sure NOT to commit any changes that happen in app/* or config/*
# when debugging this way as that will defeat the point of the automated tests!
#
# In fact, before running RSpec again after manual testing, you should run
# 'rake integration:clober' to reset modified files to their pristine state,
# and remove cruft that may interfere with the build.
source 'https://rubygems.org'
gem 'rails', '3.2.2'
gem 'sqlite3'
group :development do
if(ENV['AUTOMATED_TEST'] && ENV['AUTOMATED_TEST'] != '')
gem 'annotate', :path => ENV['AUTOMATED_TEST']
else
gem 'annotate', :path => '../../..'
end
end
group :test do
gem 'factory_girl'
gem 'factory_girl_rails'
end
PATH
remote: ../../..
specs:
annotate (2.5.0)
activerecord
rake
GEM
remote: https://rubygems.org/
specs:
actionmailer (3.2.2)
actionpack (= 3.2.2)
mail (~> 2.4.0)
actionpack (3.2.2)
activemodel (= 3.2.2)
activesupport (= 3.2.2)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.1)
rack (~> 1.4.0)
rack-cache (~> 1.1)
rack-test (~> 0.6.1)
sprockets (~> 2.1.2)
activemodel (3.2.2)
activesupport (= 3.2.2)
builder (~> 3.0.0)
activerecord (3.2.2)
activemodel (= 3.2.2)
activesupport (= 3.2.2)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activeresource (3.2.2)
activemodel (= 3.2.2)
activesupport (= 3.2.2)
activesupport (3.2.2)
i18n (~> 0.6)
multi_json (~> 1.0)
arel (3.0.2)
builder (3.0.0)
erubis (2.7.0)
factory_girl (4.0.0)
activesupport (>= 3.0.0)
factory_girl_rails (4.0.0)
factory_girl (~> 4.0.0)
railties (>= 3.0.0)
hike (1.2.1)
i18n (0.6.0)
journey (1.0.4)
json (1.7.4)
mail (2.4.4)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.19)
multi_json (1.3.6)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2)
rack (>= 0.4)
rack-ssl (1.3.2)
rack
rack-test (0.6.1)
rack (>= 1.0)
rails (3.2.2)
actionmailer (= 3.2.2)
actionpack (= 3.2.2)
activerecord (= 3.2.2)
activeresource (= 3.2.2)
activesupport (= 3.2.2)
bundler (~> 1.0)
railties (= 3.2.2)
railties (3.2.2)
actionpack (= 3.2.2)
activesupport (= 3.2.2)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (~> 0.14.6)
rake (0.9.2.2)
rdoc (3.12)
json (~> 1.4)
sprockets (2.1.3)
hike (~> 1.2)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.6)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.33)
PLATFORMS
ruby
DEPENDENCIES
annotate!
factory_girl
factory_girl_rails
rails (= 3.2.2)
sqlite3
../../fixtures/rails_32_rakefile
\ No newline at end of file
../../../fixtures/rails_32old_application.rb
\ No newline at end of file
../../../fixtures/rails32_boot.rb
\ No newline at end of file
../../../fixtures/database.yml
\ No newline at end of file
../../../fixtures/rails_32_environment.rb
\ No newline at end of file
../../../../fixtures/rails_32_development.rb
\ No newline at end of file
../../../../fixtures/rails_32_test.rb
\ No newline at end of file
../../../../fixtures/rails32_unified_initializer.rb
\ No newline at end of file
TestApp::Application.routes.draw do
resources :tasks
end
../../../../fixtures/20120816164927_create_tasks.rb
\ No newline at end of file
../../../fixtures/rails_32_schema.rb
\ No newline at end of file
../../../fixtures/rails_32_rails
\ No newline at end of file
# Read about factories at https://github.com/thoughtbot/factory_bot
FactoryGirl.define do
factory :task do
content "MyString"
end
end
../../../fixtures/rails_32_test_helper.rb
\ No newline at end of file
require 'test_helper'
class TaskTest < ActiveSupport::TestCase
# Replace this with your real tests.
test "the truth" do
assert true
end
end
require 'common_validation'
module Annotate
module Validations
class Rails32CustomInflection < Base
def self.schema_annotation
<<-RUBY
# == Schema Information
#
# Table name: tasks
#
# id :integer not null, primary key
# content :string(255)
# created_at :datetime not null
# updated_at :datetime not null
#
RUBY
end
def self.route_annotation
<<-RUBY
# == Route Map (Updated YYYY-MM-DD HH:MM)
#
# tasks GET /tasks(.:format) tasks#index
# POST /tasks(.:format) tasks#create
# new_task GET /tasks/new(.:format) tasks#new
# edit_task GET /tasks/:id/edit(.:format) tasks#edit
# task GET /tasks/:id(.:format) tasks#show
# PUT /tasks/:id(.:format) tasks#update
# DELETE /tasks/:id(.:format) tasks#destroy
#
RUBY
end
def self.verify_output(output)
output.should =~ /Annotated \(1\): TASk/
output.should =~ /Route file annotated./
end
end
end
end
../../fixtures/rvmrc.sh
\ No newline at end of file
../../fixtures/rails_328_gemfile
\ No newline at end of file
../../fixtures/rails_328_gemfile.lock
\ No newline at end of file
../../fixtures/rails_32_rakefile
\ No newline at end of file
class TASk < ActiveRecord::Base
attr_accessible :content
end
../../../fixtures/rails_32old_application.rb
\ No newline at end of file
../../../fixtures/rails32_boot.rb
\ No newline at end of file
../../../fixtures/database.yml
\ No newline at end of file
../../../fixtures/rails_32_environment.rb
\ No newline at end of file
../../../../fixtures/rails_32_development.rb
\ No newline at end of file
../../../../fixtures/rails_32_test.rb
\ No newline at end of file
# secret_token.rb
TestApp::Application.config.secret_token = '4768b21141022d583b141fde0db7e0b31759321b7fce459963914fdd82db248ea0318d9568030dcde70d404d4e86003ce5f51a7a83c8130842e5a97062b68c3c'
# session_store.rb
TestApp::Application.config.session_store :cookie_store, key: '_session'
# wrap_parameters.rb
ActiveSupport.on_load(:active_record) { self.include_root_in_json = false }
# inflections.rb
ActiveSupport::Inflector.inflections do |inflect|
inflect.acronym 'TASk'
end
TestApp::Application.routes.draw do
resources :tasks
end
../../../../fixtures/20120816164927_create_tasks.rb
\ No newline at end of file
../../../fixtures/rails_32_schema.rb
\ No newline at end of file
../../../fixtures/rails_32_rails
\ No newline at end of file
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
one:
content: MyString
two:
content: MyString
../../../fixtures/rails_32_test_helper.rb
\ No newline at end of file
require 'test_helper'
class TaskTest < ActiveSupport::TestCase
# Replace this with your real tests.
test "the truth" do
assert true
end
end
require 'common_validation'
module Annotate
module Validations
class Rails32WithAssetPipeline < Base
def self.schema_annotation
<<-RUBY
# == Schema Information
#
# Table name: tasks
#
# id :integer not null, primary key
# content :string(255)
# created_at :datetime not null
# updated_at :datetime not null
#
RUBY
end
def self.route_annotation
<<-RUBY
# == Route Map (Updated YYYY-MM-DD HH:MM)
#
# tasks GET /tasks(.:format) tasks#index
# POST /tasks(.:format) tasks#create
# new_task GET /tasks/new(.:format) tasks#new
# edit_task GET /tasks/:id/edit(.:format) tasks#edit
# task GET /tasks/:id(.:format) tasks#show
# PUT /tasks/:id(.:format) tasks#update
# DELETE /tasks/:id(.:format) tasks#destroy
#
RUBY
end
end
end
end
../../fixtures/rvmrc.sh
\ No newline at end of file
# This file is a hybrid file meant for live debugging without going through an
# actual RSpec run, and for being used in an RSpec run. To change it, change
# template.Gemfile and run 'rake templates:rebuild' which will do so for all
# templates in all build scenarios.
#
# ALSO, be sure NOT to commit any changes that happen in app/* or config/*
# when debugging this way as that will defeat the point of the automated tests!
#
# In fact, before running RSpec again after manual testing, you should run
# 'rake integration:clober' to reset modified files to their pristine state,
# and remove cruft that may interfere with the build.
source 'https://rubygems.org'
gem 'rails', '3.2.2'
gem 'sqlite3'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
end
group :development do
if(ENV['AUTOMATED_TEST'] && ENV['AUTOMATED_TEST'] != '')
gem 'annotate', :path => ENV['AUTOMATED_TEST']
else
gem 'annotate', :path => '../../..'
end
end
PATH
remote: ../../..
specs:
annotate (2.5.0)
activerecord
rake
GEM
remote: https://rubygems.org/
specs:
actionmailer (3.2.2)
actionpack (= 3.2.2)
mail (~> 2.4.0)
actionpack (3.2.2)
activemodel (= 3.2.2)
activesupport (= 3.2.2)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.1)
rack (~> 1.4.0)
rack-cache (~> 1.1)
rack-test (~> 0.6.1)
sprockets (~> 2.1.2)
activemodel (3.2.2)
activesupport (= 3.2.2)
builder (~> 3.0.0)
activerecord (3.2.2)
activemodel (= 3.2.2)
activesupport (= 3.2.2)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activeresource (3.2.2)
activemodel (= 3.2.2)
activesupport (= 3.2.2)
activesupport (3.2.2)
i18n (~> 0.6)
multi_json (~> 1.0)
arel (3.0.2)
builder (3.0.0)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
railties (~> 3.2.0)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.3.3)
erubis (2.7.0)
execjs (1.4.0)
multi_json (~> 1.0)
hike (1.2.1)
i18n (0.6.0)
journey (1.0.4)
json (1.7.4)
mail (2.4.4)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.19)
multi_json (1.3.6)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2)
rack (>= 0.4)
rack-ssl (1.3.2)
rack
rack-test (0.6.1)
rack (>= 1.0)
rails (3.2.2)
actionmailer (= 3.2.2)
actionpack (= 3.2.2)
activerecord (= 3.2.2)
activeresource (= 3.2.2)
activesupport (= 3.2.2)
bundler (~> 1.0)
railties (= 3.2.2)
railties (3.2.2)
actionpack (= 3.2.2)
activesupport (= 3.2.2)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (~> 0.14.6)
rake (0.9.2.2)
rdoc (3.12)
json (~> 1.4)
sass (3.2.1)
sass-rails (3.2.5)
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
sprockets (2.1.3)
hike (~> 1.2)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.6)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.33)
uglifier (1.2.7)
execjs (>= 0.3.0)
multi_json (~> 1.3)
PLATFORMS
ruby
DEPENDENCIES
annotate!
coffee-rails (~> 3.2.1)
rails (= 3.2.2)
sass-rails (~> 3.2.3)
sqlite3
uglifier (>= 1.0.3)
../../fixtures/rails_32_rakefile
\ No newline at end of file
require File.expand_path('../boot', __FILE__)
require "active_record/railtie"
require "sprockets/railtie"
require "rails/test_unit/railtie"
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require(*Rails.groups(:assets => %w(development test)))
end
module TestApp
class Application < Rails::Application
config.assets.enabled = true
config.assets.version = '1.0'
end
end
../../../fixtures/rails32_boot.rb
\ No newline at end of file
../../../fixtures/database.yml
\ No newline at end of file
../../../fixtures/rails_32_environment.rb
\ No newline at end of file
TestApp::Application.configure do
config.action_dispatch.best_standards_support = :builtin
config.active_record.auto_explain_threshold_in_seconds = 0.5
config.active_record.mass_assignment_sanitizer = :strict
config.active_support.deprecation = :log
config.assets.compress = false
config.assets.debug = true
config.cache_classes = false
config.consider_all_requests_local = true
config.whiny_nils = true
end
../../../../fixtures/rails_32_test.rb
\ No newline at end of file
# secret_token.rb
TestApp::Application.config.secret_token = '4768b21141022d583b141fde0db7e0b31759321b7fce459963914fdd82db248ea0318d9568030dcde70d404d4e86003ce5f51a7a83c8130842e5a97062b68c3c'
# session_store.rb
TestApp::Application.config.session_store :cookie_store, key: '_session'
# wrap_parameters.rb
ActiveSupport.on_load(:action_controller) { wrap_parameters format: [:json] }
ActiveSupport.on_load(:active_record) { self.include_root_in_json = false }
TestApp::Application.routes.draw do
resources :tasks
end
../../../../fixtures/20120816164927_create_tasks.rb
\ No newline at end of file
../../../fixtures/rails_32_schema.rb
\ No newline at end of file
../../../fixtures/rails_32_rails
\ No newline at end of file
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
one:
content: MyString
two:
content: MyString
../../../fixtures/rails_32_test_helper.rb
\ No newline at end of file
require 'test_helper'
class TaskTest < ActiveSupport::TestCase
# Replace this with your real tests.
test "the truth" do
assert true
end
end
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'
# Ignore bundler config.
/.bundle
# Ignore the default SQLite database.
/db/*.sqlite3
/db/*.sqlite3-journal
# Ignore all logfiles and tempfiles.
/log/*.log
/tmp
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.1'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring', group: :development
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
group :development do
if(ENV['AUTOMATED_TEST'] && ENV['AUTOMATED_TEST'] != '')
gem 'annotate', :path => ENV['AUTOMATED_TEST']
else
gem 'annotate', :path => '../../..'
end
end
gem 'rails-observers'
PATH
remote: ../../..
specs:
annotate (2.6.6)
activerecord (>= 3.2, <= 4.3)
rake (~> 10.4)
GEM
remote: https://rubygems.org/
specs:
actionmailer (4.1.1)
actionpack (= 4.1.1)
actionview (= 4.1.1)
mail (~> 2.5.4)
actionpack (4.1.1)
actionview (= 4.1.1)
activesupport (= 4.1.1)
rack (~> 1.5.2)
rack-test (~> 0.6.2)
actionview (4.1.1)
activesupport (= 4.1.1)
builder (~> 3.1)
erubis (~> 2.7.0)
activemodel (4.1.1)
activesupport (= 4.1.1)
builder (~> 3.1)
activerecord (4.1.1)
activemodel (= 4.1.1)
activesupport (= 4.1.1)
arel (~> 5.0.0)
activesupport (4.1.1)
i18n (~> 0.6, >= 0.6.9)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.1)
tzinfo (~> 1.1)
arel (5.0.1.20140414130214)
builder (3.2.2)
coffee-rails (4.0.1)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.0)
coffee-script (2.3.0)
coffee-script-source
execjs
coffee-script-source (1.9.1)
erubis (2.7.0)
execjs (2.4.0)
hike (1.2.3)
i18n (0.7.0)
jbuilder (2.2.11)
activesupport (>= 3.0.0, < 5)
multi_json (~> 1.2)
jquery-rails (3.1.2)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
json (1.8.2)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.25.1)
minitest (5.5.1)
multi_json (1.11.0)
polyglot (0.3.5)
rack (1.5.2)
rack-test (0.6.3)
rack (>= 1.0)
rails (4.1.1)
actionmailer (= 4.1.1)
actionpack (= 4.1.1)
actionview (= 4.1.1)
activemodel (= 4.1.1)
activerecord (= 4.1.1)
activesupport (= 4.1.1)
bundler (>= 1.3.0, < 2.0)
railties (= 4.1.1)
sprockets-rails (~> 2.0)
rails-observers (0.1.2)
activemodel (~> 4.0)
railties (4.1.1)
actionpack (= 4.1.1)
activesupport (= 4.1.1)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (10.4.2)
rdoc (4.2.0)
json (~> 1.4)
sass (3.2.19)
sass-rails (4.0.5)
railties (>= 4.0.0, < 5.0)
sass (~> 3.2.2)
sprockets (~> 2.8, < 3.0)
sprockets-rails (~> 2.0)
sdoc (0.4.1)
json (~> 1.7, >= 1.7.7)
rdoc (~> 4.0)
spring (1.3.3)
sprockets (2.12.3)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sprockets-rails (2.2.4)
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (>= 2.8, < 4.0)
sqlite3 (1.3.10)
thor (0.19.1)
thread_safe (0.3.4)
tilt (1.4.1)
treetop (1.4.15)
polyglot (>= 0.3.1)
turbolinks (2.5.3)
coffee-rails
tzinfo (1.2.2)
thread_safe (~> 0.1)
uglifier (2.7.1)
execjs (>= 0.3.0)
json (>= 1.8.0)
PLATFORMS
ruby
DEPENDENCIES
annotate!
coffee-rails (~> 4.0.0)
jbuilder (~> 2.0)
jquery-rails
rails (= 4.1.1)
rails-observers
sass-rails (~> 4.0.3)
sdoc (~> 0.4.0)
spring
sqlite3
turbolinks
uglifier (>= 1.3.0)
== README
This README would normally document whatever steps are necessary to get the
application up and running.
Things you may want to cover:
* Ruby version
* System dependencies
* Configuration
* Database creation
* Database initialization
* How to run the test suite
* Services (job queues, cache servers, search engines, etc.)
* Deployment instructions
* ...
Please feel free to use a different markup language if you do not plan to run
<tt>rake doc:app</tt>.
# 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__)
Rails.application.load_tasks
# == Schema Information
#
# Table name: events
#
# id :integer not null, primary key
# content :string(255)
# created_at :datetime
# updated_at :datetime
#
module Sub1::Sub2::Sub3
class Event < ActiveRecord::Base
end
end
# == Schema Information
#
# Table name: users
#
# id :integer not null, primary key
# content :string(255)
# created_at :datetime
# updated_at :datetime
#
class Sub1::User < ActiveRecord::Base
end
# == Schema Information
#
# Table name: tasks
#
# id :integer not null, primary key
# content :string(255)
# count :integer default(0)
# status :boolean default(FALSE)
# created_at :datetime
# updated_at :datetime
#
class Task < ActiveRecord::Base
enum status: %w(normal active completed)
end
class TaskObserver < ActiveRecord::Observer
end
\ No newline at end of file
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run Rails.application
require File.expand_path('../boot', __FILE__)
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Rails411
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
end
end
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
#
default: &default
adapter: sqlite3
pool: 5
timeout: 5000
development:
<<: *default
database: db/development.sqlite3
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
<<: *default
database: db/test.sqlite3
production:
<<: *default
database: db/production.sqlite3
# Load the Rails application.
require File.expand_path('../application', __FILE__)
# Initialize the Rails application.
Rails.application.initialize!
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.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 web server when you make code changes.
config.cache_classes = false
# Do not eager load code on boot.
config.eager_load = false
# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true
# Adds additional error checking when serving assets at runtime.
# Checks for improperly declared sprockets dependencies.
# Raises helpful error messages.
config.assets.raise_runtime_errors = true
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
end
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
config.eager_load = true
# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Enable Rack::Cache to put a simple HTTP cache in front of your application
# Add `rack-cache` to your Gemfile before enabling this.
# For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
# config.action_dispatch.rack_cache = true
# Disable Rails's static asset server (Apache or nginx will already do this).
config.serve_static_assets = false
# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
# config.assets.css_compressor = :sass
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
# Generate digests for assets URLs.
config.assets.digest = true
# Version of your assets, change this if you want to expire all your assets.
config.assets.version = '1.0'
# Specifies the header that your server uses for sending files.
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
# Set to :debug to see everything in the log.
config.log_level = :info
# Prepend all log lines with the following tags.
# config.log_tags = [ :subdomain, :uuid ]
# Use a different logger for distributed setups.
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
# Use a different cache store in production.
# config.cache_store = :mem_cache_store
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.action_controller.asset_host = "http://assets.example.com"
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
# config.assets.precompile += %w( search.js )
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify
# Disable automatic flushing of the log to improve performance.
# config.autoflush_log = false
# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
end
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.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 suite and is wiped
# and recreated between test runs. Don't rely on the data there!
config.cache_classes = true
# Do not eager load code on boot. This avoids loading your whole application
# just for the purpose of running a single test. If you are using a tool that
# preloads Rails for running tests, you may have to set it to true.
config.eager_load = false
# Configure static asset server for tests with Cache-Control for performance.
config.serve_static_assets = true
config.static_cache_control = 'public, max-age=3600'
# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Raise exceptions instead of rendering exception templates.
config.action_dispatch.show_exceptions = false
# Disable request forgery protection in test environment.
config.action_controller.allow_forgery_protection = false
# Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
# Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
end
# 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 problem that might stem from framework code.
# Rails.backtrace_cleaner.remove_silencers!
# Be sure to restart your server when you modify this file.
Rails.application.config.action_dispatch.cookies_serializer = :json
\ No newline at end of file
# Be sure to restart your server when you modify this file.
# Configure sensitive parameters which will be filtered from the log file.
Rails.application.config.filter_parameters += [:password]
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format. Inflections
# are locale specific, and you may define rules for as many different
# locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# inflect.uncountable %w( fish sheep )
# end
# These inflection rules are supported but not enabled by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.acronym 'RESTful'
# end
# 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
# Be sure to restart your server when you modify this file.
Rails.application.config.session_store :cookie_store, key: '_rails_4_1_1_session'
# Be sure to restart your server when you modify this file.
# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport.on_load(:action_controller) do
wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
end
# To enable root element in JSON for ActiveRecord objects.
# ActiveSupport.on_load(:active_record) do
# self.include_root_in_json = true
# end
# Files in the config/locales directory are used for internationalization
# and are automatically loaded by Rails. If you want to use locales other
# than English, add the necessary files in this directory.
#
# To use the locales, use `I18n.t`:
#
# I18n.t 'hello'
#
# In views, this is aliased to just `t`:
#
# <%= t('hello') %>
#
# To use a different locale, set it with `I18n.locale`:
#
# I18n.locale = :es
#
# This would use the information in config/locales/es.yml.
#
# To learn more, please read the Rails Internationalization guide
# available at http://guides.rubyonrails.org/i18n.html.
en:
hello: "Hello world"
Rails.application.routes.draw do
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
# root 'welcome#index'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
# Be sure to restart your server when you modify this file.
# Your secret key is used 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 attacks.
# You can use `rake secret` to generate a secure secret key.
# Make sure the secrets in this file are kept private
# if you're sharing your code publicly.
development:
secret_key_base: 6c17ffa1446409733e3bc5b3250a56dbbfe8fb1a235c966e89344814abca7c25a23647d3eef49d2a7e7751d501b294cc4a3911549441aa9ddffe45a36f40e96c
test:
secret_key_base: 952ea361989ff7bba92aae19f14cbd4ab5c1fe431a0d28420ab1d14593a4b15c905dffdb26f3ab14108c023540fa89ac9364a98fe48e402602ec01159fa64b91
# Do not keep production secrets in the repository,
# instead read values from the environment.
production:
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
class CreateTasks < ActiveRecord::Migration
def change
create_table :tasks do |t|
t.string :content
t.integer :count, :default => 0
t.boolean :status, :default => 0
t.timestamps
end
end
end
class CreateEvents < ActiveRecord::Migration
def change
create_table :events do |t|
t.string :content
t.timestamps
end
end
end
class CreateUsers < ActiveRecord::Migration
def change
create_table :users do |t|
t.string :content
t.timestamps
end
end
end
# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20140705000010) do
create_table "events", force: true do |t|
t.string "content"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "tasks", force: true do |t|
t.string "content"
t.integer "count", default: 0
t.boolean "status", default: false
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "users", force: true do |t|
t.string "content"
t.datetime "created_at"
t.datetime "updated_at"
end
end
# 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: 'Emanuel', city: cities.first)
# == Schema Information
#
# Table name: tasks
#
# id :integer not null, primary key
# content :string(255)
# count :integer default(0)
# status :boolean default(FALSE)
# created_at :datetime
# updated_at :datetime
#
require 'test_helper'
class TaskTest < ActiveSupport::TestCase
# Replace this with your real tests.
test "the truth" do
assert true
end
end
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
#
# Note: You'll currently still have to declare fixtures explicitly in integration tests
# -- they do not yet inherit this setting
fixtures :all
# Add more helper methods to be used by all tests here...
end
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'
# Ignore bundler config.
/.bundle
# Ignore the default SQLite database.
/db/*.sqlite3
/db/*.sqlite3-journal
# Ignore all logfiles and tempfiles.
/log/*.log
/tmp
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.0'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring', group: :development
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
group :development do
if(ENV['AUTOMATED_TEST'] && ENV['AUTOMATED_TEST'] != '')
gem 'annotate', :path => ENV['AUTOMATED_TEST']
else
gem 'annotate', :path => '../../..'
end
end
gem 'rails-observers'
PATH
remote: ../../..
specs:
annotate (2.6.6)
activerecord (>= 3.2, < 7.0)
rake (>= 10.4, < 14.0)
GEM
remote: https://rubygems.org/
specs:
actionmailer (4.2.0)
actionpack (= 4.2.0)
actionview (= 4.2.0)
activejob (= 4.2.0)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 1.0, >= 1.0.5)
actionpack (4.2.0)
actionview (= 4.2.0)
activesupport (= 4.2.0)
rack (~> 1.6.0)
rack-test (~> 0.6.2)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.1)
actionview (4.2.0)
activesupport (= 4.2.0)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.1)
activejob (4.2.0)
activesupport (= 4.2.0)
globalid (>= 0.3.0)
activemodel (4.2.0)
activesupport (= 4.2.0)
builder (~> 3.1)
activerecord (4.2.0)
activemodel (= 4.2.0)
activesupport (= 4.2.0)
arel (~> 6.0)
activesupport (4.2.0)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
arel (6.0.0)
builder (3.2.3)
coffee-rails (4.1.0)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.0)
coffee-script (2.3.0)
coffee-script-source
execjs
coffee-script-source (1.9.1)
concurrent-ruby (1.1.5)
crass (1.0.5)
erubis (2.7.0)
execjs (2.4.0)
globalid (0.3.3)
activesupport (>= 4.1.0)
hike (1.2.3)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
jbuilder (2.2.11)
activesupport (>= 3.0.0, < 5)
multi_json (~> 1.2)
jquery-rails (4.0.3)
rails-dom-testing (~> 1.0)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
json (1.8.6)
loofah (2.3.1)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.6.3)
mime-types (>= 1.16, < 3)
mime-types (2.4.3)
mini_portile2 (2.4.0)
minitest (5.12.2)
multi_json (1.11.0)
nokogiri (1.10.5)
mini_portile2 (~> 2.4.0)
rack (1.6.11)
rack-test (0.6.3)
rack (>= 1.0)
rails (4.2.0)
actionmailer (= 4.2.0)
actionpack (= 4.2.0)
actionview (= 4.2.0)
activejob (= 4.2.0)
activemodel (= 4.2.0)
activerecord (= 4.2.0)
activesupport (= 4.2.0)
bundler (>= 1.3.0, < 2.0)
railties (= 4.2.0)
sprockets-rails
rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha)
rails-dom-testing (1.0.9)
activesupport (>= 4.2.0, < 5.0)
nokogiri (~> 1.6)
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.2.0)
loofah (~> 2.2, >= 2.2.2)
rails-observers (0.1.2)
activemodel (~> 4.0)
railties (4.2.0)
actionpack (= 4.2.0)
activesupport (= 4.2.0)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (10.4.2)
rdoc (4.2.0)
json (~> 1.4)
sass (3.4.13)
sass-rails (5.0.1)
railties (>= 4.0.0, < 5.0)
sass (~> 3.1)
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (~> 1.1)
sdoc (0.4.1)
json (~> 1.7, >= 1.7.7)
rdoc (~> 4.0)
spring (1.3.3)
sprockets (2.12.3)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sprockets-rails (2.2.4)
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (>= 2.8, < 4.0)
sqlite3 (1.3.10)
thor (0.19.1)
thread_safe (0.3.6)
tilt (1.4.1)
turbolinks (2.5.3)
coffee-rails
tzinfo (1.2.5)
thread_safe (~> 0.1)
uglifier (2.7.1)
execjs (>= 0.3.0)
json (>= 1.8.0)
PLATFORMS
ruby
DEPENDENCIES
annotate!
coffee-rails (~> 4.1.0)
jbuilder (~> 2.0)
jquery-rails
rails (= 4.2.0)
rails-observers
sass-rails (~> 5.0)
sdoc (~> 0.4.0)
spring
sqlite3
turbolinks
uglifier (>= 1.3.0)
== README
This README would normally document whatever steps are necessary to get the
application up and running.
Things you may want to cover:
* Ruby version
* System dependencies
* Configuration
* Database creation
* Database initialization
* How to run the test suite
* Services (job queues, cache servers, search engines, etc.)
* Deployment instructions
* ...
Please feel free to use a different markup language if you do not plan to run
<tt>rake doc:app</tt>.
# 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__)
Rails.application.load_tasks
class NoNamespace < ActiveRecord::Base
enum foo: [:bar, :baz]
end
# == Schema Information
#
# Table name: events
#
# id :integer not null, primary key
# content :string
# created_at :datetime
# updated_at :datetime
#
module Sub1::Sub2::Sub3
class Event < ActiveRecord::Base
end
end
# == Schema Information
#
# Table name: users
#
# id :integer not null, primary key
# content :string
# created_at :datetime
# updated_at :datetime
#
class Sub1::User < ActiveRecord::Base
end
# == Schema Information
#
# Table name: tasks
#
# id :integer not null, primary key
# content :string
# count :integer default(0)
# status :boolean default(FALSE)
# created_at :datetime
# updated_at :datetime
#
class Task < ActiveRecord::Base
enum status: %w(normal active completed)
end
class TaskObserver < ActiveRecord::Observer
end
\ No newline at end of file
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run Rails.application
require File.expand_path('../boot', __FILE__)
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Rails411
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
end
end
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
#
default: &default
adapter: sqlite3
pool: 5
timeout: 5000
development:
<<: *default
database: db/development.sqlite3
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
<<: *default
database: db/test.sqlite3
production:
<<: *default
database: db/production.sqlite3
# Load the Rails application.
require File.expand_path('../application', __FILE__)
# Initialize the Rails application.
Rails.application.initialize!
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.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 web server when you make code changes.
config.cache_classes = false
# Do not eager load code on boot.
config.eager_load = false
# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true
# Adds additional error checking when serving assets at runtime.
# Checks for improperly declared sprockets dependencies.
# Raises helpful error messages.
config.assets.raise_runtime_errors = true
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
end
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
config.eager_load = true
# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Enable Rack::Cache to put a simple HTTP cache in front of your application
# Add `rack-cache` to your Gemfile before enabling this.
# For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
# config.action_dispatch.rack_cache = true
# Disable Rails's static asset server (Apache or nginx will already do this).
config.serve_static_assets = false
# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
# config.assets.css_compressor = :sass
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
# Generate digests for assets URLs.
config.assets.digest = true
# Version of your assets, change this if you want to expire all your assets.
config.assets.version = '1.0'
# Specifies the header that your server uses for sending files.
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
# Set to :debug to see everything in the log.
config.log_level = :info
# Prepend all log lines with the following tags.
# config.log_tags = [ :subdomain, :uuid ]
# Use a different logger for distributed setups.
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
# Use a different cache store in production.
# config.cache_store = :mem_cache_store
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.action_controller.asset_host = "http://assets.example.com"
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
# config.assets.precompile += %w( search.js )
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify
# Disable automatic flushing of the log to improve performance.
# config.autoflush_log = false
# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
end
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.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 suite and is wiped
# and recreated between test runs. Don't rely on the data there!
config.cache_classes = true
# Do not eager load code on boot. This avoids loading your whole application
# just for the purpose of running a single test. If you are using a tool that
# preloads Rails for running tests, you may have to set it to true.
config.eager_load = false
# Configure static asset server for tests with Cache-Control for performance.
config.serve_static_assets = true
config.static_cache_control = 'public, max-age=3600'
# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Raise exceptions instead of rendering exception templates.
config.action_dispatch.show_exceptions = false
# Disable request forgery protection in test environment.
config.action_controller.allow_forgery_protection = false
# Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
# Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
end
# 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 problem that might stem from framework code.
# Rails.backtrace_cleaner.remove_silencers!
# Be sure to restart your server when you modify this file.
Rails.application.config.action_dispatch.cookies_serializer = :json
\ No newline at end of file
# Be sure to restart your server when you modify this file.
# Configure sensitive parameters which will be filtered from the log file.
Rails.application.config.filter_parameters += [:password]
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format. Inflections
# are locale specific, and you may define rules for as many different
# locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# inflect.uncountable %w( fish sheep )
# end
# These inflection rules are supported but not enabled by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.acronym 'RESTful'
# end
# 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
# Be sure to restart your server when you modify this file.
Rails.application.config.session_store :cookie_store, key: '_rails_4_1_1_session'
# Be sure to restart your server when you modify this file.
# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport.on_load(:action_controller) do
wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
end
# To enable root element in JSON for ActiveRecord objects.
# ActiveSupport.on_load(:active_record) do
# self.include_root_in_json = true
# end
# Files in the config/locales directory are used for internationalization
# and are automatically loaded by Rails. If you want to use locales other
# than English, add the necessary files in this directory.
#
# To use the locales, use `I18n.t`:
#
# I18n.t 'hello'
#
# In views, this is aliased to just `t`:
#
# <%= t('hello') %>
#
# To use a different locale, set it with `I18n.locale`:
#
# I18n.locale = :es
#
# This would use the information in config/locales/es.yml.
#
# To learn more, please read the Rails Internationalization guide
# available at http://guides.rubyonrails.org/i18n.html.
en:
hello: "Hello world"
Rails.application.routes.draw do
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
# root 'welcome#index'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
# Be sure to restart your server when you modify this file.
# Your secret key is used 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 attacks.
# You can use `rake secret` to generate a secure secret key.
# Make sure the secrets in this file are kept private
# if you're sharing your code publicly.
development:
secret_key_base: 6c17ffa1446409733e3bc5b3250a56dbbfe8fb1a235c966e89344814abca7c25a23647d3eef49d2a7e7751d501b294cc4a3911549441aa9ddffe45a36f40e96c
test:
secret_key_base: 952ea361989ff7bba92aae19f14cbd4ab5c1fe431a0d28420ab1d14593a4b15c905dffdb26f3ab14108c023540fa89ac9364a98fe48e402602ec01159fa64b91
# Do not keep production secrets in the repository,
# instead read values from the environment.
production:
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
class CreateTasks < ActiveRecord::Migration
def change
create_table :tasks do |t|
t.string :content
t.integer :count, default: 0
t.boolean :status, default: 0
t.timestamps
end
end
end
class CreateEvents < ActiveRecord::Migration
def change
create_table :events do |t|
t.string :content
t.timestamps
end
end
end
class CreateUsers < ActiveRecord::Migration
def change
create_table :users do |t|
t.string :content
t.timestamps
end
end
end
class CreateUsers < ActiveRecord::Migration
def change
create_table :no_namespaces do |t|
t.integer :foo
t.timestamps
end
end
end
# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20140705000010) do
create_table "events", force: :cascade do |t|
t.string "content"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "tasks", force: :cascade do |t|
t.string "content"
t.integer "count", default: 0
t.boolean "status", default: false
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "users", force: :cascade do |t|
t.string "content"
t.datetime "created_at"
t.datetime "updated_at"
end
end
# 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: 'Emanuel', city: cities.first)
# == Schema Information
#
# Table name: tasks
#
# id :integer not null, primary key
# content :string
# count :integer default(0)
# status :boolean default(FALSE)
# created_at :datetime
# updated_at :datetime
#
require 'test_helper'
class TaskTest < ActiveSupport::TestCase
# Replace this with your real tests.
test "the truth" do
assert true
end
end
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
#
# Note: You'll currently still have to declare fixtures explicitly in integration tests
# -- they do not yet inherit this setting
fixtures :all
# Add more helper methods to be used by all tests here...
end
require 'common_validation'
module Annotate
module Validations
class Standalone < Base
def self.schema_annotation
<<-RUBY
# == Schema Information
#
# Table name: tasks
#
# id :integer not null, primary key
# content :string(255)
# created_at :datetime not null
# updated_at :datetime not null
#
RUBY
end
def self.test_commands
'bin/annotate --require ./config/init.rb'
end
def self.verify_output(output)
output.should =~ /Annotated \(1\): Task/
end
def self.verify_files(test_rig)
Annotate::Validations::Common.verify_files(
{
model: true,
test: false,
fixture: false,
factory: false,
routes: false
}, test_rig, schema_annotation, nil, true
)
end
end
end
end
../../fixtures/rvmrc.sh
\ No newline at end of file
# This file is a hybrid file meant for live debugging without going through an
# actual RSpec run, and for being used in an RSpec run. To change it, change
# template.Gemfile and run 'rake templates:rebuild' which will do so for all
# templates in all build scenarios.
#
# ALSO, be sure NOT to commit any changes that happen in app/* or config/*
# when debugging this way as that will defeat the point of the automated tests!
#
# In fact, before running RSpec again after manual testing, you should run
# 'rake integration:clober' to reset modified files to their pristine state,
# and remove cruft that may interfere with the build.
source 'https://rubygems.org'
gem 'activerecord', '3.2.8'
gem 'sqlite3'
group :development do
if(ENV['AUTOMATED_TEST'] && ENV['AUTOMATED_TEST'] != '')
gem 'annotate', :path => ENV['AUTOMATED_TEST']
else
gem 'annotate', :path => '../../..'
end
end
PATH
remote: ../../..
specs:
annotate (2.5.0)
activerecord
rake
GEM
remote: https://rubygems.org/
specs:
activemodel (3.2.8)
activesupport (= 3.2.8)
builder (~> 3.0.0)
activerecord (3.2.8)
activemodel (= 3.2.8)
activesupport (= 3.2.8)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activesupport (3.2.8)
i18n (~> 0.6)
multi_json (~> 1.0)
arel (3.0.2)
builder (3.0.0)
i18n (0.6.0)
multi_json (1.3.6)
rake (0.9.2.2)
sqlite3 (1.3.6)
tzinfo (0.3.33)
PLATFORMS
ruby
DEPENDENCIES
activerecord (= 3.2.8)
annotate!
sqlite3
class Task < ActiveRecord::Base
attr_accessible :content
end
require 'active_record'
ActiveRecord::Base.establish_connection({
adapter: 'sqlite3',
database: 'db/development.sqlite3',
pool: 1,
timeout: 5000
})
../../../fixtures/rails_32_schema.rb
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment