Skip to content

Commit 015d53a

Browse files
committed
setup continuous integration testing with Travis-CI
1 parent 1fc2f10 commit 015d53a

10 files changed

Lines changed: 195 additions & 68 deletions

.rspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--color

.travis.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
rvm:
2+
- 1.8.7
3+
- 1.9.2
4+
gemfile:
5+
- Gemfile
6+
- Gemfile.rails3.0
7+
before_script:
8+
- "mysql -e 'create database will_paginate;'"
9+
- "psql -c 'create database will_paginate;' -U postgres"
10+
env:
11+
- DB=sqlite3
12+
- DB=mysql
13+
- DB=mysql2
14+
- DB=postgres
15+
branches:
16+
only:
17+
- rails3

Gemfile

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,29 @@
1-
source :rubygems
1+
source 'http://rubygems.org'
22

3-
# path '/Users/mislav/.coral/rails-rails'
4-
# git 'git://github.com/rails/rails.git'
3+
rails_version = '~> 3.1.0.rc'
4+
5+
gem 'activerecord', rails_version
6+
gem 'activeresource', rails_version
7+
gem 'actionpack', rails_version
58

69
gem 'rake'
7-
gem 'activerecord', '~> 3.1.0.rc'
8-
gem 'activeresource', '~> 3.1.0.rc'
9-
gem 'actionpack', '~> 3.1.0.rc'
10-
gem 'sequel', '~> 3.8'
1110
gem 'rspec', '~> 2.6.0'
1211
gem 'mocha', '~> 0.9.8'
12+
13+
gem 'sequel', '~> 3.8'
1314
gem 'sqlite3', '~> 1.3.3'
1415
gem 'dm-core'
1516
gem 'dm-aggregates'
1617
gem 'dm-migrations'
1718
gem 'dm-sqlite-adapter'
18-
gem 'mysql', '~> 2.8.1', :group => :mysql
19-
gem 'pg', '~> 0.8.0', :group => :pg
19+
20+
group :mysql do
21+
gem 'mysql', '~> 2.8.1'
22+
gem 'mysql2', '>= 0.3.6'
23+
end
24+
gem 'pg', '~> 0.11', :group => :pg
2025

2126
group :debug do
2227
gem 'ruby-debug', :platforms => :mri_18
2328
gem 'ruby-debug19', :platforms => :mri_19
24-
end
29+
end unless ENV['TRAVIS']

Gemfile.lock

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ GEM
3232
arel (2.1.4)
3333
bcrypt-ruby (2.1.4)
3434
builder (3.0.0)
35-
columnize (0.3.1)
35+
columnize (0.3.4)
3636
data_objects (0.10.6)
3737
addressable (~> 2.1)
3838
diff-lcs (1.1.2)
@@ -53,22 +53,24 @@ GEM
5353
erubis (2.7.0)
5454
hike (1.2.0)
5555
i18n (0.6.0)
56-
linecache (0.43)
56+
linecache (0.46)
57+
rbx-require-relative (> 0.0.4)
5758
linecache19 (0.5.12)
5859
ruby_core_source (>= 0.1.4)
59-
mocha (0.9.8)
60-
rake
60+
mocha (0.9.12)
6161
multi_json (1.0.3)
6262
mysql (2.8.1)
63-
pg (0.8.0)
63+
mysql2 (0.3.6)
64+
pg (0.11.0)
6465
rack (1.3.2)
6566
rack-cache (1.0.2)
6667
rack (>= 0.4)
6768
rack-mount (0.8.1)
6869
rack (>= 1.0.0)
69-
rack-test (0.6.0)
70+
rack-test (0.6.1)
7071
rack (>= 1.0)
71-
rake (0.8.7)
72+
rake (0.9.2)
73+
rbx-require-relative (0.0.5)
7274
rspec (2.6.0)
7375
rspec-core (~> 2.6.0)
7476
rspec-expectations (~> 2.6.0)
@@ -77,10 +79,10 @@ GEM
7779
rspec-expectations (2.6.0)
7880
diff-lcs (~> 1.1.2)
7981
rspec-mocks (2.6.0)
80-
ruby-debug (0.10.3)
82+
ruby-debug (0.10.4)
8183
columnize (>= 0.1)
82-
ruby-debug-base (~> 0.10.3.0)
83-
ruby-debug-base (0.10.3)
84+
ruby-debug-base (~> 0.10.4.0)
85+
ruby-debug-base (0.10.4)
8486
linecache (>= 0.3)
8587
ruby-debug-base19 (0.11.25)
8688
columnize (>= 0.3.1)
@@ -96,7 +98,7 @@ GEM
9698
sprockets (2.0.0.beta.12)
9799
hike (~> 1.2)
98100
rack (~> 1.0)
99-
tilt (~> 1.1, != 1.3.0)
101+
tilt (!= 1.3.0, ~> 1.1)
100102
sqlite3 (1.3.3)
101103
tilt (1.3.2)
102104
tzinfo (0.3.29)
@@ -114,7 +116,8 @@ DEPENDENCIES
114116
dm-sqlite-adapter
115117
mocha (~> 0.9.8)
116118
mysql (~> 2.8.1)
117-
pg (~> 0.8.0)
119+
mysql2 (>= 0.3.6)
120+
pg (~> 0.11)
118121
rake
119122
rspec (~> 2.6.0)
120123
ruby-debug

