Last active
August 29, 2015 13:57
-
-
Save we4tech/9365394 to your computer and use it in GitHub Desktop.
Basic standalone rake/thor based project bootstrap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Define root dirctory | |
ROOT_DIR = File.dirname(__FILE__) | |
# Set PROJ_ENV as environment variable | |
PROJ_ENV = ENV['PROJ_ENV'] || (ENV['PROJ_ENV'] = 'development') | |
# Load gems from the Gemfile | |
require 'bundler/setup' | |
Bundler.require(:default, PROJ_ENV.to_sym) | |
# Load required core libraries | |
# Include lib as common load path | |
$LOAD_PATH.unshift File.join(ROOT_DIR, 'lib') | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'https://rubygems.org' | |
# Core libraries | |
gem 'rake' | |
gem 'activesupport' | |
gem 'bson_ext' | |
# Add gems related with content parsing | |
gem 'nokogiri' | |
# Add gems related with datababase | |
gem 'mongo_mapper', '~> 0.12.0' | |
# Add Sidekiq related gems | |
gem 'redis' | |
gem 'sidekiq' | |
gem 'sidekiq-unique-jobs' | |
gem 'slim' | |
gem 'sinatra', '~> 1.4.4' | |
group :development, :test do | |
gem 'bond' | |
gem 'pry' | |
gem 'pry-debugger' | |
gem 'factory_girl' | |
end | |
group :test do | |
gem 'database_cleaner' | |
gem 'rspec' | |
gem 'rspec-sidekiq' | |
gem 'vcr' | |
gem 'webmock' | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ENV['PROJ_ENV'] = 'test' | |
require_relative '../boot' | |
RSpec.configure do |config| | |
config.before(:suite) do | |
DatabaseCleaner[:mongo_mapper].clean_with(:truncation) | |
end | |
config.before(:each) do | |
DatabaseCleaner[:mongo_mapper].strategy = :truncation | |
end | |
config.after(:each) do | |
DatabaseCleaner[:mongo_mapper].clean | |
end | |
config.after(:all) do | |
DatabaseCleaner[:mongo_mapper].clean_with(:truncation) | |
end | |
config.order = 'random' | |
end | |
VCR.configure do |c| | |
c.cassette_library_dir = TweekDumper.root_path.join('spec', 'fixtures', 'vcr_cassettes') | |
c.hook_into :webmock | |
end | |
RSpec::Sidekiq.configure do |config| | |
# Clears all job queues before each example | |
config.clear_all_enqueued_jobs = true # default => true | |
# Whether to use terminal colours when outputting messages | |
config.enable_terminal_colours = true # default => true | |
# Warn when jobs are not enqueued to Redis but to a job array | |
config.warn_when_jobs_not_processed_by_sidekiq = true # default => true | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment