-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathRakefile
54 lines (41 loc) · 1.29 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
require "bundler/gem_tasks"
require 'rake/testtask'
APP_NAME = "scottjbarr-nasdaq"
# Host or location to copy gem to. At the moment this is only a local copy
# operation
GEM_LOCAL = "/Users/scott/.gems-repository"
# Details of theremote server to upload the gem to
GEM_HOST = "gems.signalvsnoise.com"
GEM_HOST_USER = "root"
SSH_KEY = "#{ENV['HOME']}/.ssh/scott-signalvsnoise.key"
Rake::TestTask.new("test:units") { |test|
%w{. lib test}.each { |dir| test.libs << dir }
test.test_files = FileList["test/test_*.rb"].exclude("test/test_helper.rb", "test/vendor")
test.verbose = false
# test.warning = true
}
task :console do
require 'irb'
require 'irb/completion'
require "#{APP_NAME}" # You know what to do.
ARGV.clear
IRB.start
end
task :test => ["test:units"]
def get_version
Nasdaq::VERSION
end
task :upload_local do
# place the gem in the local repository
gem_file = "pkg/#{APP_NAME}-#{get_version}.gem"
system "cp #{gem_file} #{GEM_LOCAL}/gems/"
# update the gem index
system "cd #{GEM_LOCAL} && gem generate_index -d ."
end
task :sync_remote do
system "cd #{GEM_LOCAL} && rsync -auvz -e 'ssh -i #{SSH_KEY}' . #{GEM_HOST_USER}@#{GEM_HOST}:/var/www/gems/"
end
task :clean do
system "rm -rf pkg"
end
task :publish => [ :test, :build, :upload_local, :sync_remote, :clean]