Skip to content
Browse files

update to use bundler and rspec2

  • Loading branch information...
1 parent f66a12d commit c291ca33ad668c3230148144978cba3606e75349 @zapnap committed
Showing with 121 additions and 20 deletions.
  1. +4 −0 .gitignore
  2. +13 −0 Gemfile
  3. +90 −0 Gemfile.lock
  4. +2 −1 README.rdoc
  5. +7 −13 Rakefile
  6. +1 −1 config.ru
  7. +1 −2 environment.rb
  8. +3 −3 spec/spec_helper.rb
View
4 .gitignore
@@ -0,0 +1,4 @@
+*.db
+*.sqlite3
+.bundle/*
+log/*
View
13 Gemfile
@@ -0,0 +1,13 @@
+source :rubygems
+gem 'sinatra', '>= 1.0'
+gem 'rake'
+gem 'rspec', :require => 'spec'
+gem 'data_mapper'
+gem 'rack-test'
+gem 'dm-core'
+gem 'dm-sqlite-adapter'
+gem 'dm-timestamps'
+gem 'dm-validations'
+gem 'dm-aggregates'
+gem 'dm-migrations'
+gem 'haml'
View
90 Gemfile.lock
@@ -0,0 +1,90 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ addressable (2.2.2)
+ data_mapper (1.0.2)
+ dm-aggregates (= 1.0.2)
+ dm-constraints (= 1.0.2)
+ dm-core (= 1.0.2)
+ dm-migrations (= 1.0.2)
+ dm-serializer (= 1.0.2)
+ dm-timestamps (= 1.0.2)
+ dm-transactions (= 1.0.2)
+ dm-types (= 1.0.2)
+ dm-validations (= 1.0.2)
+ data_objects (0.10.2)
+ addressable (~> 2.1)
+ diff-lcs (1.1.2)
+ dm-aggregates (1.0.2)
+ dm-core (~> 1.0.2)
+ dm-constraints (1.0.2)
+ dm-core (~> 1.0.2)
+ dm-migrations (~> 1.0.2)
+ dm-core (1.0.2)
+ addressable (~> 2.2)
+ extlib (~> 0.9.15)
+ dm-do-adapter (1.0.2)
+ data_objects (~> 0.10.2)
+ dm-core (~> 1.0.2)
+ dm-migrations (1.0.2)
+ dm-core (~> 1.0.2)
+ dm-serializer (1.0.2)
+ dm-core (~> 1.0.2)
+ fastercsv (~> 1.5.3)
+ json_pure (~> 1.4)
+ dm-sqlite-adapter (1.0.2)
+ dm-do-adapter (~> 1.0.2)
+ do_sqlite3 (~> 0.10.2)
+ dm-timestamps (1.0.2)
+ dm-core (~> 1.0.2)
+ dm-transactions (1.0.2)
+ dm-core (~> 1.0.2)
+ dm-types (1.0.2)
+ dm-core (~> 1.0.2)
+ fastercsv (~> 1.5.3)
+ json_pure (~> 1.4)
+ stringex (~> 1.1.0)
+ uuidtools (~> 2.1.1)
+ dm-validations (1.0.2)
+ dm-core (~> 1.0.2)
+ do_sqlite3 (0.10.2)
+ data_objects (= 0.10.2)
+ extlib (0.9.15)
+ fastercsv (1.5.3)
+ haml (3.0.24)
+ json_pure (1.4.6)
+ rack (1.2.1)
+ rack-test (0.5.6)
+ rack (>= 1.0)
+ rake (0.8.7)
+ rspec (2.1.0)
+ rspec-core (~> 2.1.0)
+ rspec-expectations (~> 2.1.0)
+ rspec-mocks (~> 2.1.0)
+ rspec-core (2.1.0)
+ rspec-expectations (2.1.0)
+ diff-lcs (~> 1.1.2)
+ rspec-mocks (2.1.0)
+ sinatra (1.1.0)
+ rack (~> 1.1)
+ tilt (~> 1.1)
+ stringex (1.1.0)
+ tilt (1.1)
+ uuidtools (2.1.1)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ data_mapper
+ dm-aggregates
+ dm-core
+ dm-migrations
+ dm-sqlite-adapter
+ dm-timestamps
+ dm-validations
+ haml
+ rack-test
+ rake
+ rspec
+ sinatra (>= 1.0)
View
3 README.rdoc
@@ -1,7 +1,7 @@
= Sinatra Application Template
A base Sinatra application template. Just fork and build. Yay!
-Includes DataMapper, RSpec, and Haml, all ready to go.
+Includes Bundler, DataMapper, RSpec2, and Haml, all ready to go.
== Configuration
@@ -17,5 +17,6 @@ Add your specs in <tt>spec</tt>; just require <tt>spec_helper.rb</tt> to pre-con
== Getting Started
+ bundle install
rake db:migrate
ruby application.rb
View
20 Rakefile
@@ -1,15 +1,17 @@
-require 'spec/rake/spectask'
+require 'rubygems'
+require 'bundler/setup'
+require 'rspec/core/rake_task'
task :default => :test
task :test => :spec
-if !defined?(Spec)
+if !defined?(RSpec)
puts "spec targets require RSpec"
else
desc "Run all examples"
- Spec::Rake::SpecTask.new('spec') do |t|
- t.spec_files = FileList['spec/**/*.rb']
- t.spec_opts = ['-cfs']
+ RSpec::Core::RakeTask.new(:spec) do |t|
+ t.pattern = 'spec/**/*.rb'
+ t.rspec_opts = ['-cfs']
end
end
@@ -25,14 +27,6 @@ namespace :db do
end
end
-namespace :gems do
- desc 'Install required gems'
- task :install do
- required_gems = %w{ sinatra rspec rack-test data_mapper dm-sqlite-adapter haml }
- required_gems.each { |required_gem| system "sudo gem install #{required_gem}" }
- end
-end
-
task :environment do
require 'environment'
end
View
2 config.ru
@@ -1,4 +1,4 @@
-require 'application'
+require File.join(File.dirname(__FILE__), 'application')
set :run, false
set :environment, :production
View
3 environment.rb
@@ -1,4 +1,5 @@
require 'rubygems'
+require 'bundler/setup'
require 'dm-core'
require 'dm-timestamps'
require 'dm-validations'
@@ -20,7 +21,5 @@
$LOAD_PATH.unshift("#{File.dirname(__FILE__)}/lib")
Dir.glob("#{File.dirname(__FILE__)}/lib/*.rb") { |lib| require File.basename(lib, '.*') }
-
DataMapper.setup(:default, (ENV["DATABASE_URL"] || "sqlite3:///#{File.expand_path(File.dirname(__FILE__))}/#{Sinatra::Base.environment}.db"))
-
end
View
6 spec/spec_helper.rb
@@ -1,7 +1,7 @@
require 'rubygems'
+require 'bundler/setup'
require 'sinatra'
-require 'spec'
-require 'spec/interop/test'
+require 'rspec'
require 'rack/test'
# set test environment
@@ -15,7 +15,7 @@
# establish in-memory database for testing
DataMapper.setup(:default, "sqlite3::memory:")
-Spec::Runner.configure do |config|
+Rspec.configure do |config|
# reset database before each example is run
config.before(:each) { DataMapper.auto_migrate! }
end

0 comments on commit c291ca3

Please sign in to comment.
Something went wrong with that request. Please try again.