hurl 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +9 -0
- data/Manifest.txt +35 -0
- data/{README → README.txt} +33 -22
- data/Rakefile +24 -0
- data/bin/hurl +9 -91
- data/hurls.rb +4 -0
- data/lib/hurl/iterm.rb +15 -0
- data/lib/hurl/iterm_session.rb +5 -0
- data/lib/hurl/project.rb +7 -0
- data/lib/hurl/session.rb +15 -0
- data/lib/hurl/terminal.rb +17 -0
- data/lib/hurl/terminal_session.rb +5 -0
- data/lib/hurl.rb +27 -0
- data/spec/hurl_spec.rb +8 -0
- data/spec/spec_helper.rb +17 -0
- data/tasks/ann.rake +76 -0
- data/tasks/annotations.rake +22 -0
- data/tasks/bones.rake +40 -0
- data/tasks/doc.rake +48 -0
- data/tasks/gem.rake +116 -0
- data/tasks/manifest.rake +49 -0
- data/tasks/post_load.rake +32 -0
- data/tasks/rubyforge.rake +57 -0
- data/tasks/setup.rb +227 -0
- data/tasks/spec.rake +56 -0
- data/tasks/svn.rake +44 -0
- data/tasks/test.rake +38 -0
- data/test/hurl/iterm_session_test.rb +14 -0
- data/test/hurl/iterm_test.rb +43 -0
- data/test/hurl/project_test.rb +22 -0
- data/test/hurl/session_test.rb +17 -0
- data/test/hurl/terminal_session_test.rb +14 -0
- data/test/hurl/terminal_test.rb +70 -0
- data/test/hurl_test.rb +4 -0
- data/test/test_helper.rb +5 -0
- metadata +54 -12
data/History.txt
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
== 0.0.3 / 2008-03-31
|
2
|
+
|
3
|
+
* API slightly changed to reflect more fluent usage
|
4
|
+
* Bug fixes and updated documentation
|
5
|
+
|
6
|
+
== 0.0.2 / 2008-03-31
|
7
|
+
|
8
|
+
* Switched to using Mr. Bones to manage gem packaging and deployment
|
9
|
+
* Code refactored and test coverage increased
|
data/Manifest.txt
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
History.txt
|
2
|
+
Manifest.txt
|
3
|
+
README.txt
|
4
|
+
Rakefile
|
5
|
+
bin/hurl
|
6
|
+
hurls.rb
|
7
|
+
lib/hurl.rb
|
8
|
+
lib/hurl/iterm.rb
|
9
|
+
lib/hurl/iterm_session.rb
|
10
|
+
lib/hurl/project.rb
|
11
|
+
lib/hurl/session.rb
|
12
|
+
lib/hurl/terminal.rb
|
13
|
+
lib/hurl/terminal_session.rb
|
14
|
+
spec/hurl_spec.rb
|
15
|
+
spec/spec_helper.rb
|
16
|
+
tasks/ann.rake
|
17
|
+
tasks/annotations.rake
|
18
|
+
tasks/bones.rake
|
19
|
+
tasks/doc.rake
|
20
|
+
tasks/gem.rake
|
21
|
+
tasks/manifest.rake
|
22
|
+
tasks/post_load.rake
|
23
|
+
tasks/rubyforge.rake
|
24
|
+
tasks/setup.rb
|
25
|
+
tasks/spec.rake
|
26
|
+
tasks/svn.rake
|
27
|
+
tasks/test.rake
|
28
|
+
test/hurl/iterm_session_test.rb
|
29
|
+
test/hurl/iterm_test.rb
|
30
|
+
test/hurl/project_test.rb
|
31
|
+
test/hurl/session_test.rb
|
32
|
+
test/hurl/terminal_session_test.rb
|
33
|
+
test/hurl/terminal_test.rb
|
34
|
+
test/hurl_test.rb
|
35
|
+
test/test_helper.rb
|
data/{README → README.txt}
RENAMED
@@ -1,15 +1,12 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
== HURL
|
2
|
+
by Justin Marney
|
3
|
+
http://hurl.rubyforge.org
|
4
4
|
|
5
|
-
|
6
|
-
=======
|
7
|
-
The ruby appscript gem is required.
|
5
|
+
== DESCRIPTION:
|
8
6
|
|
9
|
-
|
7
|
+
Hurl is an Applescript wrapper built to assist in scripting terminal events. By defining some actions in a config file (hurls.rb) you can open terminal tabs & launch applications with one command (hurl). ITerm and Terminal are supported and adding new apps is fairly straight forward.
|
10
8
|
|
11
|
-
|
12
|
-
=====
|
9
|
+
== FEATURES/PROBLEMS:
|
13
10
|
|
14
11
|
When hurl is called from the command line with a directory path it will search for a hurls.rb file in the root and the lib directory. Actions in this file will be executed in the order they are defined.
|
15
12
|
|
@@ -20,7 +17,7 @@ using Terminal
|
|
20
17
|
In order to execute a command in the tab that hurl was called from:
|
21
18
|
|
22
19
|
this_tab do |t|
|
23
|
-
t.
|
20
|
+
t.hurl "ls"
|
24
21
|
end
|
25
22
|
|
26
23
|
Command line executables can be called directly:
|
@@ -30,22 +27,21 @@ this_tab do |t|
|
|
30
27
|
t.ls
|
31
28
|
end
|
32
29
|
|
33
|
-
The
|
30
|
+
The dir method returns the project directory passed into hurl:
|
34
31
|
|
35
32
|
this_tab do |t|
|
36
|
-
t.cd
|
37
|
-
t.
|
33
|
+
t.cd dir
|
34
|
+
t.hurl "script/server run"
|
38
35
|
end
|
39
36
|
|
40
37
|
You can create a new tab using create_tab:
|
41
38
|
|
42
39
|
create_tab do |t|
|
43
|
-
t.cd
|
40
|
+
t.cd dir
|
44
41
|
t.autotest
|
45
42
|
end
|
46
43
|
|
47
|
-
|
48
|
-
=======
|
44
|
+
== SYNOPSIS:
|
49
45
|
|
50
46
|
# Here is an example hurl.rb placed in ~/your_project/lib
|
51
47
|
# run hurl ~/your_project to watch awesome happen.
|
@@ -55,18 +51,33 @@ Example
|
|
55
51
|
|
56
52
|
# This will launch Textmate from the project directory.
|
57
53
|
this_tab do |t|
|
58
|
-
t.cd
|
54
|
+
t.cd dir
|
59
55
|
t.mate "."
|
60
56
|
end
|
61
57
|
|
62
58
|
# Then open a new tab, cd to the proj dir, and launch autotest.
|
63
59
|
create_tab do |t|
|
64
|
-
t.cd
|
65
|
-
t.
|
60
|
+
t.cd dir
|
61
|
+
t.hurl "autotest --rails"
|
66
62
|
end
|
67
63
|
|
68
64
|
# Then open another new tab, cd to the proj dir, and start the server.
|
69
65
|
create_tab do |t|
|
70
|
-
t.cd
|
71
|
-
t.
|
72
|
-
end
|
66
|
+
t.cd dir
|
67
|
+
t.hurl "script/server run"
|
68
|
+
end
|
69
|
+
|
70
|
+
== REQUIREMENTS:
|
71
|
+
|
72
|
+
appscript
|
73
|
+
mocha (if you want to run the tests)
|
74
|
+
|
75
|
+
== INSTALL:
|
76
|
+
|
77
|
+
sudo gem install hurl
|
78
|
+
|
79
|
+
== LICENSE:
|
80
|
+
|
81
|
+
Copyright (c) 2008 Justin Marney
|
82
|
+
|
83
|
+
This work is licensed under the Creative Commons Attribution 3.0 United States License. To view a copy of this license, visit http://creativecommons.org/licenses/by/3.0/us/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
|
data/Rakefile
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# Look in the tasks/setup.rb file for the various options that can be
|
2
|
+
# configured in this Rakefile. The .rake files in the tasks directory
|
3
|
+
# are where the options are used.
|
4
|
+
|
5
|
+
load 'tasks/setup.rb'
|
6
|
+
|
7
|
+
ensure_in_path 'lib'
|
8
|
+
require 'hurl'
|
9
|
+
|
10
|
+
task :default => 'test'
|
11
|
+
|
12
|
+
PROJ.name = 'hurl'
|
13
|
+
PROJ.authors = 'Justin Marney'
|
14
|
+
PROJ.email = 'gotascii@gmail.com'
|
15
|
+
PROJ.url = 'http://hurl.rubyforge.org'
|
16
|
+
PROJ.description = "rb-appscript wrapper built to assist in scripting terminal events."
|
17
|
+
PROJ.rubyforge_name = 'hurl'
|
18
|
+
PROJ.version = Hurl::VERSION
|
19
|
+
PROJ.tests = FileList['test/**/*_test.rb']
|
20
|
+
PROJ.exclude << '\.git'
|
21
|
+
PROJ.exclude << '^_.*'
|
22
|
+
depend_on 'rb-appscript'
|
23
|
+
|
24
|
+
# EOF
|
data/bin/hurl
CHANGED
@@ -1,97 +1,15 @@
|
|
1
|
-
#!/usr/bin/ruby
|
1
|
+
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'rubygems'
|
4
|
-
require 'appscript'
|
5
|
-
include Appscript
|
6
4
|
|
7
|
-
|
8
|
-
|
5
|
+
require File.expand_path(
|
6
|
+
File.join(File.dirname(__FILE__), '..', 'lib', 'hurl'))
|
9
7
|
|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+
include Hurl
|
9
|
+
self.dir=(ARGV.shift)
|
10
|
+
using ITerm
|
11
|
+
["", "lib"].each do |path|
|
12
|
+
hurls = File.join(dir, path, 'hurls.rb')
|
13
|
+
require hurls if File.exist? hurls
|
13
14
|
end
|
14
15
|
|
15
|
-
class Session
|
16
|
-
def initialize(sesh)
|
17
|
-
@session = sesh
|
18
|
-
end
|
19
|
-
|
20
|
-
def method_missing(command, *args)
|
21
|
-
cmd = command.to_s + args.inject('') do |opts, arg| opts += ' ' + arg.to_s end
|
22
|
-
exec(cmd)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
class ITermSession < Session
|
27
|
-
def exec(command)
|
28
|
-
@session.write(:text => command)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
class ITerm < Project
|
33
|
-
def initialize(dir)
|
34
|
-
@appscript = app('iTerm').current_terminal
|
35
|
-
super(dir)
|
36
|
-
end
|
37
|
-
|
38
|
-
def create_tab
|
39
|
-
@appscript.launch_(:session => "Default Session")
|
40
|
-
yield ITermSession.new(@appscript.sessions.last) if block_given?
|
41
|
-
end
|
42
|
-
|
43
|
-
def this_tab
|
44
|
-
yield ITermSession.new(@appscript.current_session) if block_given?
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
class TerminalSession < Session
|
49
|
-
def exec(command)
|
50
|
-
@session.do_script(command, :in => @session)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
class Terminal < Project
|
55
|
-
def initialize(dir)
|
56
|
-
@appscript = app('Terminal').windows[0]
|
57
|
-
super(dir)
|
58
|
-
end
|
59
|
-
|
60
|
-
def create_tab(&block)
|
61
|
-
@appscript.activate
|
62
|
-
app("System Events").keystroke("t", :using => :command_down)
|
63
|
-
yield TerminalSession.new(@appscript.tabs.last) if block_given?
|
64
|
-
end
|
65
|
-
|
66
|
-
def this_tab
|
67
|
-
@appscript.activate
|
68
|
-
yield TerminalSession.new(@appscript.tabs.first) if block_given?
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
module Hurler
|
73
|
-
attr_accessor :project_dir
|
74
|
-
|
75
|
-
def using(klass)
|
76
|
-
@wrapper = klass.new(@project_dir)
|
77
|
-
end
|
78
|
-
|
79
|
-
def create_tab(&block)
|
80
|
-
@wrapper.create_tab(&block)
|
81
|
-
end
|
82
|
-
|
83
|
-
def this_tab(&block)
|
84
|
-
@wrapper.this_tab(&block)
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
if __FILE__ == $0
|
89
|
-
include Hurler
|
90
|
-
project_dir = ARGV.shift
|
91
|
-
using ITerm
|
92
|
-
["", "/lib"].each do |path|
|
93
|
-
hurls = "#{project_dir}#{path}/hurls.rb"
|
94
|
-
puts hurls
|
95
|
-
require hurls if File.exist? hurls
|
96
|
-
end
|
97
|
-
end
|
data/hurls.rb
ADDED
data/lib/hurl/iterm.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
class ITerm < Project
|
2
|
+
def initialize(dir)
|
3
|
+
@appscript = Appscript.app('iTerm').current_terminal
|
4
|
+
super(dir)
|
5
|
+
end
|
6
|
+
|
7
|
+
def create_tab
|
8
|
+
@appscript.launch_(:session => "Default Session")
|
9
|
+
yield ITermSession.new(@appscript.sessions.last) if block_given?
|
10
|
+
end
|
11
|
+
|
12
|
+
def this_tab
|
13
|
+
yield ITermSession.new(@appscript.current_session) if block_given?
|
14
|
+
end
|
15
|
+
end
|
data/lib/hurl/project.rb
ADDED
data/lib/hurl/session.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
class Session
|
2
|
+
attr_reader :session
|
3
|
+
|
4
|
+
def initialize(sesh)
|
5
|
+
@session = sesh
|
6
|
+
end
|
7
|
+
|
8
|
+
def method_missing(command, *args)
|
9
|
+
cmd = command.to_s + args.inject('') do |opts, arg| opts += ' ' + arg.to_s end
|
10
|
+
hurl(cmd)
|
11
|
+
end
|
12
|
+
|
13
|
+
def hurl(cmd)
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class Terminal < Project
|
2
|
+
def initialize(dir)
|
3
|
+
@appscript = Appscript.app('Terminal').windows[0]
|
4
|
+
super(dir)
|
5
|
+
end
|
6
|
+
|
7
|
+
def create_tab
|
8
|
+
@appscript.activate
|
9
|
+
Appscript.app("System Events").keystroke("t", :using => :command_down)
|
10
|
+
yield TerminalSession.new(@appscript.tabs.last) if block_given?
|
11
|
+
end
|
12
|
+
|
13
|
+
def this_tab
|
14
|
+
@appscript.activate
|
15
|
+
yield TerminalSession.new(@appscript.tabs.first) if block_given?
|
16
|
+
end
|
17
|
+
end
|
data/lib/hurl.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
$:.unshift File.dirname(__FILE__)
|
2
|
+
|
3
|
+
require 'appscript'
|
4
|
+
require 'hurl/project'
|
5
|
+
require 'hurl/session'
|
6
|
+
require 'hurl/iterm_session'
|
7
|
+
require 'hurl/terminal_session'
|
8
|
+
require 'hurl/terminal'
|
9
|
+
require 'hurl/iterm'
|
10
|
+
|
11
|
+
module Hurl
|
12
|
+
VERSION = '0.0.3'
|
13
|
+
|
14
|
+
attr_accessor :dir
|
15
|
+
|
16
|
+
def using(klass)
|
17
|
+
@wrapper = klass.new(@dir)
|
18
|
+
end
|
19
|
+
|
20
|
+
def create_tab(&block)
|
21
|
+
@wrapper.create_tab(&block)
|
22
|
+
end
|
23
|
+
|
24
|
+
def this_tab(&block)
|
25
|
+
@wrapper.this_tab(&block)
|
26
|
+
end
|
27
|
+
end
|
data/spec/hurl_spec.rb
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# $Id$
|
2
|
+
|
3
|
+
require File.expand_path(
|
4
|
+
File.join(File.dirname(__FILE__), %w[.. lib hurl]))
|
5
|
+
|
6
|
+
Spec::Runner.configure do |config|
|
7
|
+
# == Mock Framework
|
8
|
+
#
|
9
|
+
# RSpec uses it's own mocking framework by default. If you prefer to
|
10
|
+
# use mocha, flexmock or RR, uncomment the appropriate line:
|
11
|
+
#
|
12
|
+
# config.mock_with :mocha
|
13
|
+
# config.mock_with :flexmock
|
14
|
+
# config.mock_with :rr
|
15
|
+
end
|
16
|
+
|
17
|
+
# EOF
|
data/tasks/ann.rake
ADDED
@@ -0,0 +1,76 @@
|
|
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
|
+
file PROJ.ann_file do
|
13
|
+
puts "Generating #{PROJ.ann_file}"
|
14
|
+
File.open(PROJ.ann_file,'w') do |fd|
|
15
|
+
fd.puts("#{PROJ.name} version #{PROJ.version}")
|
16
|
+
fd.puts(" by #{Array(PROJ.authors).first}") if PROJ.authors
|
17
|
+
fd.puts(" #{PROJ.url}") if PROJ.url
|
18
|
+
fd.puts(" (the \"#{PROJ.release_name}\" release)") if PROJ.release_name
|
19
|
+
fd.puts
|
20
|
+
fd.puts("== DESCRIPTION")
|
21
|
+
fd.puts
|
22
|
+
fd.puts(PROJ.description)
|
23
|
+
fd.puts
|
24
|
+
fd.puts(PROJ.changes.sub(%r/^.*$/, '== CHANGES'))
|
25
|
+
fd.puts
|
26
|
+
PROJ.ann_paragraphs.each do |p|
|
27
|
+
fd.puts "== #{p.upcase}"
|
28
|
+
fd.puts
|
29
|
+
fd.puts paragraphs_of(PROJ.readme_file, p).join("\n\n")
|
30
|
+
fd.puts
|
31
|
+
end
|
32
|
+
fd.puts PROJ.ann_text if PROJ.ann_text
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
desc "Create an announcement file"
|
37
|
+
task :announcement => PROJ.ann_file
|
38
|
+
|
39
|
+
desc "Send an email announcement"
|
40
|
+
task :email => PROJ.ann_file do
|
41
|
+
from = PROJ.ann_email[:from] || PROJ.email
|
42
|
+
to = Array(PROJ.ann_email[:to])
|
43
|
+
|
44
|
+
### build a mail header for RFC 822
|
45
|
+
rfc822msg = "From: #{from}\n"
|
46
|
+
rfc822msg << "To: #{to.join(',')}\n"
|
47
|
+
rfc822msg << "Subject: [ANN] #{PROJ.name} #{PROJ.version}"
|
48
|
+
rfc822msg << " (#{PROJ.release_name})" if PROJ.release_name
|
49
|
+
rfc822msg << "\n"
|
50
|
+
rfc822msg << "Date: #{Time.new.rfc822}\n"
|
51
|
+
rfc822msg << "Message-Id: "
|
52
|
+
rfc822msg << "<#{"%.8f" % Time.now.to_f}@#{PROJ.ann_email[:domain]}>\n\n"
|
53
|
+
rfc822msg << File.read(PROJ.ann_file)
|
54
|
+
|
55
|
+
params = [:server, :port, :domain, :acct, :passwd, :authtype].map do |key|
|
56
|
+
PROJ.ann_email[key]
|
57
|
+
end
|
58
|
+
|
59
|
+
params[3] = PROJ.email if params[3].nil?
|
60
|
+
|
61
|
+
if params[4].nil?
|
62
|
+
STDOUT.write "Please enter your e-mail password (#{params[3]}): "
|
63
|
+
params[4] = STDIN.gets.chomp
|
64
|
+
end
|
65
|
+
|
66
|
+
### send email
|
67
|
+
Net::SMTP.start(*params) {|smtp| smtp.sendmail(rfc822msg, from, to)}
|
68
|
+
end
|
69
|
+
end # namespace :ann
|
70
|
+
|
71
|
+
desc 'Alias to ann:announcement'
|
72
|
+
task :ann => 'ann:announcement'
|
73
|
+
|
74
|
+
CLOBBER << PROJ.ann_file
|
75
|
+
|
76
|
+
# EOF
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# $Id$
|
2
|
+
|
3
|
+
if HAVE_BONES
|
4
|
+
|
5
|
+
desc "Enumerate all annotations"
|
6
|
+
task :notes do
|
7
|
+
Bones::AnnotationExtractor.enumerate(
|
8
|
+
PROJ, PROJ.annotation_tags.join('|'), :tag => true)
|
9
|
+
end
|
10
|
+
|
11
|
+
namespace :notes do
|
12
|
+
PROJ.annotation_tags.each do |tag|
|
13
|
+
desc "Enumerate all #{tag} annotations"
|
14
|
+
task tag.downcase.to_sym do
|
15
|
+
Bones::AnnotationExtractor.enumerate(PROJ, tag)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end # if HAVE_BONES
|
21
|
+
|
22
|
+
# EOF
|
data/tasks/bones.rake
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# $Id$
|
2
|
+
|
3
|
+
require 'pp'
|
4
|
+
require 'stringio'
|
5
|
+
|
6
|
+
namespace :bones do
|
7
|
+
|
8
|
+
desc 'Show the PROJ open struct'
|
9
|
+
task :debug do |t|
|
10
|
+
atr = if ARGV.length == 2
|
11
|
+
t.application.top_level_tasks.pop
|
12
|
+
end
|
13
|
+
sio = StringIO.new
|
14
|
+
sep = "\n" + ' '*27
|
15
|
+
fmt = "%23s => %s"
|
16
|
+
|
17
|
+
if atr
|
18
|
+
PP.pp(PROJ.send(atr.to_sym), sio, 49)
|
19
|
+
sio.seek 0
|
20
|
+
val = sio.read
|
21
|
+
val = val.split("\n").join(sep)
|
22
|
+
|
23
|
+
puts fmt % [atr, val]
|
24
|
+
else
|
25
|
+
h = PROJ.instance_variable_get(:@table)
|
26
|
+
h.keys.map {|k| k.to_s}.sort.each do |k|
|
27
|
+
sio.truncate 0
|
28
|
+
PP.pp(h[k.to_sym], sio, 49)
|
29
|
+
sio.seek 0
|
30
|
+
val = sio.read
|
31
|
+
val = val.split("\n").join(sep)
|
32
|
+
|
33
|
+
puts fmt % [k, val]
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
end # namespace :bones
|
39
|
+
|
40
|
+
# EOF
|
data/tasks/doc.rake
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# $Id$
|
2
|
+
|
3
|
+
require 'rake/rdoctask'
|
4
|
+
|
5
|
+
namespace :doc do
|
6
|
+
|
7
|
+
desc 'Generate RDoc documentation'
|
8
|
+
Rake::RDocTask.new do |rd|
|
9
|
+
rd.main = PROJ.rdoc_main
|
10
|
+
rd.rdoc_dir = PROJ.rdoc_dir
|
11
|
+
|
12
|
+
incl = Regexp.new(PROJ.rdoc_include.join('|'))
|
13
|
+
excl = Regexp.new(PROJ.rdoc_exclude.join('|'))
|
14
|
+
files = PROJ.files.find_all do |fn|
|
15
|
+
case fn
|
16
|
+
when excl; false
|
17
|
+
when incl; true
|
18
|
+
else false end
|
19
|
+
end
|
20
|
+
rd.rdoc_files.push(*files)
|
21
|
+
|
22
|
+
title = "#{PROJ.name}-#{PROJ.version} Documentation"
|
23
|
+
title = "#{PROJ.rubyforge_name}'s " + title if PROJ.rubyforge_name != title
|
24
|
+
|
25
|
+
rd.options << "-t #{title}"
|
26
|
+
rd.options.concat(PROJ.rdoc_opts)
|
27
|
+
end
|
28
|
+
|
29
|
+
desc 'Generate ri locally for testing'
|
30
|
+
task :ri => :clobber_ri do
|
31
|
+
sh "#{RDOC} --ri -o ri ."
|
32
|
+
end
|
33
|
+
|
34
|
+
task :clobber_ri do
|
35
|
+
rm_r 'ri' rescue nil
|
36
|
+
end
|
37
|
+
|
38
|
+
end # namespace :doc
|
39
|
+
|
40
|
+
desc 'Alias to doc:rdoc'
|
41
|
+
task :doc => 'doc:rdoc'
|
42
|
+
|
43
|
+
desc 'Remove all build products'
|
44
|
+
task :clobber => %w(doc:clobber_rdoc doc:clobber_ri)
|
45
|
+
|
46
|
+
remove_desc_for_task %w(doc:clobber_rdoc)
|
47
|
+
|
48
|
+
# EOF
|