Gemfile.rails3.0

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
source 'http://rubygems.org'
2+
3+
rails_version = '~> 3.0.0'
4+
5+
gem 'activerecord', rails_version
6+
gem 'activeresource', rails_version
7+
gem 'actionpack', rails_version
8+
9+
gem 'rake'
10+
gem 'rspec', '~> 2.6.0'
11+
gem 'mocha', '~> 0.9.8'
12+
13+
gem 'sqlite3', '~> 1.3.3'
14+
15+
group :mysql do
16+
gem 'mysql', '~> 2.8.1'
17+
gem 'mysql2', '>= 0.3.6'
18+
end
19+
gem 'pg', '~> 0.11', :group => :pg
20+
21+
group :debug do
22+
gem 'ruby-debug', :platforms => :mri_18
23+
gem 'ruby-debug19', :platforms => :mri_19
24+
end unless ENV['TRAVIS']

Gemfile.rails3.0.lock

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
GEM
2+
remote: http://rubygems.org/
3+
specs:
4+
abstract (1.0.0)
5+
actionpack (3.0.9)
6+
activemodel (= 3.0.9)
7+
activesupport (= 3.0.9)
8+
builder (~> 2.1.2)
9+
erubis (~> 2.6.6)
10+
i18n (~> 0.5.0)
11+
rack (~> 1.2.1)
12+
rack-mount (~> 0.6.14)
13+
rack-test (~> 0.5.7)
14+
tzinfo (~> 0.3.23)
15+
activemodel (3.0.9)
16+
activesupport (= 3.0.9)
17+
builder (~> 2.1.2)
18+
i18n (~> 0.5.0)
19+
activerecord (3.0.9)
20+
activemodel (= 3.0.9)
21+
activesupport (= 3.0.9)
22+
arel (~> 2.0.10)
23+
tzinfo (~> 0.3.23)
24+
activeresource (3.0.9)
25+
activemodel (= 3.0.9)
26+
activesupport (= 3.0.9)
27+
activesupport (3.0.9)
28+
archive-tar-minitar (0.5.2)
29+
arel (2.0.10)
30+
builder (2.1.2)
31+
columnize (0.3.4)
32+
diff-lcs (1.1.2)
33+
erubis (2.6.6)
34+
abstract (>= 1.0.0)
35+
i18n (0.5.0)
36+
linecache (0.46)
37+
rbx-require-relative (> 0.0.4)
38+
linecache19 (0.5.12)
39+
ruby_core_source (>= 0.1.4)
40+
mocha (0.9.12)
41+
mysql (2.8.1)
42+
mysql2 (0.3.6)
43+
pg (0.11.0)
44+
rack (1.2.3)
45+
rack-mount (0.6.14)
46+
rack (>= 1.0.0)
47+
rack-test (0.5.7)
48+
rack (>= 1.0)
49+
rake (0.9.2)
50+
rbx-require-relative (0.0.5)
51+
rspec (2.6.0)
52+
rspec-core (~> 2.6.0)
53+
rspec-expectations (~> 2.6.0)
54+
rspec-mocks (~> 2.6.0)
55+
rspec-core (2.6.4)
56+
rspec-expectations (2.6.0)
57+
diff-lcs (~> 1.1.2)
58+
rspec-mocks (2.6.0)
59+
ruby-debug (0.10.4)
60+
columnize (>= 0.1)
61+
ruby-debug-base (~> 0.10.4.0)
62+
ruby-debug-base (0.10.4)
63+
linecache (>= 0.3)
64+
ruby-debug-base19 (0.11.25)
65+
columnize (>= 0.3.1)
66+
linecache19 (>= 0.5.11)
67+
ruby_core_source (>= 0.1.4)
68+
ruby-debug19 (0.11.6)
69+
columnize (>= 0.3.1)
70+
linecache19 (>= 0.5.11)
71+
ruby-debug-base19 (>= 0.11.19)
72+
ruby_core_source (0.1.5)
73+
archive-tar-minitar (>= 0.5.2)
74+
sqlite3 (1.3.4)
75+
tzinfo (0.3.29)
76+
77+
PLATFORMS
78+
ruby
79+
80+
DEPENDENCIES
81+
actionpack (~> 3.0.0)
82+
activerecord (~> 3.0.0)
83+
activeresource (~> 3.0.0)
84+
mocha (~> 0.9.8)
85+
mysql (~> 2.8.1)
86+
mysql2 (>= 0.3.6)
87+
pg (~> 0.11)
88+
rake
89+
rspec (~> 2.6.0)
90+
ruby-debug
91+
ruby-debug19
92+
sqlite3 (~> 1.3.3)

