quickl 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +23 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +34 -0
- data/LICENCE.md +22 -0
- data/Manifest.txt +15 -0
- data/README.md +0 -25
- data/Rakefile +18 -32
- data/lib/quickl/command/builder.rb +18 -1
- data/lib/quickl/command/delegator.rb +8 -5
- data/lib/quickl/command/robustness.rb +4 -5
- data/lib/quickl/command/single.rb +1 -0
- data/lib/quickl/command.rb +12 -0
- data/lib/quickl/loader.rb +0 -0
- data/lib/quickl/version.rb +14 -0
- data/lib/quickl.rb +3 -4
- data/quickl.gemspec +178 -27
- data/quickl.noespec +58 -0
- data/spec/command/command_building_spec.rb +16 -0
- data/spec/command/command_name_spec.rb +16 -0
- data/spec/command/documentation_spec.rb +23 -0
- data/spec/command/overview_spec.rb +14 -0
- data/spec/command/requester_spec.rb +16 -0
- data/spec/command/robustness/valid_read_file_spec.rb +62 -0
- data/spec/command/run_spec.rb +22 -0
- data/spec/command/subcommand_by_name_spec.rb +15 -0
- data/spec/command/subcommands_spec.rb +24 -0
- data/spec/command/usage_spec.rb +16 -0
- data/spec/mini_client.rb +96 -0
- data/spec/naming/command2module_spec.rb +17 -0
- data/spec/naming/module2command_spec.rb +21 -0
- data/spec/quickl_spec.rb +8 -0
- data/spec/ruby_tools/class_unqualified_name_spec.rb +28 -0
- data/spec/ruby_tools/extract_file_rdoc_spec.rb +28 -0
- data/spec/ruby_tools/fixtures/RubyTools.rdoc +12 -0
- data/spec/ruby_tools/fixtures/Utils.rdoc +3 -0
- data/spec/ruby_tools/fixtures.rb +27 -0
- data/spec/ruby_tools/optional_args_block_call_spec.rb +37 -0
- data/spec/ruby_tools/parent_module_spec.rb +23 -0
- data/spec/spec_helper.rb +4 -0
- data/tasks/debug_mail.rake +78 -0
- data/tasks/debug_mail.txt +13 -0
- data/tasks/gem.rake +68 -0
- data/tasks/spec_test.rake +79 -0
- data/tasks/unit_test.rake +77 -0
- data/tasks/yard.rake +51 -0
- metadata +150 -105
- data/examples/delegator/README.md +0 -86
- data/examples/delegator/bin/delegator +0 -9
- data/examples/delegator/lib/delegator.rb +0 -41
- data/examples/delegator/lib/hello_world.rb +0 -39
- data/examples/delegator/lib/help.rb +0 -24
- data/examples/delegator/test/delegator_test.rb +0 -68
- data/examples/hello/README.md +0 -74
- data/examples/hello/hello +0 -57
- data/examples/hello/hello_test.rb +0 -65
- data/examples/helper.rb +0 -6
- data/templates/single.erb +0 -40
@@ -0,0 +1,23 @@
|
|
1
|
+
$hello_doc = <<EOF
|
2
|
+
|
3
|
+
Say hello to the user whose name is requested on the standard input
|
4
|
+
|
5
|
+
SYNOPSIS
|
6
|
+
mini-client say:hello
|
7
|
+
|
8
|
+
DESCRIPTION
|
9
|
+
And an explanation here
|
10
|
+
on multiple lines with replacement: hello
|
11
|
+
|
12
|
+
EOF
|
13
|
+
|
14
|
+
require File.expand_path('../../spec_helper', __FILE__)
|
15
|
+
module Quickl
|
16
|
+
describe "Command::documentation /" do
|
17
|
+
|
18
|
+
it "should be correctly installed" do
|
19
|
+
MiniClient::Say::Hello.documentation.should == $hello_doc[0..-1]
|
20
|
+
end
|
21
|
+
|
22
|
+
end # Command::command
|
23
|
+
end # module Quickl
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require File.expand_path('../../spec_helper', __FILE__)
|
2
|
+
module Quickl
|
3
|
+
describe "Command::overview /" do
|
4
|
+
|
5
|
+
it "should be installed from inline rdoc" do
|
6
|
+
MiniClient::Help.overview.should == "Print help"
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should be installed accessible on instance" do
|
10
|
+
MiniClient::Help.new.overview.should == "Print help"
|
11
|
+
end
|
12
|
+
|
13
|
+
end # Command::overview
|
14
|
+
end # module Quickl
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require File.expand_path('../../spec_helper', __FILE__)
|
2
|
+
module Quickl
|
3
|
+
describe "Command::requester /" do
|
4
|
+
|
5
|
+
it "should return nil if invoked immediately" do
|
6
|
+
MiniClient::Requester.run([]).should be_nil
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should return delegator if ran from delegator" do
|
10
|
+
x = MiniClient.run(["requester"])
|
11
|
+
x.should_not be_nil
|
12
|
+
x.should be_a(MiniClient)
|
13
|
+
end
|
14
|
+
|
15
|
+
end # Command::requester
|
16
|
+
end # module Quickl
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require File.expand_path('../../../spec_helper', __FILE__)
|
2
|
+
module Quickl
|
3
|
+
describe "Command::Robustness#valid_read_file!" do
|
4
|
+
|
5
|
+
let(:r){ Object.new.extend(Command::Robustness) }
|
6
|
+
|
7
|
+
describe "with default options" do
|
8
|
+
|
9
|
+
it "should raise a Quickl::IOAccessError with a friendly message" do
|
10
|
+
begin
|
11
|
+
r.valid_read_file!("nosuchone.nosuchextension")
|
12
|
+
true.should == false
|
13
|
+
rescue Quickl::IOAccessError => ex
|
14
|
+
ex.message.should =~ /Not a file/
|
15
|
+
ex.message.should =~ /nosuchone.nosuchextension/
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
end # with default options
|
20
|
+
|
21
|
+
describe "with specific error class" do
|
22
|
+
|
23
|
+
it "should raise it with a default message" do
|
24
|
+
begin
|
25
|
+
r.valid_read_file!("nosuchone.nosuchextension", ArgumentError)
|
26
|
+
true.should == false
|
27
|
+
rescue ArgumentError => ex
|
28
|
+
ex.message.should =~ /Not a file/
|
29
|
+
ex.message.should =~ /nosuchone.nosuchextension/
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
end # with specific message
|
34
|
+
|
35
|
+
describe "with specific message" do
|
36
|
+
|
37
|
+
it "should raise a Quickl::IOAccessError with a specific message" do
|
38
|
+
begin
|
39
|
+
r.valid_read_file!("nosuchone.nosuchextension", nil, "specific")
|
40
|
+
true.should == false
|
41
|
+
rescue Quickl::IOAccessError => ex
|
42
|
+
ex.message.should == "specific"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
end # with specific message
|
47
|
+
|
48
|
+
describe 'with specific message and error class' do
|
49
|
+
|
50
|
+
it "should raise a Quickl::IOAccessError with a specific message" do
|
51
|
+
begin
|
52
|
+
r.valid_read_file!("nosuchone.nosuchextension", ArgumentError, "specific")
|
53
|
+
true.should == false
|
54
|
+
rescue ArgumentError => ex
|
55
|
+
ex.message.should == "specific"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
end # module Quickl
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require File.expand_path('../../spec_helper', __FILE__)
|
2
|
+
module Quickl
|
3
|
+
describe "Command::run /" do
|
4
|
+
|
5
|
+
it "when invoked on a terminal command" do
|
6
|
+
MiniClient::Say::Hello.run.should == :hello
|
7
|
+
MiniClient::Say::Goodbye.run.should == :goodbye
|
8
|
+
end
|
9
|
+
|
10
|
+
it "when invoked on a delegator command" do
|
11
|
+
MiniClient.run(["help"]).should == :help
|
12
|
+
MiniClient::Say.run(["hello"]).should == :hello
|
13
|
+
MiniClient::Say.run(["goodbye"]).should == :goodbye
|
14
|
+
end
|
15
|
+
|
16
|
+
it "when invoked on qualified command names" do
|
17
|
+
MiniClient.run(["say:hello"]).should == :hello
|
18
|
+
MiniClient.run(["say:goodbye"]).should == :goodbye
|
19
|
+
end
|
20
|
+
|
21
|
+
end # Command::command
|
22
|
+
end # module Quickl
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require File.expand_path('../../spec_helper', __FILE__)
|
2
|
+
module Quickl
|
3
|
+
describe "Command::subcommand_by_name /" do
|
4
|
+
|
5
|
+
specify "when called on single command names" do
|
6
|
+
MiniClient.subcommand_by_name("help").should == MiniClient::Help
|
7
|
+
MiniClient.subcommand_by_name("noway").should be_nil
|
8
|
+
end
|
9
|
+
|
10
|
+
specify "when called on complex command names" do
|
11
|
+
MiniClient.subcommand_by_name("say:hello").should == MiniClient::Say::Hello
|
12
|
+
end
|
13
|
+
|
14
|
+
end # Command::command_name
|
15
|
+
end # module Quickl
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require File.expand_path('../../spec_helper', __FILE__)
|
2
|
+
module Quickl
|
3
|
+
describe "Command::subcommands /" do
|
4
|
+
|
5
|
+
it "should return installed commands in an array" do
|
6
|
+
MiniClient.subcommands.should == [
|
7
|
+
MiniClient::Help,
|
8
|
+
MiniClient::Say,
|
9
|
+
MiniClient::Requester,
|
10
|
+
]
|
11
|
+
MiniClient::Say.subcommands.should == [
|
12
|
+
MiniClient::Say::Hello,
|
13
|
+
MiniClient::Say::Goodbye,
|
14
|
+
]
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should take care of the command_parent= in command builder" do
|
18
|
+
MiniClient::Requester.subcommands.should == [
|
19
|
+
MiniClient::Factored
|
20
|
+
]
|
21
|
+
end
|
22
|
+
|
23
|
+
end # Command::subcommand
|
24
|
+
end # module Quickl
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require File.expand_path('../../spec_helper', __FILE__)
|
2
|
+
module Quickl
|
3
|
+
describe "Command::usage /" do
|
4
|
+
|
5
|
+
it "should be installed from inline rdoc" do
|
6
|
+
MiniClient::Say::Hello.usage.should == "mini-client say:hello"
|
7
|
+
MiniClient::Say::Goodbye.usage.should == "mini-client say:goodbye"
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should be accessible on instance" do
|
11
|
+
MiniClient::Say::Hello.new.usage.should == "mini-client say:hello"
|
12
|
+
MiniClient::Say::Goodbye.new.usage.should == "mini-client say:goodbye"
|
13
|
+
end
|
14
|
+
|
15
|
+
end # Command::usage
|
16
|
+
end # module Quickl
|
data/spec/mini_client.rb
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
#
|
2
|
+
# MiniClient main command
|
3
|
+
#
|
4
|
+
class MiniClient < Quickl::Delegator(__FILE__, __LINE__)
|
5
|
+
|
6
|
+
#
|
7
|
+
# Print help
|
8
|
+
#
|
9
|
+
# SYNOPSIS
|
10
|
+
# #{MiniClient.command_name} help
|
11
|
+
#
|
12
|
+
# DESCRIPTION
|
13
|
+
# #{command_name} prints help
|
14
|
+
#
|
15
|
+
class Help < Quickl::Command(__FILE__, __LINE__)
|
16
|
+
|
17
|
+
def execute(*args)
|
18
|
+
:help
|
19
|
+
end
|
20
|
+
|
21
|
+
end # class Help
|
22
|
+
|
23
|
+
class Say < Quickl::Delegator(__FILE__, __LINE__)
|
24
|
+
|
25
|
+
#
|
26
|
+
# Say hello to the user whose name is requested on the standard input
|
27
|
+
#
|
28
|
+
# SYNOPSIS
|
29
|
+
# #{MiniClient.command_name} say:hello
|
30
|
+
#
|
31
|
+
# DESCRIPTION
|
32
|
+
# And an explanation here
|
33
|
+
# on multiple lines with replacement: #{command_name}
|
34
|
+
#
|
35
|
+
class Hello < Quickl::Command(__FILE__, __LINE__)
|
36
|
+
|
37
|
+
def execute(*args)
|
38
|
+
:hello
|
39
|
+
end
|
40
|
+
|
41
|
+
end # class Hello
|
42
|
+
|
43
|
+
#
|
44
|
+
# Say goodbye to the currently connected user
|
45
|
+
#
|
46
|
+
# SYNOPSIS
|
47
|
+
# #{MiniClient.command_name} say:goodbye
|
48
|
+
#
|
49
|
+
class Goodbye < Quickl::Command(__FILE__, __LINE__)
|
50
|
+
|
51
|
+
def execute(*args)
|
52
|
+
:goodbye
|
53
|
+
end
|
54
|
+
|
55
|
+
end # class Goodbye
|
56
|
+
|
57
|
+
end # class Say
|
58
|
+
|
59
|
+
#
|
60
|
+
# Returns the requester object
|
61
|
+
#
|
62
|
+
# SYNOPSIS
|
63
|
+
# #{MiniClient.command_name} requester
|
64
|
+
#
|
65
|
+
class Requester < Quickl::Command(__FILE__, __LINE__)
|
66
|
+
|
67
|
+
def execute(*args)
|
68
|
+
requester
|
69
|
+
end
|
70
|
+
|
71
|
+
end # class Requester
|
72
|
+
|
73
|
+
def self.Factor(file, line, arg)
|
74
|
+
Quickl::Command(file, line) do |builder|
|
75
|
+
builder.command_parent = MiniClient::Requester
|
76
|
+
builder.callback{|cmd|
|
77
|
+
cmd.instance_eval{ @factored_arg = arg }
|
78
|
+
}
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
#
|
83
|
+
# Returns an argument passed at factoring time
|
84
|
+
#
|
85
|
+
# SYNOPSIS
|
86
|
+
# #{MiniClient.command_name} factored
|
87
|
+
#
|
88
|
+
class Factored < Factor(__FILE__, __LINE__, :hello)
|
89
|
+
|
90
|
+
def execute(*args)
|
91
|
+
self.class.instance_eval{ @factored_arg }
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
95
|
+
|
96
|
+
end # module MiniClient
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require File.expand_path('../../spec_helper', __FILE__)
|
2
|
+
module Quickl
|
3
|
+
describe "Naming::command2module /" do
|
4
|
+
include Naming
|
5
|
+
|
6
|
+
it "should capitalize first char" do
|
7
|
+
command2module("say").should == "Say"
|
8
|
+
command2module(:say).should == :Say
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should capitalize support dashes" do
|
12
|
+
command2module("say-hello").should == "SayHello"
|
13
|
+
command2module(:"say-hello").should == :SayHello
|
14
|
+
end
|
15
|
+
|
16
|
+
end # module Quickl
|
17
|
+
end # module Quickl
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require File.expand_path('../../spec_helper', __FILE__)
|
2
|
+
module Quickl
|
3
|
+
describe "Naming::module2command /" do
|
4
|
+
include Naming
|
5
|
+
|
6
|
+
it "should uncapitalize first char" do
|
7
|
+
module2command("Say").should == "say"
|
8
|
+
module2command(:Say).should == :say
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should uncapitalize and introduce dashes" do
|
12
|
+
module2command("SayHello").should == "say-hello"
|
13
|
+
module2command(:"SayHello").should == :"say-hello"
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should support taking modules as argument" do
|
17
|
+
module2command(Quickl::Command).should == "command"
|
18
|
+
end
|
19
|
+
|
20
|
+
end # module Quickl
|
21
|
+
end # module Quickl
|
data/spec/quickl_spec.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
require File.expand_path('../fixtures', __FILE__)
|
2
|
+
module Quickl
|
3
|
+
describe "RubyTools#class_unqualified_name /" do
|
4
|
+
|
5
|
+
subject{ RubyTools::class_unqualified_name(clazz) }
|
6
|
+
|
7
|
+
describe "when called on unqualified class" do
|
8
|
+
let(:clazz){ ::String }
|
9
|
+
it{ should == "String" }
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "when called on qualified class" do
|
13
|
+
let(:clazz){ RubyTools }
|
14
|
+
it{ should == "RubyTools" }
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "when called on long qualified class" do
|
18
|
+
let(:clazz){ Quickl::Fixtures::Utils }
|
19
|
+
it{ should == "Utils" }
|
20
|
+
end
|
21
|
+
|
22
|
+
describe "when piped with parent_module" do
|
23
|
+
let(:clazz){ RubyTools::parent_module(Quickl::Fixtures::Utils) }
|
24
|
+
it{ should == "Fixtures" }
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require File.expand_path('../fixtures', __FILE__)
|
2
|
+
module Quickl
|
3
|
+
describe "RubyTools#extract_file_rdoc /" do
|
4
|
+
|
5
|
+
let(:file){ File.expand_path('../fixtures.rb', __FILE__) }
|
6
|
+
|
7
|
+
describe "when used without line and reverse options" do
|
8
|
+
|
9
|
+
subject{ RubyTools::extract_file_rdoc(file) }
|
10
|
+
|
11
|
+
it "should be as expected" do
|
12
|
+
subject.should == File.read(File.expand_path('../fixtures/RubyTools.rdoc', __FILE__))
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "when used with line and reverse options" do
|
18
|
+
|
19
|
+
subject{ RubyTools::extract_file_rdoc(file, 23, true) }
|
20
|
+
|
21
|
+
it "should be as expected" do
|
22
|
+
subject.should == File.read(File.expand_path('../fixtures/Utils.rdoc', __FILE__))
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
end # RubyTools#extract_file_rdoc
|
28
|
+
end # module Quickl
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require File.expand_path('../../spec_helper', __FILE__)
|
2
|
+
module Quickl
|
3
|
+
module Fixtures
|
4
|
+
|
5
|
+
#
|
6
|
+
# This is a fixtures helper that matches documentation conventions.
|
7
|
+
#
|
8
|
+
# This is a second paragraph
|
9
|
+
# That append on two lines
|
10
|
+
#
|
11
|
+
#
|
12
|
+
# WARNING:
|
13
|
+
# This kind of indentation should not be interpreted as code
|
14
|
+
#
|
15
|
+
# But this one yes
|
16
|
+
#
|
17
|
+
module RubyTools
|
18
|
+
end # module RubyTools
|
19
|
+
|
20
|
+
#
|
21
|
+
# This is the documentation of the Utils module
|
22
|
+
#
|
23
|
+
module Utils
|
24
|
+
end # module Utils
|
25
|
+
|
26
|
+
end # module Fixtures
|
27
|
+
end # module Quickl
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require File.expand_path('../fixtures', __FILE__)
|
2
|
+
module Quickl
|
3
|
+
describe "RubyTools#optional_args_block_call /" do
|
4
|
+
|
5
|
+
subject{ RubyTools::optional_args_block_call(block, args) }
|
6
|
+
|
7
|
+
describe "when block has no arguments /" do
|
8
|
+
let(:block){ lambda {
|
9
|
+
"ok"
|
10
|
+
} }
|
11
|
+
|
12
|
+
describe "when no args are given" do
|
13
|
+
let(:args){ [ ] }
|
14
|
+
it { should == "ok" }
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "when no args are given" do
|
18
|
+
let(:args){ [ "hello" ] }
|
19
|
+
it { should == "ok" }
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
describe "when block has one arguments /" do
|
25
|
+
let(:block){ lambda {|name|
|
26
|
+
name
|
27
|
+
} }
|
28
|
+
|
29
|
+
describe "when args are given" do
|
30
|
+
let(:args){ [ "hello" ] }
|
31
|
+
it { should == "hello" }
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require File.expand_path('../fixtures', __FILE__)
|
2
|
+
module Quickl
|
3
|
+
describe "RubyTools#parent_module /" do
|
4
|
+
|
5
|
+
subject{ RubyTools::parent_module(clazz) }
|
6
|
+
|
7
|
+
describe "when called on unqualified class" do
|
8
|
+
let(:clazz){ ::String }
|
9
|
+
it{ should be_nil }
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "when called on qualified class" do
|
13
|
+
let(:clazz){ RubyTools }
|
14
|
+
it{ should == Quickl }
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "when called on long qualified class" do
|
18
|
+
let(:clazz){ Quickl::Fixtures::Utils }
|
19
|
+
it{ should == Quickl::Fixtures }
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
# Installs a rake task for debuging the announcement mail.
|
2
|
+
#
|
3
|
+
# This file installs the 'rake debug_mail' that flushes an announcement mail
|
4
|
+
# for your library on the standard output. It is automatically generated
|
5
|
+
# by Noe from your .noespec file, and should therefore be configured there,
|
6
|
+
# under the variables/rake_tasks/debug_mail entry, as illustrated below:
|
7
|
+
#
|
8
|
+
# variables:
|
9
|
+
# rake_tasks:
|
10
|
+
# debug_mail:
|
11
|
+
# rx_changelog_sections: /^#/
|
12
|
+
# nb_changelog_sections: 1
|
13
|
+
# ...
|
14
|
+
#
|
15
|
+
# If you have specific needs requiring manual intervention on this file,
|
16
|
+
# don't forget to set safe-override to false in your noe specification:
|
17
|
+
#
|
18
|
+
# template-info:
|
19
|
+
# manifest:
|
20
|
+
# tasks/debug_mail.rake:
|
21
|
+
# safe-override: false
|
22
|
+
#
|
23
|
+
# The mail template used can be found in debug_mail.txt. That file may be
|
24
|
+
# changed to tune the mail you want to send. If you do so, don't forget to
|
25
|
+
# add a manifest entry in your .noespec file to avoid overriding you
|
26
|
+
# changes. The mail template uses wlang, with parentheses for block
|
27
|
+
# delimiters.
|
28
|
+
#
|
29
|
+
# template-info:
|
30
|
+
# manifest:
|
31
|
+
# tasks/debug_mail.txt:
|
32
|
+
# safe-override: false
|
33
|
+
#
|
34
|
+
begin
|
35
|
+
require 'wlang'
|
36
|
+
require 'yaml'
|
37
|
+
|
38
|
+
desc "Debug the release announcement mail"
|
39
|
+
task :debug_mail do
|
40
|
+
# Check that a .noespec file exists
|
41
|
+
noespec_file = File.expand_path('../../quickl.noespec', __FILE__)
|
42
|
+
unless File.exists?(noespec_file)
|
43
|
+
raise "Unable to find .noespec project file, sorry."
|
44
|
+
end
|
45
|
+
|
46
|
+
# Load it as well as variables and options
|
47
|
+
noespec = YAML::load(File.read(noespec_file))
|
48
|
+
vars = noespec['variables'] || {}
|
49
|
+
|
50
|
+
# Changes are taken from CHANGELOG
|
51
|
+
logs = Dir[File.expand_path("../../CHANGELOG.*", __FILE__)]
|
52
|
+
unless logs.size == 1
|
53
|
+
abort "Unable to find a changelog file"
|
54
|
+
end
|
55
|
+
|
56
|
+
# Load interesting changesets
|
57
|
+
changes, end_found = [], 0
|
58
|
+
File.readlines(logs.first).select{|line|
|
59
|
+
if line =~ /^#/
|
60
|
+
break if end_found >= 1
|
61
|
+
end_found += 1
|
62
|
+
end
|
63
|
+
changes << line
|
64
|
+
}
|
65
|
+
vars['changes'] = changes.join
|
66
|
+
|
67
|
+
# WLang template
|
68
|
+
template = File.expand_path('../debug_mail.txt', __FILE__)
|
69
|
+
|
70
|
+
# Let's go!
|
71
|
+
$stdout << WLang::file_instantiate(template, vars, "wlang/active-text")
|
72
|
+
end
|
73
|
+
|
74
|
+
rescue LoadError
|
75
|
+
task :debug_mail do
|
76
|
+
abort "wlang is not available. Try 'gem install wlang'"
|
77
|
+
end
|
78
|
+
end
|
data/tasks/gem.rake
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
# Installs rake tasks for gemming and packaging
|
2
|
+
#
|
3
|
+
# This file installs the 'rake package', 'rake gem' tasks and associates
|
4
|
+
# (clobber_package, repackage, ...). It is automatically generated by Noe
|
5
|
+
# from your .noespec file, and should therefore be configured there, under
|
6
|
+
# the variables/rake_tasks/gem entry, as illustrated below:
|
7
|
+
#
|
8
|
+
# variables:
|
9
|
+
# rake_tasks:
|
10
|
+
# gem:
|
11
|
+
# package_dir: pkg
|
12
|
+
# need_tar: false
|
13
|
+
# need_tar_gz: false
|
14
|
+
# need_tar_bz2: false
|
15
|
+
# need_zip: false
|
16
|
+
# ...
|
17
|
+
#
|
18
|
+
# If you have specific needs requiring manual intervention on this file,
|
19
|
+
# don't forget to set safe-override to false in your noe specification:
|
20
|
+
#
|
21
|
+
# template-info:
|
22
|
+
# manifest:
|
23
|
+
# tasks/gem.rake:
|
24
|
+
# safe-override: false
|
25
|
+
#
|
26
|
+
begin
|
27
|
+
require 'rubygems/package_task'
|
28
|
+
Gem::PackageTask.new($gemspec) do |t|
|
29
|
+
|
30
|
+
# Name of the package
|
31
|
+
t.name = $gemspec.name
|
32
|
+
|
33
|
+
# Version of the package
|
34
|
+
t.version = $gemspec.version
|
35
|
+
|
36
|
+
# Directory used to store the package files
|
37
|
+
t.package_dir = "pkg"
|
38
|
+
|
39
|
+
# True if a gzipped tar file (tgz) should be produced
|
40
|
+
t.need_tar = false
|
41
|
+
|
42
|
+
# True if a gzipped tar file (tar.gz) should be produced
|
43
|
+
t.need_tar_gz = false
|
44
|
+
|
45
|
+
# True if a bzip2'd tar file (tar.bz2) should be produced
|
46
|
+
t.need_tar_bz2 = false
|
47
|
+
|
48
|
+
# True if a zip file should be produced (default is false)
|
49
|
+
t.need_zip = false
|
50
|
+
|
51
|
+
# List of files to be included in the package.
|
52
|
+
t.package_files = $gemspec.files
|
53
|
+
|
54
|
+
# Tar command for gzipped or bzip2ed archives.
|
55
|
+
t.tar_command = "tar"
|
56
|
+
|
57
|
+
# Zip command for zipped archives.
|
58
|
+
t.zip_command = "zip"
|
59
|
+
|
60
|
+
end
|
61
|
+
rescue LoadError
|
62
|
+
task :gem do
|
63
|
+
abort 'rubygems/package_task is not available. You should verify your rubygems installation'
|
64
|
+
end
|
65
|
+
task :package do
|
66
|
+
abort 'rubygems/package_task is not available. You should verify your rubygems installation'
|
67
|
+
end
|
68
|
+
end
|