delano-drydock 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.txt +12 -0
- data/README.rdoc +3 -1
- data/Rakefile +11 -6
- data/bin/example +13 -4
- data/drydock.gemspec +1 -1
- data/lib/drydock.rb +11 -0
- metadata +1 -1
data/CHANGES.txt
CHANGED
@@ -1,5 +1,16 @@
|
|
1
1
|
DRYDOCK, CHANGES
|
2
2
|
|
3
|
+
TODO:
|
4
|
+
* Fix '-' '_' ambiguity for option names
|
5
|
+
* Calls valid? method (if present) before calling command block.
|
6
|
+
|
7
|
+
|
8
|
+
#### 0.3.3 (2009-02-14) ###############################
|
9
|
+
|
10
|
+
* NEW: init method hook for subclasses of Drydock::Command
|
11
|
+
* UPDATED: Rdocs
|
12
|
+
|
13
|
+
|
3
14
|
#### 0.3 (2009-02-05) ###############################
|
4
15
|
|
5
16
|
* Added support for custom Drydock::Commands objects
|
@@ -10,6 +21,7 @@ DRYDOCK, CHANGES
|
|
10
21
|
* Started adding tests
|
11
22
|
* Improved documentation
|
12
23
|
|
24
|
+
|
13
25
|
#### 0.2 (2008-12-27) ###############################
|
14
26
|
|
15
27
|
* Initial release
|
data/README.rdoc
CHANGED
data/Rakefile
CHANGED
@@ -11,7 +11,12 @@ task :default => :test
|
|
11
11
|
|
12
12
|
desc 'Run specs with unit test style output'
|
13
13
|
task :test do |t|
|
14
|
-
sh "ruby
|
14
|
+
sh "ruby test/*_test.rb"
|
15
|
+
end
|
16
|
+
|
17
|
+
desc 'Run bin/example and tryouts'
|
18
|
+
task :tryouts do |t|
|
19
|
+
sh "ruby bin/example"
|
15
20
|
end
|
16
21
|
|
17
22
|
# PACKAGE =============================================================
|
@@ -40,20 +45,20 @@ end
|
|
40
45
|
|
41
46
|
desc 'Publish website to rubyforge'
|
42
47
|
task 'publish:doc' => 'doc/index.html' do
|
43
|
-
sh
|
48
|
+
sh "scp -rp doc/* rubyforge.org:/var/www/gforge-projects/#{name}/"
|
44
49
|
end
|
45
|
-
|
50
|
+
|
46
51
|
task 'publish:gem' => [:package] do |t|
|
47
52
|
sh <<-end
|
48
|
-
rubyforge add_release -o Any -a CHANGES.txt -f -n README.rdoc
|
49
|
-
rubyforge add_file -o Any -a CHANGES.txt -f -n README.rdoc
|
53
|
+
rubyforge add_release -o Any -a CHANGES.txt -f -n README.rdoc #{name} #{name} #{@spec.version} pkg/#{name}-#{@spec.version}.gem &&
|
54
|
+
rubyforge add_file -o Any -a CHANGES.txt -f -n README.rdoc #{name} #{name} #{@spec.version} pkg/#{name}-#{@spec.version}.tgz
|
50
55
|
end
|
51
56
|
end
|
52
57
|
|
53
58
|
|
54
59
|
Rake::RDocTask.new do |t|
|
55
60
|
t.rdoc_dir = 'doc'
|
56
|
-
t.title =
|
61
|
+
t.title = @spec.summary
|
57
62
|
t.options << '--line-numbers' << '--inline-source' << '-A cattr_accessor=object'
|
58
63
|
t.options << '--charset' << 'utf-8'
|
59
64
|
t.rdoc_files.include('LICENSE.txt')
|
data/bin/example
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
+
# Seafaring Drydock Examples
|
4
|
+
#
|
5
|
+
# This is a functioning script so you can copy it, run it,
|
6
|
+
# and just generally be a longshoreman about things. This is
|
7
|
+
# a Drydock after all.
|
8
|
+
#
|
9
|
+
# If you're reading this via the Rdocs you won't see the code. Try:
|
10
|
+
#
|
11
|
+
# http://github.com/delano/drydock/blob/master/bin/example
|
12
|
+
|
3
13
|
$:.unshift File.expand_path(File.join(File.dirname(__FILE__), '..')), 'lib'
|
4
14
|
|
5
15
|
require 'drydock'
|
@@ -17,9 +27,8 @@ end
|
|
17
27
|
|
18
28
|
command :welcome do
|
19
29
|
# Example: ruby bin/example
|
20
|
-
|
21
|
-
puts "
|
22
|
-
print "Frylock: At least we have some commands: "
|
30
|
+
|
31
|
+
puts "Welcome to Drydock. You have the following commands:"
|
23
32
|
|
24
33
|
# The commands method returns a hash of Drydock::Command objects
|
25
34
|
puts commands.keys.inject([]) { |list, command| list << command.to_s }.sort.join(', ')
|
@@ -142,7 +151,7 @@ end
|
|
142
151
|
# return the HTTP response code for the given URI
|
143
152
|
# +uri+ A valid HTTP URI
|
144
153
|
# +duration+ The timeout threshold (in seconds) for the request.
|
145
|
-
def response_code(uri_str, duration=5)
|
154
|
+
def response_code(uri_str, duration=5) #:nodoc:
|
146
155
|
response = :unavailable
|
147
156
|
begin
|
148
157
|
uri = (uri_str.kind_of? URI::HTTP) ? uri_str : URI.parse(uri_str)
|
data/drydock.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
@spec = Gem::Specification.new do |s|
|
2
2
|
s.name = %q{drydock}
|
3
|
-
s.version = "0.3.
|
3
|
+
s.version = "0.3.3"
|
4
4
|
s.specification_version = 1 if s.respond_to? :specification_version=
|
5
5
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
6
6
|
|
data/lib/drydock.rb
CHANGED
@@ -24,6 +24,12 @@ module Drydock
|
|
24
24
|
#
|
25
25
|
class Command
|
26
26
|
attr_reader :cmd, :alias
|
27
|
+
|
28
|
+
# The default constructor sets the short name of the command
|
29
|
+
# and stores a reference to the block (if supplied).
|
30
|
+
# You don't need to override this method to add functionality
|
31
|
+
# to your custom Command classes. Define an +init+ method instead.
|
32
|
+
# It will be called just before the block is executed.
|
27
33
|
# +cmd+ is the short name of this command.
|
28
34
|
# +b+ is the block associated to this command.
|
29
35
|
def initialize(cmd, &b)
|
@@ -33,6 +39,8 @@ module Drydock
|
|
33
39
|
|
34
40
|
# Execute the block.
|
35
41
|
#
|
42
|
+
# Calls self.init before calling the block. Implement this method when
|
43
|
+
#
|
36
44
|
# +cmd_str+ is the short name used to evoke this command. It will equal @cmd
|
37
45
|
# unless an alias was used used to evoke this command.
|
38
46
|
# +argv+ an array of unnamed arguments. If ignore :options was declared this
|
@@ -45,6 +53,9 @@ module Drydock
|
|
45
53
|
global_options.merge(options).each_pair do |n,v|
|
46
54
|
self.send("#{n}=", v)
|
47
55
|
end
|
56
|
+
|
57
|
+
self.init if respond_to? :init
|
58
|
+
|
48
59
|
block_args = [self, argv, stdin] # TODO: review order
|
49
60
|
@b.call(*block_args[0..(@b.arity-1)]) # send only as many args as defined
|
50
61
|
end
|