corundum 0.0.10 → 0.0.12
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/doc/coverage/index.html +3706 -2868
- data/lib/corundum.rb +3 -1
- data/lib/corundum/configuration_store.rb +2 -2
- data/lib/corundum/default_configuration/templates/doc_assembly/index.html.erb +28 -0
- data/lib/corundum/documentation-task.rb +69 -0
- data/lib/corundum/documentation.rb +2 -0
- data/lib/corundum/documentation/assembly.rb +56 -0
- data/lib/corundum/{yardoc.rb → documentation/yardoc.rb} +9 -36
- data/lib/corundum/rspec-task.rb +78 -0
- data/lib/corundum/rspec.rb +15 -61
- data/lib/corundum/simplecov.rb +17 -31
- data/lib/corundum/tasklibs.rb +1 -1
- metadata +13 -8
data/lib/corundum.rb
CHANGED
@@ -11,7 +11,8 @@ module Corundum
|
|
11
11
|
settings(
|
12
12
|
:gemspec => nil,
|
13
13
|
:gemspec_path => nil,
|
14
|
-
:
|
14
|
+
:corundum_dir => "corundum",
|
15
|
+
:finished_dir => nil,
|
15
16
|
:package_dir => "pkg",
|
16
17
|
:doc_dir => "rubydoc",
|
17
18
|
:browser => Corundum.user_preferences["browser"],
|
@@ -38,6 +39,7 @@ module Corundum
|
|
38
39
|
def resolve_configuration
|
39
40
|
load_gemspec
|
40
41
|
|
42
|
+
self.finished_dir ||= File::join(corundum_dir, "finished")
|
41
43
|
@finished_files.build ||= File::join( package_dir, "#{gemspec.full_name}.gem")
|
42
44
|
|
43
45
|
@finished_files.qa ||= File::join( finished_dir, "qa_#{gemspec.version}")
|
@@ -15,10 +15,10 @@ module Corundum
|
|
15
15
|
@loaded ||= Hash.new{|h,k| h[k] = @valise.find(k).contents}
|
16
16
|
end
|
17
17
|
|
18
|
-
attr_reader :loaded
|
18
|
+
attr_reader :loaded, :valise
|
19
19
|
|
20
20
|
def register_search_path(from_file)
|
21
|
-
directory = File::
|
21
|
+
directory = File::expand_path("../.corundum", from_file)
|
22
22
|
@valise.prepend_search_root(Valise::SearchRoot.new(directory))
|
23
23
|
loaded.clear
|
24
24
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
</head>
|
4
|
+
<body>
|
5
|
+
<div class="gem-details">
|
6
|
+
<h1><%= gemspec.name %></h1>
|
7
|
+
<h2><%= gemspec.summary %></h2>
|
8
|
+
<h2>(current version: <%= gemspec.version %>)</h2>
|
9
|
+
<p><%= gemspec.description.gsub(/\n\s*\n/, "</p><p>") %></p>
|
10
|
+
</div>
|
11
|
+
<div class="documentation-list">
|
12
|
+
<p>Documentation is in a few sections:</p>
|
13
|
+
<ul>
|
14
|
+
<% documenters.each_pair do |path, doccer| %>
|
15
|
+
<li><a href="<%= doccer.entry_link %>"><%= doccer.title%></a></li>
|
16
|
+
<% end %>
|
17
|
+
</ul>
|
18
|
+
</div>
|
19
|
+
<div class="credits">
|
20
|
+
<dl>
|
21
|
+
<% gemspec.authors.zip(gemspec.email).each do |author, email| %>
|
22
|
+
<dt><%= author %></dt>
|
23
|
+
<dd><%= email %></dd>
|
24
|
+
<% end %>
|
25
|
+
</dl>
|
26
|
+
</div>
|
27
|
+
</body>
|
28
|
+
</html>
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'corundum/tasklib'
|
2
|
+
|
3
|
+
module Corundum
|
4
|
+
class DocumentationTask < TaskLib
|
5
|
+
setting :title
|
6
|
+
setting :browser
|
7
|
+
setting :gemspec
|
8
|
+
|
9
|
+
setting :corundum_dir
|
10
|
+
setting :docs_root
|
11
|
+
|
12
|
+
setting :target_dir
|
13
|
+
setting :sub_dir
|
14
|
+
|
15
|
+
setting :entry_file, "index.html"
|
16
|
+
|
17
|
+
#The path from the project root to the entry file
|
18
|
+
#Resolves if unset to target_dir + entry_file
|
19
|
+
setting :entry_path
|
20
|
+
|
21
|
+
#The URL path from this documentation root
|
22
|
+
#Resolves if unset to sub_dir + entry_file
|
23
|
+
setting :entry_link
|
24
|
+
|
25
|
+
|
26
|
+
def self.title(name)
|
27
|
+
setting :title, name
|
28
|
+
end
|
29
|
+
|
30
|
+
def default_configuration(toolkit)
|
31
|
+
toolkit.copy_settings_to(self)
|
32
|
+
end
|
33
|
+
|
34
|
+
def resolve_configuration
|
35
|
+
if unset?(docs_root)
|
36
|
+
self.docs_root = File::join(corundum_dir, "docs")
|
37
|
+
end
|
38
|
+
|
39
|
+
if unset?(target_dir)
|
40
|
+
self.target_dir = File::join(docs_root, sub_dir)
|
41
|
+
else
|
42
|
+
self.sub_dir = target_dir.sub(/^#{docs_root}\//,"")
|
43
|
+
end
|
44
|
+
|
45
|
+
if unset?(entry_path)
|
46
|
+
self.entry_path = File::join(target_dir, entry_file)
|
47
|
+
end
|
48
|
+
|
49
|
+
if unset?(entry_link)
|
50
|
+
self.entry_link = File::join(sub_dir, entry_file)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def entry_point(under = nil)
|
55
|
+
File::join(under || target_dir, entry_file)
|
56
|
+
end
|
57
|
+
|
58
|
+
def define
|
59
|
+
directory target_dir
|
60
|
+
|
61
|
+
in_namespace do
|
62
|
+
desc "Open up a browser to view your documentation"
|
63
|
+
BrowserTask.new(self) do |t|
|
64
|
+
t.index_html = entry_point
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'corundum/documentation-task'
|
2
|
+
require 'mattock/template-host'
|
3
|
+
|
4
|
+
module Corundum
|
5
|
+
class DocumentationAssembly < DocumentationTask
|
6
|
+
include Mattock::TemplateHost
|
7
|
+
|
8
|
+
title 'Assembled Documentation'
|
9
|
+
|
10
|
+
setting :sub_dir, "assembled"
|
11
|
+
setting :documenters, []
|
12
|
+
setting :extra_data, {}
|
13
|
+
|
14
|
+
def default_configuration(toolkit, *documenters)
|
15
|
+
super(toolkit)
|
16
|
+
self.documenters = documenters
|
17
|
+
self.valise = Corundum::configuration_store.valise
|
18
|
+
end
|
19
|
+
|
20
|
+
def resolve_configuration
|
21
|
+
super
|
22
|
+
self.documenters = documenters.each_with_object({}) do |doccer, hash|
|
23
|
+
hash[File::join(target_dir, doccer.sub_dir)] = doccer
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
def define
|
29
|
+
in_namespace do
|
30
|
+
subdir_regex = %r{^#{File::expand_path(target_dir)}}
|
31
|
+
|
32
|
+
documenters.each_pair do |subdir, doccer|
|
33
|
+
file subdir => [target_dir, doccer.entry_point] do
|
34
|
+
if subdir_regex =~ File::expand_path(doccer.target_dir)
|
35
|
+
fail "Documentation being rendered to #{doccer.target_dir}, inside of #{target_dir}"
|
36
|
+
end
|
37
|
+
|
38
|
+
FileUtils.rm_rf(subdir)
|
39
|
+
FileUtils.mv(doccer.target_dir, subdir)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
#Colision of doc groups
|
44
|
+
task :collect => documenters.keys
|
45
|
+
|
46
|
+
desc "Generate various documentation and collect it in one place"
|
47
|
+
file entry_point => [target_dir, :collect] do
|
48
|
+
File::open(entry_point, "w") do |file|
|
49
|
+
file.write(render("doc_assembly/index.html.erb"))
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
super
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -1,46 +1,18 @@
|
|
1
|
-
require 'corundum/
|
1
|
+
require 'corundum/documentation-task'
|
2
2
|
require 'yard'
|
3
3
|
|
4
4
|
module Corundum
|
5
|
-
class DocumentationTask < TaskLib
|
6
|
-
setting :entry_point
|
7
|
-
setting :target_dir
|
8
|
-
setting :browser
|
9
|
-
|
10
|
-
def default_configuration(toolkit)
|
11
|
-
self.browser = toolkit.browser
|
12
|
-
end
|
13
|
-
|
14
|
-
def resolve_configuration
|
15
|
-
self.entry_point ||= File::join(target_dir, "index.html")
|
16
|
-
end
|
17
|
-
|
18
|
-
def define
|
19
|
-
directory target_dir
|
20
|
-
|
21
|
-
in_namespace do
|
22
|
-
desc "Open up a browser to view your documentation"
|
23
|
-
BrowserTask.new(self) do |t|
|
24
|
-
t.index_html = entry_point
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
desc "Generate documentation based on code using YARD"
|
29
|
-
task root_task => entry_point
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
5
|
class YARDoc < DocumentationTask
|
6
|
+
title "YARD API documentation"
|
34
7
|
default_namespace :yardoc
|
35
8
|
|
36
9
|
setting :gemspec
|
37
|
-
setting :options, nil
|
38
|
-
setting :entry_point, nil
|
39
10
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
11
|
+
settings(:options => nil,
|
12
|
+
:readme => nil,
|
13
|
+
:sub_dir => "yardoc",
|
14
|
+
:files => nested(:code => [], :docs => []),
|
15
|
+
:extra_files => [] )
|
44
16
|
|
45
17
|
def document_inputs
|
46
18
|
FileList["README*"] + files.code + files.docs + extra_files
|
@@ -55,12 +27,13 @@ module Corundum
|
|
55
27
|
|
56
28
|
def resolve_configuration
|
57
29
|
self.options ||= gemspec.rdoc_options
|
58
|
-
self.options += [ "--output-dir", target_dir]
|
59
30
|
self.options += [ "--readme", readme ] if readme
|
60
31
|
self.options += files.code
|
61
32
|
unless files.docs.empty? and extra_files.empty?
|
62
33
|
self.options += [ "-" ] + files.docs + extra_files
|
63
34
|
end
|
35
|
+
super
|
36
|
+
self.options += [ "--output-dir", target_dir]
|
64
37
|
end
|
65
38
|
|
66
39
|
def define
|
@@ -0,0 +1,78 @@
|
|
1
|
+
require 'rbconfig'
|
2
|
+
require 'mattock/command-task'
|
3
|
+
|
4
|
+
module Corundum
|
5
|
+
class RSpecTask < Mattock::CommandTask
|
6
|
+
setting :ruby_command, Mattock::CommandLine.new(RbConfig.ruby) do |cmd|
|
7
|
+
if /^1\.8/ =~ RUBY_VERSION
|
8
|
+
cmd.options << "-S"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
setting :runner_command
|
13
|
+
|
14
|
+
required_fields :pattern, :ruby_opts, :rspec_configs, :rspec_opts,
|
15
|
+
:warning, :rspec_path, :rspec_opts, :failure_message, :files_to_run,
|
16
|
+
:file_dependencies
|
17
|
+
|
18
|
+
def default_configuration(rspec)
|
19
|
+
super
|
20
|
+
rspec.copy_settings_to(self)
|
21
|
+
end
|
22
|
+
|
23
|
+
def resolve_configuration
|
24
|
+
self.rspec_configs = rspec_opts
|
25
|
+
self.rspec_path = %x"which #{rspec_path}".chomp
|
26
|
+
|
27
|
+
ruby_command.options << ruby_opts if ruby_opts
|
28
|
+
ruby_command.options << "-w" if warning
|
29
|
+
|
30
|
+
self.runner_command = Mattock::CommandLine.new(rspec_path) do |cmd|
|
31
|
+
cmd.options << rspec_opts
|
32
|
+
cmd.options << files_to_run
|
33
|
+
end
|
34
|
+
|
35
|
+
self.command = Mattock::WrappingChain.new do |cmd|
|
36
|
+
cmd.add ruby_command
|
37
|
+
cmd.add runner_command
|
38
|
+
end
|
39
|
+
|
40
|
+
super
|
41
|
+
|
42
|
+
if task_args.last.is_a? Hash
|
43
|
+
key = task_args.last.keys.first
|
44
|
+
task_args.last[key] = [*task_args.last[key]] + file_dependencies
|
45
|
+
else
|
46
|
+
key = task_args.pop
|
47
|
+
task_args << { key => file_dependencies }
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
class RSpecReportTask < RSpecTask
|
53
|
+
setting :target_dir
|
54
|
+
setting :doc_file, "index.html"
|
55
|
+
setting :doc_path
|
56
|
+
|
57
|
+
def timestamp
|
58
|
+
if File.exist?(doc_path)
|
59
|
+
File.mtime(doc_path.to_s)
|
60
|
+
else
|
61
|
+
Rake::EARLY
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def out_of_date?(stamp)
|
66
|
+
@prerequisites.any? { |n| application[n, @scope].timestamp > stamp}
|
67
|
+
end
|
68
|
+
|
69
|
+
def needed?
|
70
|
+
! File.exist?(doc_path) || out_of_date?(timestamp)
|
71
|
+
end
|
72
|
+
|
73
|
+
def default_configuration(rspec)
|
74
|
+
super
|
75
|
+
self.doc_path = File::join(target_dir, doc_file)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
data/lib/corundum/rspec.rb
CHANGED
@@ -1,59 +1,13 @@
|
|
1
|
-
require 'corundum/
|
2
|
-
require 'rspec
|
3
|
-
require 'mattock/command-task'
|
4
|
-
require 'rbconfig'
|
1
|
+
require 'corundum/documentation-task'
|
2
|
+
require 'corundum/rspec-task'
|
5
3
|
|
6
4
|
module Corundum
|
7
|
-
class
|
8
|
-
setting :ruby_command, Mattock::CommandLine.new(RbConfig.ruby) do |cmd|
|
9
|
-
if /^1\.8/ =~ RUBY_VERSION
|
10
|
-
cmd.options << "-S"
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
setting :runner_command
|
15
|
-
|
16
|
-
required_fields :pattern, :ruby_opts, :rspec_configs, :rspec_opts,
|
17
|
-
:warning, :rspec_path, :rspec_opts, :failure_message, :files_to_run
|
18
|
-
|
19
|
-
def default_configuration(rspec)
|
20
|
-
super
|
21
|
-
self.pattern = rspec.pattern
|
22
|
-
self.ruby_opts = rspec.ruby_opts
|
23
|
-
self.rspec_configs = rspec.rspec_configs
|
24
|
-
self.rspec_opts = rspec.rspec_opts
|
25
|
-
self.warning = rspec.warning
|
26
|
-
self.rspec_path = rspec.rspec_path
|
27
|
-
self.rspec_opts = rspec.rspec_opts
|
28
|
-
self.failure_message = rspec.failure_message
|
29
|
-
self.files_to_run = rspec.files_to_run
|
30
|
-
end
|
31
|
-
|
32
|
-
def resolve_configuration
|
33
|
-
self.rspec_configs = rspec_opts
|
34
|
-
self.rspec_path = %x"which #{rspec_path}".chomp
|
35
|
-
|
36
|
-
ruby_command.options << ruby_opts if ruby_opts
|
37
|
-
ruby_command.options << "-w" if warning
|
38
|
-
|
39
|
-
self.runner_command = Mattock::CommandLine.new(rspec_path) do |cmd|
|
40
|
-
cmd.options << rspec_opts
|
41
|
-
cmd.options << files_to_run
|
42
|
-
end
|
43
|
-
|
44
|
-
self.command = Mattock::WrappingChain.new do |cmd|
|
45
|
-
cmd.add ruby_command
|
46
|
-
cmd.add runner_command
|
47
|
-
end
|
48
|
-
super
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
|
53
|
-
class RSpec < TaskLib
|
5
|
+
class RSpec < DocumentationTask
|
54
6
|
default_namespace :rspec
|
7
|
+
title "RSpec run output"
|
55
8
|
|
56
9
|
settings(
|
10
|
+
:sub_dir => "rspec",
|
57
11
|
:pattern => './spec{,/*/**}/*_spec.rb',
|
58
12
|
:rspec_configs => nil,
|
59
13
|
:rspec_opts => nil,
|
@@ -66,10 +20,10 @@ module Corundum
|
|
66
20
|
:files_to_run => "spec"
|
67
21
|
)
|
68
22
|
|
69
|
-
required_fields :gemspec_path, :qa_finished_path
|
23
|
+
required_fields :gemspec_path, :qa_finished_path, :file_lists, :file_dependencies
|
70
24
|
|
71
25
|
def default_configuration(toolkit)
|
72
|
-
|
26
|
+
super
|
73
27
|
self.qa_finished_path = toolkit.finished_files.qa
|
74
28
|
end
|
75
29
|
|
@@ -78,25 +32,25 @@ module Corundum
|
|
78
32
|
self.rspec_configs = rspec_opts
|
79
33
|
self.rspec_opts = []
|
80
34
|
self.rspec_path = %x"which #{rspec_path}".chomp
|
35
|
+
self.file_dependencies = file_lists.code + file_lists.test + file_lists.project
|
36
|
+
super
|
81
37
|
end
|
82
38
|
|
83
39
|
def define
|
40
|
+
super
|
84
41
|
in_namespace do
|
85
42
|
desc "Always run every spec"
|
86
|
-
RSpecTask.new(self)
|
87
|
-
t.task_name = :all
|
88
|
-
end
|
43
|
+
RSpecTask.new(self, :all)
|
89
44
|
|
90
45
|
desc "Generate specifications documentation"
|
91
|
-
|
92
|
-
t.
|
93
|
-
t.rspec_opts = %w{-o /dev/null -f d -o doc/Specifications}
|
46
|
+
RSpecReportTask.new(self, :doc) do |t|
|
47
|
+
t.rspec_opts = %w{-o /dev/null -f h -o} + [t.doc_path]
|
94
48
|
t.failure_message = "Failed generating specification docs"
|
95
49
|
end
|
50
|
+
file entry_path => :doc
|
96
51
|
|
97
52
|
desc "Run only failing examples listed in last_run"
|
98
|
-
RSpecTask.new(self) do |t|
|
99
|
-
t.task_name = :quick
|
53
|
+
RSpecTask.new(self, :quick) do |t|
|
100
54
|
examples = []
|
101
55
|
begin
|
102
56
|
File.open("last_run", "r") do |fail_list|
|