forked from coingecko/cryptoexchange
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
68 lines (52 loc) · 1.93 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
require "bundler/gem_tasks"
require "rspec/core/rake_task"
RSpec::Core::RakeTask.new(:spec)
task :default => :spec
task :console do
require 'pry'
require 'cryptoexchange'
def reload!
files = $LOADED_FEATURES.select { |feat| feat =~ /\/cryptoexchange\// }
files.each { |file| load file }
end
ARGV.clear
Pry.start
end
task :add_exchange do
exchange_name = ARGV.last
if ARGV.count == 2
FileUtils.mkdir "lib/cryptoexchange/exchanges/#{exchange_name}/"
FileUtils.mkdir "lib/cryptoexchange/exchanges/#{exchange_name}/services/"
FileUtils.mkdir "spec/exchanges/#{exchange_name}/"
FileUtils.mkdir "spec/exchanges/#{exchange_name}/integration/"
File.new("lib/cryptoexchange/exchanges/#{exchange_name}/market.rb", "a")
File.new("lib/cryptoexchange/exchanges/#{exchange_name}/services/pairs.rb", "a")
File.new("lib/cryptoexchange/exchanges/#{exchange_name}/services/market.rb", "a")
File.new("lib/cryptoexchange/exchanges/#{exchange_name}/services/order_book.rb", "a")
File.new("lib/cryptoexchange/exchanges/#{exchange_name}/services/trades.rb", "a")
File.new("spec/exchanges/#{exchange_name}/market_spec.rb", "a")
File.new("spec/exchanges/#{exchange_name}/integration/market_spec.rb", "a")
task puts "#{exchange_name} create successfully"
else
task puts "Please insert correct exchange name"
end
task exchange_name.to_sym do ; end
end
task :reset_cassette do
require 'pry'
puts ARGV
exchange_name = ARGV.last
if exchange_name.nil?
puts "no exchange name given."
next
end
exchange_name = exchange_name.capitalize
cassette_types = ["pairs", "ticker", "order_book", "trade"]
cassette_paths = cassette_types.map do |cassette_type|
"spec/cassettes/vcr_cassettes/#{exchange_name}/integration_specs_fetch_#{cassette_type}.yml"
end
cassette_paths.each do |path|
File.delete(path) if File.exist?(path)
puts "#{path} deleted for #{exchange_name}"
end
end