Skip to content

Commit

Permalink
IN-392 Add rake console
Browse files Browse the repository at this point in the history
  • Loading branch information
Pablo Cantero committed Oct 21, 2014
1 parent 3637957 commit 9c22a35
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 11 deletions.
9 changes: 5 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ gem 'endpoint_base', github: 'spree/endpoint_base'
gem 'executrix'
gem 'honeybadger'
gem 'rollbar'
gem 'dotenv'
gem 'rake'

group :development do
gem "rake"
gem "pry"
group :development, :test do
gem 'pry'
gem 'pry-byebug'
gem 'dotenv'
end

group :test do
Expand Down
9 changes: 9 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,14 @@ GEM
thread_safe (~> 0.1)
tzinfo (~> 1.1)
addressable (2.3.6)
byebug (2.7.0)
columnize (~> 0.3)
debugger-linecache (~> 1.2)
coderay (1.1.0)
columnize (0.8.9)
crack (0.4.2)
safe_yaml (~> 1.0.0)
debugger-linecache (1.2.0)
diff-lcs (1.2.5)
dotenv (0.11.1)
dotenv-deployment (~> 0.0.2)
Expand Down Expand Up @@ -58,6 +63,9 @@ GEM
coderay (~> 1.0)
method_source (~> 0.8)
slop (~> 3.4)
pry-byebug (1.3.2)
byebug (~> 2.7)
pry (~> 0.9.12)
rack (1.5.2)
rack-protection (1.5.2)
rack
Expand Down Expand Up @@ -114,6 +122,7 @@ DEPENDENCIES
foreman
honeybadger
pry
pry-byebug
rack-test
rake
restforce
Expand Down
28 changes: 28 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
$stdout.sync = true

desc 'Open pry console'
task :console do
require 'pry'
require_relative 'lib/salesforce_integration'

env_file = File.join File.expand_path('..', __FILE__), '.env'

if File.exist? env_file
require 'dotenv'
Dotenv.load

@client = Restforce.new(username: ENV['SALESFORCE_USERNAME'],
password: ENV['SALESFORCE_PASSWORD'],
security_token: ENV['SALESFORCE_SECURITY_TOKEN'],
client_id: ENV['SALESFORCE_CLIENT_ID'],
client_secret: ENV['SALESFORCE_CLIENT_SECRET'])
end

def client
@client
end

ARGV.clear
Pry.start
end

14 changes: 7 additions & 7 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
require 'salesforce_integration'
require File.join(File.dirname(__FILE__), '..', 'salesforce_endpoint')

Dir["./spec/support/**/*.rb"].each { |f| require f }
Dir["./spec/support/**/*.rb"].each &method(:require)

require 'spree/testing_support/controllers'

Expand All @@ -21,12 +21,12 @@
c.allow_http_connections_when_no_cassette = true
c.cassette_library_dir = 'spec/cassettes'
c.hook_into :webmock
c.filter_sensitive_data('spree_user') {|_| ENV['SALESFORCE_USERNAME'] }
c.filter_sensitive_data('spree_user') {|_| ENV['SALESFORCE_USERNAME'].gsub('@','%40') }
c.filter_sensitive_data('spree_pwd') {|_| ENV['SALESFORCE_PASSWORD'] }
c.filter_sensitive_data('spree_sec') {|_| ENV['SALESFORCE_SECURITY_TOKEN'] }
c.filter_sensitive_data('spree_id') {|_| ENV['SALESFORCE_CLIENT_ID'] }
c.filter_sensitive_data('spree_secret') {|_| ENV['SALESFORCE_CLIENT_SECRET'] }
c.filter_sensitive_data('spree_user') { |_| ENV['SALESFORCE_USERNAME'] }
c.filter_sensitive_data('spree_user') { |_| ENV['SALESFORCE_USERNAME'].gsub('@','%40') }
c.filter_sensitive_data('spree_pwd') { |_| ENV['SALESFORCE_PASSWORD'] }
c.filter_sensitive_data('spree_sec') { |_| ENV['SALESFORCE_SECURITY_TOKEN'] }
c.filter_sensitive_data('spree_id') { |_| ENV['SALESFORCE_CLIENT_ID'] }
c.filter_sensitive_data('spree_secret') { |_| ENV['SALESFORCE_CLIENT_SECRET'] }
end

RSpec.configure do |config|
Expand Down

0 comments on commit 9c22a35

Please sign in to comment.