Skip to content

Commit

Permalink
Ruby 1.9 compatibility, Travis CI
Browse files Browse the repository at this point in the history
  • Loading branch information
triskweline committed Mar 2, 2013
1 parent 81b9b64 commit 0c41f73
Show file tree
Hide file tree
Showing 26 changed files with 230 additions and 157 deletions.
15 changes: 15 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
language: ruby
rvm:
- "1.8.7"
- "1.9.3"
- ree
services:
- mysql
before_script: rake travis_ci:prepare
script: rake all:bundle:install all:spec
notifications:
email:
- fail@makandra.de
branches:
only:
- master
13 changes: 12 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,25 @@ require 'bundler/gem_tasks'
desc 'Default: Run all specs.'
task :default => 'all:spec'


namespace :travis_ci do

desc 'Things to do before Travis CI begins'
task :prepare do
end

end

namespace :all do

desc "Run specs on all spec apps"
task :spec do
success = true
for_each_directory_of('spec/**/Rakefile') do |directory|
env = "SPEC=../../#{ENV['SPEC']} " if ENV['SPEC']
system("cd #{directory} && #{env} bundle exec rake spec")
success &= system("cd #{directory} && #{env} bundle exec rake spec")
end
fail "Tests failed" unless success
end

namespace :bundle do
Expand Down
6 changes: 3 additions & 3 deletions lib/assignable_values/active_record/restriction/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def set_default(record)

def evaluate_default(record, value_or_proc)
if value_or_proc.is_a?(Proc)
record.instance_eval(&value_or_proc)
record.instance_exec(&value_or_proc)
else
value_or_proc
end
Expand Down Expand Up @@ -181,7 +181,7 @@ def parsed_assignable_values(record)
if delegate?
values = assignable_values_from_delegate(record)
else
values = record.instance_eval(&@values)
values = record.instance_exec(&@values)
end
parse_values(values)
end
Expand All @@ -194,7 +194,7 @@ def evaluate_option(record, option)
case option
when NilClass, TrueClass, FalseClass then option
when Symbol then record.send(option)
when Proc then record.instance_eval(&option)
when Proc then record.instance_exec(&option)
else raise "Illegal option type: #{option.inspect}"
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/assignable_values/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module AssignableValues
VERSION = '0.6.1'
VERSION = '0.7.0'
end
6 changes: 4 additions & 2 deletions spec/rails-2.3/Gemfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
source 'http://rubygems.org'

gem 'sqlite3'
gem 'rails', '=2.3.10'
gem 'test-unit', '=1.2.3', :platforms => :ruby_19
gem 'rails', '~>2.3.10'
gem 'rspec', '<2'
gem 'rspec-rails', '<2'
gem 'ruby-debug'
gem 'ruby-debug', :platforms => :ruby_18
gem 'debugger', :platforms => :ruby_19
gem 'rspec_candy'
gem 'assignable_values', :path => '../..'
56 changes: 36 additions & 20 deletions spec/rails-2.3/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,50 +7,66 @@ PATH
GEM
remote: http://rubygems.org/
specs:
actionmailer (2.3.10)
actionpack (= 2.3.10)
actionpack (2.3.10)
activesupport (= 2.3.10)
actionmailer (2.3.17)
actionpack (= 2.3.17)
actionpack (2.3.17)
activesupport (= 2.3.17)
rack (~> 1.1.0)
activerecord (2.3.10)
activesupport (= 2.3.10)
activeresource (2.3.10)
activesupport (= 2.3.10)
activesupport (2.3.10)
activerecord (2.3.17)
activesupport (= 2.3.17)
activeresource (2.3.17)
activesupport (= 2.3.17)
activesupport (2.3.17)
columnize (0.3.6)
debugger (1.3.3)
columnize (>= 0.3.1)
debugger-linecache (~> 1.1.1)
debugger-ruby_core_source (~> 1.2.0)
debugger-linecache (1.1.2)
debugger-ruby_core_source (>= 1.1.1)
debugger-ruby_core_source (1.2.0)
hoe (3.5.1)
rake (>= 0.8, < 11.0)
linecache (0.46)
rbx-require-relative (> 0.0.4)
rack (1.1.3)
rails (2.3.10)
actionmailer (= 2.3.10)
actionpack (= 2.3.10)
activerecord (= 2.3.10)
activeresource (= 2.3.10)
activesupport (= 2.3.10)
rack (1.1.6)
rails (2.3.17)
actionmailer (= 2.3.17)
actionpack (= 2.3.17)
activerecord (= 2.3.17)
activeresource (= 2.3.17)
activesupport (= 2.3.17)
rake (>= 0.8.3)
rake (10.0.2)
rake (10.0.3)
rbx-require-relative (0.0.9)
rspec (1.3.2)
rspec-rails (1.3.4)
rack (>= 1.0.0)
rspec (~> 1.3.1)
rspec_candy (0.2.1)
rspec_candy (0.2.8)
rspec
sneaky-save
ruby-debug (0.10.4)
columnize (>= 0.1)
ruby-debug-base (~> 0.10.4.0)
ruby-debug-base (0.10.4)
linecache (>= 0.3)
sqlite3 (1.3.6)
sneaky-save (0.0.2)
activerecord (>= 2.3.2)
sqlite3 (1.3.7)
test-unit (1.2.3)
hoe (>= 1.5.1)

