-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathRakefile
75 lines (64 loc) · 1.49 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
69
70
71
72
73
74
75
require 'rdoc/task'
require 'rake/clean'
require 'rake/testtask'
module Support
def self.list_gems
fh = {}
(Dir["*.gem"]).each do |f|
if f =~ /(.+)-(\d+\.\d+\.\d+)\.gem/
fh[$1] = [] unless fh[$1]
fh[$1] << $2
end
end
return fh
end
def self.gem_last_version
fh = Support.list_gems
fh.keys.each do |k|
yield "#{k}-#{(fh[k].sort)[-1]}.gem"
end
end
end
RDoc::Task.new do |rdoc|
rdoc.main = "README.doc"
rdoc.rdoc_dir ="./docs"
rdoc.rdoc_files.include(
"README.md", "lib/*.rb", "lib/*/*.rb")
rdoc.options << "--markup" << "markdown"
rdoc.options << "--all"
end
CLEAN << Dir["*.gem"]
desc "Build local gems file"
task :build do
(Dir["*.gemspec"]).each do |gs|
`gem build #{gs}`
end
end
desc "Install last version of the compiled gem"
task :install do
Support.gem_last_version do |g|
puts "Installing gem: #{g}"
`gem install #{g}`
end
end
desc "Publish last version of the compiled gem"
task :publish => [:build, :install] do
Support.gem_last_version do |g|
puts "New commit for gem: #{g}"
`echo git add .`
`echo git commit -m \"publishing version: #{g}\"`
puts "Pushing gem: #{g}"
`echo gem push #{g}`
end
end
desc "Locally deploy the gem (build and install)"
task :deploy => [:rdoc, :build, :install] do
puts "Deployed"
end
desc "Run Unit Tests"
Rake::TestTask.new do |t|
t.test_files = FileList["tests/test-*.rb"]
t.verbose = true
end
desc "Runs only tests"
task :default => [:test]