dokkit 0.4.4 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +135 -3
- data/Manifest.txt +9 -2
- data/README.txt +35 -17
- data/Rakefile +12 -8
- data/lib/dokkit.rb +1 -1
- data/lib/dokkit/cache/cache.rb +6 -1
- data/lib/dokkit/environment.rb +1 -0
- data/lib/dokkit/environment/basic.rb +148 -122
- data/lib/dokkit/environment/container.rb +35 -0
- data/lib/dokkit/environment/helpers.rb +43 -0
- data/lib/dokkit/environment/helpers/fileselection.rb +17 -6
- data/lib/dokkit/factory/factory.rb +4 -4
- data/lib/dokkit/filters.rb +1 -0
- data/lib/dokkit/filters/maruku.rb +9 -1
- data/lib/dokkit/filters/yaml.rb +26 -0
- data/lib/dokkit/logging.rb +1 -1
- data/lib/dokkit/resource/document.rb +141 -142
- data/lib/dokkit/resource/extensions/builtin.rb +2 -0
- data/lib/dokkit/resource/extensions/url.rb +1 -1
- data/lib/dokkit/resource/filenamehelper.rb +5 -1
- data/lib/dokkit/tasklib.rb +5 -0
- data/lib/dokkit/tasklib/base.rb +36 -0
- data/lib/dokkit/tasklib/clean.rb +12 -19
- data/lib/dokkit/tasklib/render.rb +20 -24
- data/lib/models/simple/setup/setup.rb +5 -3
- data/tasks/ann.rake +81 -0
- data/tasks/bones.rake +21 -0
- data/tasks/gem.rake +67 -30
- data/tasks/git.rake +41 -0
- data/tasks/manifest.rake +30 -22
- data/tasks/notes.rake +28 -0
- data/tasks/post_load.rake +39 -0
- data/tasks/{doc.rake → rdoc.rake} +11 -9
- data/tasks/rubyforge.rake +12 -12
- data/tasks/setup.rb +189 -72
- data/tasks/spec.rake +24 -9
- data/tasks/svn.rake +15 -11
- data/tasks/test.rake +7 -9
- metadata +14 -7
- data/tasks/annotations.rake +0 -30
@@ -13,7 +13,7 @@ module Dokkit
|
|
13
13
|
def relative(href)
|
14
14
|
thr = href
|
15
15
|
if thr.is_a?(String) && href[0,1] == '/'
|
16
|
-
dtfn = File.dirname(source_fn[/^#{
|
16
|
+
dtfn = File.dirname(source_fn[/^#{env_configuration[:document_dir]}\/(.*)/,1]) + '/'
|
17
17
|
count = dtfn == './' ? 0 : dtfn.split('/').length
|
18
18
|
thr = ('../' * count) + href[1..href.length]
|
19
19
|
end
|
@@ -1,16 +1,18 @@
|
|
1
1
|
#
|
2
2
|
# File 'filenamehelper.rb' created on 21 apr 2008 at 14:25:47.
|
3
3
|
#
|
4
|
-
# See 'dokkit.rb' or +LICENSE+ for
|
4
|
+
# See 'dokkit.rb' or +LICENSE+ for license information.
|
5
5
|
#
|
6
6
|
# (C) 2006, 2007, 2008 Andrea Fazzi <andrea.fazzi@alca.le.it> (and contributors).
|
7
7
|
#
|
8
8
|
|
9
9
|
module Dokkit
|
10
10
|
module Resource
|
11
|
+
|
11
12
|
# This is a helper module that aims to simplify operation with
|
12
13
|
# filenames.
|
13
14
|
module FilenameHelper
|
15
|
+
|
14
16
|
# Return a filename transformed in its directory part and
|
15
17
|
# (optionally) in its extension.
|
16
18
|
# +fn+:: is the source filename.
|
@@ -23,6 +25,8 @@ module Dokkit
|
|
23
25
|
new_fn = new_fn << new_ext unless new_ext.empty?
|
24
26
|
new_fn
|
25
27
|
end
|
28
|
+
|
26
29
|
end
|
30
|
+
|
27
31
|
end
|
28
32
|
end
|
data/lib/dokkit/tasklib.rb
CHANGED
@@ -0,0 +1,36 @@
|
|
1
|
+
#
|
2
|
+
# File 'base.rb' created on 15 ago 2008 at 22:34:26.
|
3
|
+
#
|
4
|
+
# See 'dokkit.rb' or +LICENSE+ for license information.
|
5
|
+
#
|
6
|
+
# (C)2006-2008 Andrea Fazzi <andrea.fazzi@alca.le.it> (and contributors).
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'logger'
|
10
|
+
require 'rake/tasklib'
|
11
|
+
|
12
|
+
module Dokkit
|
13
|
+
module TaskLib
|
14
|
+
|
15
|
+
class Base < Rake::TaskLib
|
16
|
+
|
17
|
+
attr_reader :ns
|
18
|
+
attr_accessor :logger
|
19
|
+
|
20
|
+
def initialize(ns)
|
21
|
+
@ns = ns
|
22
|
+
@logger ||= Logger.new(STDOUT)
|
23
|
+
end
|
24
|
+
|
25
|
+
protected
|
26
|
+
|
27
|
+
def define_tasks
|
28
|
+
namespace @ns do
|
29
|
+
private_methods.select { |meth| meth =~ /define_.+_task/ }.each { |meth| send meth }
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
data/lib/dokkit/tasklib/clean.rb
CHANGED
@@ -6,6 +6,8 @@
|
|
6
6
|
# (C) 2008 Andrea Fazzi <andrea.fazzi@alca.le.it> (and contributors).
|
7
7
|
#
|
8
8
|
|
9
|
+
require 'dokkit/tasklib/base'
|
10
|
+
|
9
11
|
module Dokkit
|
10
12
|
module TaskLib
|
11
13
|
# The Clean task library is a collection of rake tasks devoted to
|
@@ -13,31 +15,22 @@ module Dokkit
|
|
13
15
|
# defines a clean:output that remove the generated output folder
|
14
16
|
# (if exists). It defines also a clean:cache task that remove the
|
15
17
|
# cache folder (if exists).
|
16
|
-
class Clean
|
17
|
-
|
18
|
+
class Clean < Base
|
19
|
+
|
20
|
+
attr_accessor :output_dir, :cache_dir
|
18
21
|
|
19
22
|
# Initialize the library with the logger instance, an optional
|
20
23
|
# namespace and configuration hash.
|
21
|
-
def initialize(
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
@cache_dir = configuration[:cache_dir]
|
24
|
+
def initialize(ns = 'clean')
|
25
|
+
super
|
26
|
+
|
27
|
+
yield self if block_given?
|
28
|
+
|
27
29
|
define_tasks
|
28
30
|
end
|
29
31
|
|
30
32
|
private
|
31
33
|
|
32
|
-
# Define library tasks under the given namespace.
|
33
|
-
def define_tasks
|
34
|
-
namespace @namespace do
|
35
|
-
define_output_task
|
36
|
-
define_cache_task
|
37
|
-
define_clean_all_task
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
34
|
# Define a task to remove output directory.
|
42
35
|
def define_output_task
|
43
36
|
desc "Remove the generated output."
|
@@ -60,12 +53,12 @@ module Dokkit
|
|
60
53
|
rm_rf dir unless dir == '.'
|
61
54
|
end
|
62
55
|
end
|
63
|
-
|
56
|
+
|
64
57
|
# Define a task that clean the documentation environment
|
65
58
|
# removing both output and cache directory.
|
66
59
|
def define_clean_all_task
|
67
60
|
desc "Clean the documentation environment."
|
68
|
-
task :all => ["#{@
|
61
|
+
task :all => ["#{@ns}:output", "#{@ns}:cache"]
|
69
62
|
end
|
70
63
|
|
71
64
|
end
|
@@ -1,18 +1,21 @@
|
|
1
1
|
#
|
2
2
|
# File 'render.rb' created on 18 feb 2008 at 17:47:44.
|
3
3
|
#
|
4
|
-
# See 'dokkit.rb' or +LICENSE+ for
|
4
|
+
# See 'dokkit.rb' or +LICENSE+ for license information.
|
5
5
|
#
|
6
6
|
# (C) 2008 Andrea Fazzi <andrea.fazzi@alca.le.it> (and contributors).
|
7
7
|
#
|
8
8
|
|
9
|
-
require '
|
9
|
+
require 'dokkit/tasklib/base'
|
10
10
|
|
11
11
|
module Dokkit
|
12
12
|
module TaskLib
|
13
|
+
|
13
14
|
# Render task library defines a set of rake tasks devoted to the
|
14
15
|
# transformation (rendering) of the documents and data files.
|
15
|
-
class Render <
|
16
|
+
class Render < Base
|
17
|
+
|
18
|
+
attr_accessor :document_fns, :data_fns, :resource_factory, :logger
|
16
19
|
|
17
20
|
# Initialize a set of tasks that transform resources.
|
18
21
|
# +namespace+:: is the namespace for the tasks defined in the library.
|
@@ -20,13 +23,16 @@ module Dokkit
|
|
20
23
|
# +factory+:: is a factory class that creates document instances.
|
21
24
|
# +document_fns+:: is an array of source filenames.
|
22
25
|
# +data_fns+:: is an array of data files.
|
23
|
-
def initialize(
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
@
|
26
|
+
def initialize(ns = 'render')
|
27
|
+
super
|
28
|
+
|
29
|
+
yield self if block_given?
|
30
|
+
|
31
|
+
@document_fns ||= []
|
32
|
+
@data_fns ||= []
|
33
|
+
|
29
34
|
define_tasks
|
35
|
+
|
30
36
|
end
|
31
37
|
|
32
38
|
# Use factory to get an instance of Dokkit::Resource::Document
|
@@ -62,16 +68,7 @@ module Dokkit
|
|
62
68
|
mkdir(File.dirname(data.target_fn))
|
63
69
|
cp(data.source_fn, data.target_fn, :preserve => true, :verbose => false)
|
64
70
|
end
|
65
|
-
|
66
|
-
# Define all tasks in library.
|
67
|
-
def define_tasks
|
68
|
-
namespace @namespace do
|
69
|
-
define_render_all_documents_task
|
70
|
-
define_data_task
|
71
|
-
define_render_all_task
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
71
|
+
|
75
72
|
# Define render all documents task.
|
76
73
|
def define_render_all_documents_task
|
77
74
|
desc "Render documents."
|
@@ -86,7 +83,7 @@ module Dokkit
|
|
86
83
|
|
87
84
|
def render_all_targets(document)
|
88
85
|
document.targets.each_key do |format|
|
89
|
-
render_target(document, format) if need_update?(document.target_for(format), document.deps_for(format))
|
86
|
+
render_target(document, format) if (need_update?(document.target_for(format), document.deps_for(format)) and document.render?)
|
90
87
|
end
|
91
88
|
end
|
92
89
|
|
@@ -94,7 +91,7 @@ module Dokkit
|
|
94
91
|
@logger.info("Render '#{document.source_fn}' => '#{document.target_for(format)}'.")
|
95
92
|
write_document(document.render(:format => format), document.target_for(format))
|
96
93
|
end
|
97
|
-
|
94
|
+
|
98
95
|
# Define data task.
|
99
96
|
def define_data_task
|
100
97
|
desc "Copy data files."
|
@@ -106,7 +103,7 @@ module Dokkit
|
|
106
103
|
def copy_all_data
|
107
104
|
@data_fns.each { |fn| copy_data(get_data(fn)) }
|
108
105
|
end
|
109
|
-
|
106
|
+
|
110
107
|
def copy_data(data)
|
111
108
|
if need_update?(data.target_fn, data.source_fn)
|
112
109
|
@logger.info("Copy '#{data.source_fn}' => '#{data.target_fn}'.")
|
@@ -117,7 +114,7 @@ module Dokkit
|
|
117
114
|
# Define a task that render all documents and copy all data.
|
118
115
|
def define_render_all_task
|
119
116
|
desc "Render the documents and copy the data."
|
120
|
-
task :all => ["#{@
|
117
|
+
task :all => ["#{@ns}:doc", "#{@ns}:data"]
|
121
118
|
end
|
122
119
|
|
123
120
|
private
|
@@ -134,4 +131,3 @@ module Dokkit
|
|
134
131
|
end
|
135
132
|
end
|
136
133
|
end
|
137
|
-
|
@@ -1,10 +1,12 @@
|
|
1
1
|
|
2
2
|
require 'dokkit/environment'
|
3
3
|
|
4
|
-
include Dokkit::Environment
|
4
|
+
include Dokkit::Environment
|
5
5
|
|
6
|
-
|
6
|
+
environment do |env|
|
7
7
|
|
8
|
-
|
8
|
+
env.select_document do |selection|
|
9
|
+
selection.include('**/*')
|
10
|
+
end
|
9
11
|
|
10
12
|
end
|
data/tasks/ann.rake
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
# $Id$
|
2
|
+
|
3
|
+
begin
|
4
|
+
require 'bones/smtp_tls'
|
5
|
+
rescue LoadError
|
6
|
+
require 'net/smtp'
|
7
|
+
end
|
8
|
+
require 'time'
|
9
|
+
|
10
|
+
namespace :ann do
|
11
|
+
|
12
|
+
# A prerequisites task that all other tasks depend upon
|
13
|
+
task :prereqs
|
14
|
+
|
15
|
+
file PROJ.ann.file do
|
16
|
+
ann = PROJ.ann
|
17
|
+
puts "Generating #{ann.file}"
|
18
|
+
File.open(ann.file,'w') do |fd|
|
19
|
+
fd.puts("#{PROJ.name} version #{PROJ.version}")
|
20
|
+
fd.puts(" by #{Array(PROJ.authors).first}") if PROJ.authors
|
21
|
+
fd.puts(" #{PROJ.url}") if PROJ.url.valid?
|
22
|
+
fd.puts(" (the \"#{PROJ.release_name}\" release)") if PROJ.release_name
|
23
|
+
fd.puts
|
24
|
+
fd.puts("== DESCRIPTION")
|
25
|
+
fd.puts
|
26
|
+
fd.puts(PROJ.description)
|
27
|
+
fd.puts
|
28
|
+
fd.puts(PROJ.changes.sub(%r/^.*$/, '== CHANGES'))
|
29
|
+
fd.puts
|
30
|
+
ann.paragraphs.each do |p|
|
31
|
+
fd.puts "== #{p.upcase}"
|
32
|
+
fd.puts
|
33
|
+
fd.puts paragraphs_of(PROJ.readme_file, p).join("\n\n")
|
34
|
+
fd.puts
|
35
|
+
end
|
36
|
+
fd.puts ann.text if ann.text
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
desc "Create an announcement file"
|
41
|
+
task :announcement => ['ann:prereqs', PROJ.ann.file]
|
42
|
+
|
43
|
+
desc "Send an email announcement"
|
44
|
+
task :email => ['ann:prereqs', PROJ.ann.file] do
|
45
|
+
ann = PROJ.ann
|
46
|
+
from = ann.email[:from] || PROJ.email
|
47
|
+
to = Array(ann.email[:to])
|
48
|
+
|
49
|
+
### build a mail header for RFC 822
|
50
|
+
rfc822msg = "From: #{from}\n"
|
51
|
+
rfc822msg << "To: #{to.join(',')}\n"
|
52
|
+
rfc822msg << "Subject: [ANN] #{PROJ.name} #{PROJ.version}"
|
53
|
+
rfc822msg << " (#{PROJ.release_name})" if PROJ.release_name
|
54
|
+
rfc822msg << "\n"
|
55
|
+
rfc822msg << "Date: #{Time.new.rfc822}\n"
|
56
|
+
rfc822msg << "Message-Id: "
|
57
|
+
rfc822msg << "<#{"%.8f" % Time.now.to_f}@#{ann.email[:domain]}>\n\n"
|
58
|
+
rfc822msg << File.read(ann.file)
|
59
|
+
|
60
|
+
params = [:server, :port, :domain, :acct, :passwd, :authtype].map do |key|
|
61
|
+
ann.email[key]
|
62
|
+
end
|
63
|
+
|
64
|
+
params[3] = PROJ.email if params[3].nil?
|
65
|
+
|
66
|
+
if params[4].nil?
|
67
|
+
STDOUT.write "Please enter your e-mail password (#{params[3]}): "
|
68
|
+
params[4] = STDIN.gets.chomp
|
69
|
+
end
|
70
|
+
|
71
|
+
### send email
|
72
|
+
Net::SMTP.start(*params) {|smtp| smtp.sendmail(rfc822msg, from, to)}
|
73
|
+
end
|
74
|
+
end # namespace :ann
|
75
|
+
|
76
|
+
desc 'Alias to ann:announcement'
|
77
|
+
task :ann => 'ann:announcement'
|
78
|
+
|
79
|
+
CLOBBER << PROJ.ann.file
|
80
|
+
|
81
|
+
# EOF
|
data/tasks/bones.rake
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# $Id$
|
2
|
+
|
3
|
+
if HAVE_BONES
|
4
|
+
|
5
|
+
namespace :bones do
|
6
|
+
|
7
|
+
desc 'Show the PROJ open struct'
|
8
|
+
task :debug do |t|
|
9
|
+
atr = if t.application.top_level_tasks.length == 2
|
10
|
+
t.application.top_level_tasks.pop
|
11
|
+
end
|
12
|
+
|
13
|
+
if atr then Bones::Debug.show_attr(PROJ, atr)
|
14
|
+
else Bones::Debug.show PROJ end
|
15
|
+
end
|
16
|
+
|
17
|
+
end # namespace :bones
|
18
|
+
|
19
|
+
end # HAVE_BONES
|
20
|
+
|
21
|
+
# EOF
|
data/tasks/gem.rake
CHANGED
@@ -4,77 +4,114 @@ require 'rake/gempackagetask'
|
|
4
4
|
|
5
5
|
namespace :gem do
|
6
6
|
|
7
|
-
PROJ.
|
7
|
+
PROJ.gem._spec = Gem::Specification.new do |s|
|
8
8
|
s.name = PROJ.name
|
9
9
|
s.version = PROJ.version
|
10
10
|
s.summary = PROJ.summary
|
11
11
|
s.authors = Array(PROJ.authors)
|
12
12
|
s.email = PROJ.email
|
13
13
|
s.homepage = Array(PROJ.url).first
|
14
|
-
s.rubyforge_project = PROJ.
|
14
|
+
s.rubyforge_project = PROJ.rubyforge.name
|
15
15
|
|
16
16
|
s.description = PROJ.description
|
17
17
|
|
18
|
-
PROJ.dependencies.each do |dep|
|
18
|
+
PROJ.gem.dependencies.each do |dep|
|
19
19
|
s.add_dependency(*dep)
|
20
20
|
end
|
21
21
|
|
22
|
-
s.files = PROJ.files
|
23
|
-
s.executables = PROJ.executables.map {|fn| File.basename(fn)}
|
24
|
-
s.extensions = PROJ.files.grep %r/extconf\.rb$/
|
22
|
+
s.files = PROJ.gem.files
|
23
|
+
s.executables = PROJ.gem.executables.map {|fn| File.basename(fn)}
|
24
|
+
s.extensions = PROJ.gem.files.grep %r/extconf\.rb$/
|
25
25
|
|
26
26
|
s.bindir = 'bin'
|
27
27
|
dirs = Dir["{#{PROJ.libs.join(',')}}"]
|
28
28
|
s.require_paths = dirs unless dirs.empty?
|
29
29
|
|
30
|
-
incl = Regexp.new(PROJ.
|
31
|
-
excl = PROJ.
|
30
|
+
incl = Regexp.new(PROJ.rdoc.include.join('|'))
|
31
|
+
excl = PROJ.rdoc.exclude.dup.concat %w[\.rb$ ^(\.\/|\/)?ext]
|
32
32
|
excl = Regexp.new(excl.join('|'))
|
33
|
-
rdoc_files = PROJ.files.find_all do |fn|
|
33
|
+
rdoc_files = PROJ.gem.files.find_all do |fn|
|
34
34
|
case fn
|
35
35
|
when excl; false
|
36
36
|
when incl; true
|
37
37
|
else false end
|
38
38
|
end
|
39
|
-
s.rdoc_options = PROJ.
|
39
|
+
s.rdoc_options = PROJ.rdoc.opts + ['--main', PROJ.rdoc.main]
|
40
40
|
s.extra_rdoc_files = rdoc_files
|
41
41
|
s.has_rdoc = true
|
42
42
|
|
43
|
-
if test ?f, PROJ.
|
44
|
-
s.test_file = PROJ.
|
43
|
+
if test ?f, PROJ.test.file
|
44
|
+
s.test_file = PROJ.test.file
|
45
45
|
else
|
46
|
-
s.test_files = PROJ.
|
46
|
+
s.test_files = PROJ.test.files.to_a
|
47
47
|
end
|
48
48
|
|
49
49
|
# Do any extra stuff the user wants
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
end
|
50
|
+
PROJ.gem.extras.each do |msg, val|
|
51
|
+
case val
|
52
|
+
when Proc
|
53
|
+
val.call(s.send(msg))
|
54
|
+
else
|
55
|
+
s.send "#{msg}=", val
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end # Gem::Specification.new
|
59
|
+
|
60
|
+
# A prerequisites task that all other tasks depend upon
|
61
|
+
task :prereqs
|
59
62
|
|
60
63
|
desc 'Show information about the gem'
|
61
|
-
task :debug do
|
62
|
-
puts PROJ.
|
64
|
+
task :debug => 'gem:prereqs' do
|
65
|
+
puts PROJ.gem._spec.to_ruby
|
63
66
|
end
|
64
67
|
|
65
|
-
Rake::
|
66
|
-
pkg.need_tar = PROJ.need_tar
|
67
|
-
pkg.need_zip = PROJ.need_zip
|
68
|
+
pkg = Rake::PackageTask.new(PROJ.name, PROJ.version) do |pkg|
|
69
|
+
pkg.need_tar = PROJ.gem.need_tar
|
70
|
+
pkg.need_zip = PROJ.gem.need_zip
|
71
|
+
pkg.package_files += PROJ.gem._spec.files
|
72
|
+
end
|
73
|
+
Rake::Task['gem:package'].instance_variable_set(:@full_comment, nil)
|
74
|
+
|
75
|
+
gem_file = if PROJ.gem._spec.platform == Gem::Platform::RUBY
|
76
|
+
"#{pkg.package_name}.gem"
|
77
|
+
else
|
78
|
+
"#{pkg.package_name}-#{PROJ.gem._spec.platform}.gem"
|
79
|
+
end
|
80
|
+
|
81
|
+
desc "Build the gem file #{gem_file}"
|
82
|
+
task :package => ['gem:prereqs', "#{pkg.package_dir}/#{gem_file}"]
|
83
|
+
|
84
|
+
file "#{pkg.package_dir}/#{gem_file}" => [pkg.package_dir] + PROJ.gem._spec.files do
|
85
|
+
when_writing("Creating GEM") {
|
86
|
+
Gem::Builder.new(PROJ.gem._spec).build
|
87
|
+
verbose(true) {
|
88
|
+
mv gem_file, "#{pkg.package_dir}/#{gem_file}"
|
89
|
+
}
|
90
|
+
}
|
68
91
|
end
|
69
92
|
|
70
93
|
desc 'Install the gem'
|
71
|
-
task :install => [:clobber, :package] do
|
72
|
-
sh "#{SUDO} #{GEM} install pkg/#{PROJ.
|
94
|
+
task :install => [:clobber, 'gem:package'] do
|
95
|
+
sh "#{SUDO} #{GEM} install --local pkg/#{PROJ.gem._spec.full_name}"
|
96
|
+
|
97
|
+
# use this version of the command for rubygems > 1.0.0
|
98
|
+
#sh "#{SUDO} #{GEM} install --no-update-sources pkg/#{PROJ.gem._spec.full_name}"
|
73
99
|
end
|
74
100
|
|
75
101
|
desc 'Uninstall the gem'
|
76
102
|
task :uninstall do
|
77
|
-
|
103
|
+
installed_list = Gem.source_index.find_name(PROJ.name)
|
104
|
+
if installed_list and installed_list.collect { |s| s.version.to_s}.include?(PROJ.version) then
|
105
|
+
sh "#{SUDO} #{GEM} uninstall --version '#{PROJ.version}' --ignore-dependencies --executables #{PROJ.name}"
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
desc 'Reinstall the gem'
|
110
|
+
task :reinstall => [:uninstall, :install]
|
111
|
+
|
112
|
+
desc 'Cleanup the gem'
|
113
|
+
task :cleanup do
|
114
|
+
sh "#{SUDO} #{GEM} cleanup #{PROJ.gem._spec.name}"
|
78
115
|
end
|
79
116
|
|
80
117
|
end # namespace :gem
|