PLATFORMS
ruby

DEPENDENCIES
assignable_values!
rails (= 2.3.10)
debugger
rails (~> 2.3.10)
rspec (< 2)
rspec-rails (< 2)
rspec_candy
ruby-debug
sqlite3
test-unit (= 1.2.3)
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
$: << File.join(File.dirname(__FILE__), "/../lib" )
$: << File.join(File.dirname(__FILE__), "/../../lib" )

# Set the default environment to sqlite3's in_memory database
ENV['RAILS_ENV'] ||= 'test'
ENV['RAILS_ENV'] = 'test'
ENV['RAILS_ROOT'] = 'app_root'

# Load the Rails environment and testing framework
require "#{File.dirname(__FILE__)}/app_root/config/environment"
require "#{File.dirname(__FILE__)}/../app_root/config/environment"
require 'spec/rails'
require 'rspec_candy/all'

Expand Down
5 changes: 3 additions & 2 deletions spec/rails-3.0/Gemfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
source 'http://rubygems.org'

gem 'sqlite3'
gem 'rails', '=3.0.3'
gem 'rails', '~>3.0.3'
gem 'rspec'
gem 'rspec-rails'
gem 'ruby-debug'
gem 'ruby-debug', :platforms => :ruby_18
gem 'debugger', :platforms => :ruby_19
gem 'rspec_candy'
gem 'assignable_values', :path => '../..'