Rakefile

Lines changed: 19 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,25 @@
1-
require 'rake/rdoctask'
2-
require 'rspec/core/rake_task'
1+
begin
2+
require 'rspec/core/rake_task'
3+
rescue LoadError
4+
# no spec tasks
5+
else
6+
task :default => :spec
37

4-
task :default => :spec
5-
6-
desc 'Run ALL OF the specs'
7-
RSpec::Core::RakeTask.new(:spec) do |t|
8-
# t.ruby_opts = '-w'
9-
end
10-
11-
namespace :spec do
12-
desc "Run Rails specs"
13-
RSpec::Core::RakeTask.new(:rails) do |t|
14-
t.pattern = %w'spec/finders/active_record_spec.rb spec/view_helpers/action_view_spec.rb'
8+
desc 'Run ALL OF the specs'
9+
RSpec::Core::RakeTask.new(:spec) do |t|
10+
# t.ruby_opts = '-w'
11+
t.pattern = 'spec/finders/active_record_spec.rb' if ENV['DB'] and ENV['DB'] != 'sqlite3'
1512
end
16-
end
1713

18-
desc 'Generate RDoc documentation for the will_paginate plugin.'
19-
Rake::RDocTask.new(:rdoc) do |rdoc|
20-
rdoc.rdoc_files.include('README.rdoc', 'LICENSE', 'CHANGELOG.rdoc').
21-
include('lib/**/*.rb').
22-
exclude('lib/will_paginate/finders/active_record/named_scope*').
23-
exclude('lib/will_paginate/finders/sequel.rb').
24-
exclude('lib/will_paginate/view_helpers/merb.rb').
25-
exclude('lib/will_paginate/deprecation.rb').
26-
exclude('lib/will_paginate/core_ext.rb').
27-
exclude('lib/will_paginate/version.rb')
28-
29-
rdoc.main = "README.rdoc" # page to start on
30-
rdoc.title = "will_paginate documentation"
31-
32-
rdoc.rdoc_dir = 'doc' # rdoc output folder
33-
rdoc.options << '--inline-source' << '--charset=UTF-8'
34-
rdoc.options << '--webcvs=http://github.com/mislav/will_paginate/tree/master/'
14+
namespace :spec do
15+
desc "Run Rails specs"
16+
RSpec::Core::RakeTask.new(:rails) do |t|
17+
t.pattern = %w'spec/finders/active_record_spec.rb spec/view_helpers/action_view_spec.rb'
18+
end
19+
end
3520
end
3621

37-
task :website do
38-
Dir.chdir('website') do
39-
%x(haml index.haml index.html)
40-
%x(sass pagination.sass pagination.css)
41-
end
22+
desc 'Run specs against both Rails 3.1 and Rails 3.0'
23+
task :rails3 do |variable|
24+
system 'bundle exec rake spec && BUNDLE_GEMFILE=Gemfile.rails3.0 bundle exec rake spec:rails'
4225
end

spec/database.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@ sqlite3:
33
adapter: sqlite3
44
timeout: 500
55

6-
sqlite2:
7-
database: ":memory:"
8-
adapter: sqlite2
9-
106
mysql:
117
adapter: mysql
12-
username: rails
13-
password: mislav
8+
database: will_paginate
9+
username:
10+
encoding: utf8
11+
12+
mysql2:
13+
adapter: mysql2
14+
database: will_paginate
15+
username:
1416
encoding: utf8
15-
database: will_paginate_unittest
1617

1718
postgres:
1819
adapter: postgresql
19-
username: mislav
20-
password: mislav
21-
database: will_paginate_unittest
20+
database: will_paginate
21+
username: postgres
2222
min_messages: warning

spec/finders/active_record_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
ActiverecordTestConnector.setup
55

66
WillPaginate::ActiveRecord.setup
7+
abort unless ActiverecordTestConnector.able_to_connect
78

89
describe WillPaginate::ActiveRecord do
910

spec/finders/data_mapper_test_connector.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
require 'sqlite3'
12
require 'dm-core'
23
require 'dm-core/support/logger'
34
require 'dm-migrations'

0 commit comments

Comments
 (0)