diff --git a/Gemfile b/Gemfile index 1b62b2e9..2a5e60a0 100644 --- a/Gemfile +++ b/Gemfile @@ -6,3 +6,5 @@ gem 'rack-rewrite' gem 'sinatra' gem 'sinatra-param' gem 'puma' +gem 'rake' +gem 'pry' diff --git a/Gemfile.lock b/Gemfile.lock index 7a136649..4beb1b39 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,25 +1,35 @@ GEM remote: https://rubygems.org/ specs: + coderay (1.1.0) + method_source (0.8.2) + pry (0.10.1) + coderay (~> 1.1.0) + method_source (~> 0.8.1) + slop (~> 3.4) puma (2.10.2) rack (>= 1.1, < 2.0) rack (1.6.0) rack-protection (1.5.3) rack rack-rewrite (1.5.1) + rake (10.4.2) sinatra (1.4.5) rack (~> 1.4) rack-protection (~> 1.4) tilt (~> 1.3, >= 1.3.4) sinatra-param (1.2.2) sinatra (~> 1.3) + slop (3.6.0) tilt (1.4.1) PLATFORMS ruby DEPENDENCIES + pry puma rack-rewrite + rake sinatra sinatra-param diff --git a/Rakefile b/Rakefile new file mode 100644 index 00000000..5b918ac8 --- /dev/null +++ b/Rakefile @@ -0,0 +1,27 @@ +require "bundler" +require 'rake' +require 'rake/clean' + +include Rake::DSL + +# All the bacon specifications +PROJECT_SPECS = Dir.glob(File.expand_path('../spec/**/*.rb', __FILE__)) +PROJECT_SPECS.reject! { |e| e =~ /helper\.rb/ } +PROJECT_SPECS.reject! { |e| e =~ /init\.rb/ } + +CLEAN.include %w[ + **/.*.sw? + *.gem + .config + **/*~ + **/{vttroute-*.db,cache.yaml} + *.yaml + pkg + rdoc + public/doc + *coverage* +] + +Dir.glob(File.expand_path('../tasks/*.rake', __FILE__)).each do |f| + import(f) +end diff --git a/tasks/pry.rake b/tasks/pry.rake new file mode 100644 index 00000000..55a69d0a --- /dev/null +++ b/tasks/pry.rake @@ -0,0 +1,20 @@ +# coding: utf-8 + +ENV['RACK_ENV'] = 'development' +namespace :pry do + task :load_config do + require 'rubygems' + require 'bundler' + + Bundler.require( :default, ENV['RACK_ENV'].to_sym ) # require tout les gems définis dans Gemfile + + require_relative '../lib/ledger' + require_relative '../config/options' + end + + desc 'Open pry with DB environment setup' + task pry: :load_config do + pry.binding + end + +end