117 changes: 66 additions & 51 deletions spec/rails-3.0/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,91 +8,105 @@ GEM
remote: http://rubygems.org/
specs:
abstract (1.0.0)
actionmailer (3.0.3)
actionpack (= 3.0.3)
mail (~> 2.2.9)
actionpack (3.0.3)
activemodel (= 3.0.3)
activesupport (= 3.0.3)
actionmailer (3.0.20)
actionpack (= 3.0.20)
mail (~> 2.2.19)
actionpack (3.0.20)
activemodel (= 3.0.20)
activesupport (= 3.0.20)
builder (~> 2.1.2)
erubis (~> 2.6.6)
i18n (~> 0.4)
rack (~> 1.2.1)
rack-mount (~> 0.6.13)
rack-test (~> 0.5.6)
i18n (~> 0.5.0)
rack (~> 1.2.5)
rack-mount (~> 0.6.14)
rack-test (~> 0.5.7)
tzinfo (~> 0.3.23)
activemodel (3.0.3)
activesupport (= 3.0.3)
activemodel (3.0.20)
activesupport (= 3.0.20)
builder (~> 2.1.2)
i18n (~> 0.4)
activerecord (3.0.3)
activemodel (= 3.0.3)
activesupport (= 3.0.3)
arel (~> 2.0.2)
i18n (~> 0.5.0)
activerecord (3.0.20)
activemodel (= 3.0.20)
activesupport (= 3.0.20)
arel (~> 2.0.10)
tzinfo (~> 0.3.23)
activeresource (3.0.3)
activemodel (= 3.0.3)
activesupport (= 3.0.3)
activesupport (3.0.3)
activeresource (3.0.20)
activemodel (= 3.0.20)
activesupport (= 3.0.20)
activesupport (3.0.20)
arel (2.0.10)
builder (2.1.2)
columnize (0.3.6)
diff-lcs (1.1.3)
debugger (1.3.3)
columnize (>= 0.3.1)
debugger-linecache (~> 1.1.1)
debugger-ruby_core_source (~> 1.2.0)
debugger-linecache (1.1.2)
debugger-ruby_core_source (>= 1.1.1)
debugger-ruby_core_source (1.2.0)
diff-lcs (1.2.1)
erubis (2.6.6)
abstract (>= 1.0.0)
i18n (0.6.1)
i18n (0.5.0)
json (1.7.7)
linecache (0.46)
rbx-require-relative (> 0.0.4)
mail (2.2.19)
activesupport (>= 2.3.6)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.19)
mime-types (1.21)
polyglot (0.3.3)
rack (1.2.5)
rack (1.2.8)
rack-mount (0.6.14)
rack (>= 1.0.0)
rack-test (0.5.7)
rack (>= 1.0)
rails (3.0.3)
actionmailer (= 3.0.3)
actionpack (= 3.0.3)
activerecord (= 3.0.3)
activeresource (= 3.0.3)
activesupport (= 3.0.3)
rails (3.0.20)
actionmailer (= 3.0.20)
actionpack (= 3.0.20)
activerecord (= 3.0.20)
activeresource (= 3.0.20)
activesupport (= 3.0.20)
bundler (~> 1.0)
railties (= 3.0.3)
railties (3.0.3)
actionpack (= 3.0.3)
activesupport (= 3.0.3)
railties (= 3.0.20)
railties (3.0.20)
actionpack (= 3.0.20)
activesupport (= 3.0.20)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (~> 0.14.4)
rake (10.0.2)
rake (10.0.3)
rbx-require-relative (0.0.9)
rspec (2.12.0)
rspec-core (~> 2.12.0)
rspec-expectations (~> 2.12.0)
rspec-mocks (~> 2.12.0)
rspec-core (2.12.0)
rspec-expectations (2.12.0)
diff-lcs (~> 1.1.3)
rspec-mocks (2.12.0)
rspec-rails (2.12.0)
rdoc (3.12.2)
json (~> 1.4)
rspec (2.13.0)
rspec-core (~> 2.13.0)
rspec-expectations (~> 2.13.0)
rspec-mocks (~> 2.13.0)
rspec-core (2.13.0)
rspec-expectations (2.13.0)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.13.0)
rspec-rails (2.13.0)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 2.12.0)
rspec-expectations (~> 2.12.0)
rspec-mocks (~> 2.12.0)
rspec_candy (0.2.1)
rspec-core (~> 2.13.0)
rspec-expectations (~> 2.13.0)
rspec-mocks (~> 2.13.0)
rspec_candy (0.2.8)
rspec
sneaky-save
ruby-debug (0.10.4)
columnize (>= 0.1)
ruby-debug-base (~> 0.10.4.0)
ruby-debug-base (0.10.4)
linecache (>= 0.3)
sqlite3 (1.3.6)
sneaky-save (0.0.2)
activerecord (>= 2.3.2)
sqlite3 (1.3.7)
thor (0.14.6)
treetop (1.4.12)
polyglot
Expand All @@ -104,7 +118,8 @@ PLATFORMS

DEPENDENCIES
assignable_values!
rails (= 3.0.3)
debugger
rails (~> 3.0.3)
rspec
rspec-rails
rspec_candy
Expand Down
2 changes: 1 addition & 1 deletion spec/rails-3.0/app_root/config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Bundler.require(:default, Rails.env) if defined?(Bundler)


module HasDefaultSpecApp
module SpecApp
class Application < Rails::Application
config.encoding = "utf-8"

Expand Down
2 changes: 1 addition & 1 deletion spec/rails-3.0/app_root/config/environment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
require File.expand_path('../application', __FILE__)

# Initialize the rails application
HasDefaultSpecApp::Application.initialize!
SpecApp::Application.initialize!
2 changes: 1 addition & 1 deletion spec/rails-3.0/app_root/config/environments/test.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
HasDefaultSpecApp::Application.configure do
SpecApp::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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# 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.
HasDefaultSpecApp::Application.config.secret_token = 'cb014a08a45243e7143f31e04774c342c1fba329fd594ae1a480d8283b1a851f425dc08044311fb4be6d000b6e6681de7c76d19148419a5ffa0a9f84556d3b33'
SpecApp::Application.config.secret_token = 'cb014a08a45243e7143f31e04774c342c1fba329fd594ae1a480d8283b1a851f425dc08044311fb4be6d000b6e6681de7c76d19148419a5ffa0a9f84556d3b33'
Loading

0 comments on commit 0c41f73

Please sign in to comment.