corundum 0.3.9 → 0.4.0
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.
- checksums.yaml +8 -8
- data/lib/corundum/core.rb +35 -51
- data/lib/corundum/documentation-task.rb +10 -30
- data/lib/corundum/gem_building.rb +6 -7
- data/lib/corundum/gemcutter.rb +10 -12
- data/lib/corundum/questionable-content.rb +9 -0
- data/lib/corundum/rspec-task.rb +34 -15
- data/lib/corundum/rspec.rb +25 -22
- data/lib/corundum/simplecov.rb +43 -22
- data/lib/corundum/tasklibs.rb +0 -3
- data/lib/corundum/version_control.rb +1 -1
- data/lib/corundum/version_control/git.rb +2 -2
- metadata +18 -86
- data/lib/corundum/default_configuration/templates/doc_assembly/index.html.erb +0 -40
- data/lib/corundum/default_configuration/templates/doc_assembly/stylesheet.scss +0 -326
- data/lib/corundum/default_configuration/templates/doc_assembly/theme/images/checker.png +0 -0
- data/lib/corundum/default_configuration/templates/doc_assembly/theme/javascripts/scale.fix.js +0 -17
- data/lib/corundum/default_configuration/templates/doc_assembly/theme/sass/styles.scss +0 -325
- data/lib/corundum/default_configuration/templates/doc_assembly/theme/stylesheets/pygment_trac.css +0 -60
- data/lib/corundum/default_configuration/templates/doc_assembly/theme/stylesheets/styles.css +0 -363
- data/lib/corundum/documentation.rb +0 -2
- data/lib/corundum/documentation/assembly.rb +0 -115
- data/lib/corundum/documentation/yardoc.rb +0 -70
- data/lib/corundum/email.rb +0 -82
- data/lib/corundum/github-pages.rb +0 -153
@@ -1,115 +0,0 @@
|
|
1
|
-
require 'compass'
|
2
|
-
require 'corundum/documentation-task'
|
3
|
-
#require 'mattock/template-host'
|
4
|
-
|
5
|
-
module Corundum
|
6
|
-
class DocumentationAssembly < DocumentationTask
|
7
|
-
|
8
|
-
title 'Assembled Documentation'
|
9
|
-
|
10
|
-
dir(:assembly_sub, "doc_assembly",
|
11
|
-
dir(:theme_dir, "theme",
|
12
|
-
dir(:theme_sass, "sass",
|
13
|
-
path(:root_stylesheet, "styles"))),
|
14
|
-
path(:index_source, "index.html"))
|
15
|
-
|
16
|
-
dir(:target, path(:stylesheet, "stylesheet.css"))
|
17
|
-
|
18
|
-
setting :templates
|
19
|
-
|
20
|
-
setting :sub_dir, "assembled"
|
21
|
-
setting :documenters, []
|
22
|
-
setting :extra_data, {}
|
23
|
-
setting :external_docs, {}
|
24
|
-
setting :css_dir, "stylesheets" #XXX
|
25
|
-
setting :compass_config, nested(
|
26
|
-
:http_path => "/",
|
27
|
-
:line_comments => false,
|
28
|
-
:preferred_syntax => :scss,
|
29
|
-
:http_stylesheets_path => nil,
|
30
|
-
:project_path => nil,
|
31
|
-
:images_dir => 'images',
|
32
|
-
)
|
33
|
-
|
34
|
-
def default_configuration(toolkit, *documenters)
|
35
|
-
super(toolkit)
|
36
|
-
self.documenters = documenters
|
37
|
-
|
38
|
-
self.compass_config.http_stylesheets_path = css_dir #XXX
|
39
|
-
end
|
40
|
-
|
41
|
-
def resolve_configuration
|
42
|
-
super
|
43
|
-
assembly_sub.absolute_path = assembly_sub.relative_path
|
44
|
-
target.absolute_path = target_dir
|
45
|
-
|
46
|
-
resolve_paths
|
47
|
-
|
48
|
-
if field_unset?(:templates)
|
49
|
-
self.templates = Corundum::configuration_store.valise.templates do |mapping|
|
50
|
-
case mapping
|
51
|
-
when "sass", "scss"
|
52
|
-
valise = Corundum::configuration_store.valise
|
53
|
-
options =
|
54
|
-
if Compass.respond_to? :sass_engine_options
|
55
|
-
Compass.sass_engine_options
|
56
|
-
else
|
57
|
-
require 'compass/core'
|
58
|
-
{ :load_paths => [Compass::Core.base_directory("stylesheets")] }
|
59
|
-
end
|
60
|
-
options[:load_paths] = valise.sub_set("templates").map(&:to_s) + options[:load_paths]
|
61
|
-
{ :template_options => options }
|
62
|
-
else
|
63
|
-
nil
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
self.compass_config.project_path = templates.find("doc_assembly/theme").full_path
|
69
|
-
|
70
|
-
self.documenters = documenters.each_with_object({}) do |doccer, hash|
|
71
|
-
hash[File::join(target_dir, doccer.sub_dir)] = doccer
|
72
|
-
end
|
73
|
-
if field_unset?(:stylesheet)
|
74
|
-
self.stylesheet = File::join(target_dir, "stylesheet.css")
|
75
|
-
end
|
76
|
-
|
77
|
-
end
|
78
|
-
|
79
|
-
|
80
|
-
def define
|
81
|
-
in_namespace do
|
82
|
-
subdir_regex = %r{^#{File::expand_path(target_dir)}}
|
83
|
-
|
84
|
-
documenters.each_pair do |subdir, doccer|
|
85
|
-
file subdir => [target_dir, doccer.entry_point] do
|
86
|
-
if subdir_regex =~ File::expand_path(doccer.target_dir)
|
87
|
-
fail "Documentation being rendered to #{doccer.target_dir}, inside of #{target_dir}"
|
88
|
-
end
|
89
|
-
|
90
|
-
FileUtils.rm_rf(subdir)
|
91
|
-
FileUtils.mv(doccer.target_dir, subdir)
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
#XXX Collision of doc groups
|
96
|
-
task :collect => documenters.keys
|
97
|
-
|
98
|
-
file stylesheet.abspath => [target.abspath] do |task|
|
99
|
-
template = templates.find(root_stylesheet.abspath).contents
|
100
|
-
File::open(task.name, "w") do |file|
|
101
|
-
file.write(template.render(nil, nil))
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
file entry_point => [stylesheet.abspath, target.abspath, :collect] do |task|
|
106
|
-
template = templates.find(index_source.abspath).contents
|
107
|
-
File::open(task.name, "w") do |file|
|
108
|
-
file.write(template.render(self, {}))
|
109
|
-
end
|
110
|
-
end
|
111
|
-
end
|
112
|
-
super
|
113
|
-
end
|
114
|
-
end
|
115
|
-
end
|
@@ -1,70 +0,0 @@
|
|
1
|
-
require 'corundum/documentation-task'
|
2
|
-
require 'yard'
|
3
|
-
|
4
|
-
module Corundum
|
5
|
-
class YARDoc < DocumentationTask
|
6
|
-
title "YARD API documentation"
|
7
|
-
default_namespace :yardoc
|
8
|
-
|
9
|
-
setting :gemspec
|
10
|
-
|
11
|
-
settings(:options => nil,
|
12
|
-
:readme => nil,
|
13
|
-
:sub_dir => "yardoc",
|
14
|
-
:files => nested(:code => [], :docs => []),
|
15
|
-
:extra_files => [] )
|
16
|
-
|
17
|
-
settings(:server_options => [],
|
18
|
-
:server => nested(
|
19
|
-
:port => 8888,
|
20
|
-
:docroot => "/tmp/yard",
|
21
|
-
:plugins => [])
|
22
|
-
)
|
23
|
-
|
24
|
-
|
25
|
-
def document_inputs
|
26
|
-
FileList["README*"] + files.code + files.docs + extra_files
|
27
|
-
end
|
28
|
-
|
29
|
-
def default_configuration(toolkit)
|
30
|
-
super
|
31
|
-
self.gemspec = toolkit.gemspec
|
32
|
-
toolkit.files.copy_settings_to(self.files)
|
33
|
-
self.files.docs = []
|
34
|
-
end
|
35
|
-
|
36
|
-
def resolve_configuration
|
37
|
-
self.options ||= gemspec.rdoc_options
|
38
|
-
self.options += [ "--readme", readme ] if readme
|
39
|
-
self.options += files.code
|
40
|
-
unless files.docs.empty? and extra_files.empty?
|
41
|
-
self.options += [ "-" ] + files.docs + extra_files
|
42
|
-
end
|
43
|
-
super
|
44
|
-
self.options += [ "--output-dir", target_dir]
|
45
|
-
|
46
|
-
|
47
|
-
self.server_options += ["--reload"]
|
48
|
-
self.server_options += ["--port", server.port.to_s]
|
49
|
-
self.server_options += ["--docroot", server.docroot]
|
50
|
-
self.server.plugins.each do |plugin|
|
51
|
-
self.server_options += ["--plugin", plugin]
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
def define
|
56
|
-
in_namespace do
|
57
|
-
file entry_point => document_inputs do
|
58
|
-
YARD::CLI::Yardoc.run( *(options) )
|
59
|
-
end
|
60
|
-
|
61
|
-
desc "Start a live YARD server for editing inline docs"
|
62
|
-
task :live do
|
63
|
-
YARD::CLI::Server.run( *(options + server_options) )
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
super
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
data/lib/corundum/email.rb
DELETED
@@ -1,82 +0,0 @@
|
|
1
|
-
require 'mattock/tasklib'
|
2
|
-
|
3
|
-
module Corundum
|
4
|
-
class Email < Mattock::TaskLib
|
5
|
-
default_namespace :email
|
6
|
-
|
7
|
-
setting(:rubyforge)
|
8
|
-
setting(:email_servers, [])
|
9
|
-
setting(:gemspec)
|
10
|
-
setting(:announce_to_email, nil)
|
11
|
-
setting(:urls, nested.required_fields(:home_page, :project_page))
|
12
|
-
|
13
|
-
def default_configuration(toolkit)
|
14
|
-
super
|
15
|
-
self.rubyforge = toolkit.rubyforge
|
16
|
-
self.gemspec = toolkit.gemspec
|
17
|
-
self.urls.home_page = toolkit.gemspec.homepage
|
18
|
-
self.urls.project_page = toolkit.rubyforge.project_page
|
19
|
-
end
|
20
|
-
|
21
|
-
def announcement
|
22
|
-
changes = ""
|
23
|
-
begin
|
24
|
-
File::open("./Changelog", "r") do |changelog|
|
25
|
-
changes = "Changes:\n\n"
|
26
|
-
changes += changelog.read
|
27
|
-
end
|
28
|
-
rescue Exception
|
29
|
-
end
|
30
|
-
|
31
|
-
urls = "Project: #{urls.project_page}\n" +
|
32
|
-
"Homepage: #{urls.home_page}"
|
33
|
-
|
34
|
-
subject = "#{gemspec.name} #{gemspec.version} Released"
|
35
|
-
title = "#{gemspec.name} version #{gemspec.version} has been released!"
|
36
|
-
body = "#{gemspec.description}\n\n#{changes}\n\n#{urls}"
|
37
|
-
|
38
|
-
return subject, title, body
|
39
|
-
end
|
40
|
-
|
41
|
-
def define
|
42
|
-
desc 'Announce release on email'
|
43
|
-
task root_task => in_namespace("rubyforge", "email")
|
44
|
-
in_namespace do
|
45
|
-
file "email.txt" do |t|
|
46
|
-
require 'mailfactory'
|
47
|
-
|
48
|
-
subject, title, body= announcement
|
49
|
-
|
50
|
-
mail = MailFactory.new
|
51
|
-
mail.To = announce_to_email
|
52
|
-
mail.From = gemspec.email
|
53
|
-
mail.Subject = "[ANN] " + subject
|
54
|
-
mail.text = [title, body].join("\n\n")
|
55
|
-
|
56
|
-
File.open(t.name, "w") do |mailfile|
|
57
|
-
mailfile.write mail.to_s
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
task :email => "email.txt" do
|
62
|
-
require 'net/smtp'
|
63
|
-
|
64
|
-
email_servers.each do |server_config|
|
65
|
-
begin
|
66
|
-
File::open("email.txt", "r") do |email|
|
67
|
-
Net::SMTP.start(server_config[:server], 25, server_config[:helo], server_config[:username], server_config[:password]) do |smtp|
|
68
|
-
smtp.data do |mta|
|
69
|
-
mta.write(email.read)
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
break
|
74
|
-
rescue Object => ex
|
75
|
-
puts ex.message
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
@@ -1,153 +0,0 @@
|
|
1
|
-
require 'mattock/tasklib'
|
2
|
-
require 'mattock/task'
|
3
|
-
|
4
|
-
module Corundum
|
5
|
-
class GitTask < Mattock::Rake::CommandTask
|
6
|
-
setting(:subcommand)
|
7
|
-
setting(:arguments, [])
|
8
|
-
|
9
|
-
def command
|
10
|
-
cmd("git", "--no-pager") do |cmd|
|
11
|
-
cmd.options << subcommand
|
12
|
-
arguments.each do |arg|
|
13
|
-
cmd.options += [*arg]
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
class InDirCommandTask < Mattock::Rake::CommandTask
|
20
|
-
setting :target_dir
|
21
|
-
|
22
|
-
def default_configuration(parent)
|
23
|
-
super
|
24
|
-
parent.copy_settings_to(self)
|
25
|
-
end
|
26
|
-
|
27
|
-
def needed?
|
28
|
-
return true unless File.directory? target_dir
|
29
|
-
Dir.chdir target_dir do
|
30
|
-
super
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def action(*args)
|
35
|
-
Dir.chdir target_dir do
|
36
|
-
super
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
class GithubPages < Mattock::CommandTaskLib
|
42
|
-
default_namespace :publish_docs
|
43
|
-
|
44
|
-
setting(:target_dir, "gh-pages")
|
45
|
-
setting(:source_dir)
|
46
|
-
setting(:docs_index)
|
47
|
-
|
48
|
-
nil_fields :repo_dir
|
49
|
-
|
50
|
-
def branch
|
51
|
-
"gh-pages"
|
52
|
-
end
|
53
|
-
|
54
|
-
def default_configuration(doc_gen)
|
55
|
-
super
|
56
|
-
self.source_dir = doc_gen.target_dir
|
57
|
-
self.docs_index = doc_gen.entry_point
|
58
|
-
end
|
59
|
-
|
60
|
-
def resolve_configuration
|
61
|
-
super
|
62
|
-
self.repo_dir ||= File::join(target_dir, ".git")
|
63
|
-
end
|
64
|
-
|
65
|
-
def git_command(*args)
|
66
|
-
cmd("git", "--no-pager") do |cmd|
|
67
|
-
args.each do |arg|
|
68
|
-
cmd.options += [*arg]
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
def git(*args)
|
74
|
-
result = git_command(*args).run
|
75
|
-
result.must_succeed!
|
76
|
-
result.stdout.lines.to_a
|
77
|
-
end
|
78
|
-
|
79
|
-
def define
|
80
|
-
in_namespace do
|
81
|
-
file repo_dir do
|
82
|
-
fail "Refusing to clobber existing #{target_dir}" if File.exists?(target_dir)
|
83
|
-
|
84
|
-
url = git("config", "--get", "remote.origin.url").first
|
85
|
-
git("clone", url.chomp, target_dir)
|
86
|
-
end
|
87
|
-
|
88
|
-
InDirCommandTask.define_task(self, :remote_branch => repo_dir) do |t|
|
89
|
-
t.verify_command = git_command | cmd("grep", "-q", branch)
|
90
|
-
t.command = git_command("checkout", "-b", branch) &
|
91
|
-
cmd("rm -rf *") &
|
92
|
-
git_command(%w{commit -a -m} + ["'Creating pages'"]) &
|
93
|
-
git_command("push", "origin", branch) &
|
94
|
-
git_command("branch", "--set-upstream", branch, "origin/" + branch)
|
95
|
-
end
|
96
|
-
|
97
|
-
InDirCommandTask.define_task(self, :local_branch => :remote_branch) do |t|
|
98
|
-
t.verify_command = git_command(%w{branch}) | cmd("grep", "-q", "'#{branch}'")
|
99
|
-
t.command = git_command("checkout", "-b", branch) &
|
100
|
-
git_command("branch", "--set-upstream", branch, "origin/" + branch) &
|
101
|
-
cmd("rm", "-f", '.git/index') &
|
102
|
-
git_command("clean", "-fdx")
|
103
|
-
end
|
104
|
-
|
105
|
-
InDirCommandTask.define_task(self, :on_branch => [:remote_branch, :local_branch]) do |t|
|
106
|
-
t.verify_command = git_command(%w{branch}) | cmd("grep", "-q", "'^[*] #{branch}'")
|
107
|
-
t.command = git_command("checkout", branch)
|
108
|
-
end
|
109
|
-
|
110
|
-
task :pull => [repo_dir, :on_branch] do
|
111
|
-
FileUtils.cd target_dir do
|
112
|
-
git("pull", "-X", "ours")
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
task :cleanup_repo => repo_dir do
|
117
|
-
cmd("rm", "-f", File::join(repo_dir, "hooks", "*")).must_succeed!
|
118
|
-
File::open(File::join(repo_dir, ".gitignore"), "w") do |file|
|
119
|
-
file.write ".sw?"
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
file target_dir => [:on_branch, :cleanup_repo]
|
124
|
-
|
125
|
-
task :pre_publish => [repo_dir, target_dir]
|
126
|
-
|
127
|
-
task :clobber_target => [:on_branch, :pull] do
|
128
|
-
cmd(*%w{rm -rf}) do |cmd|
|
129
|
-
cmd.options << target_dir + "/*"
|
130
|
-
end.must_succeed!
|
131
|
-
end
|
132
|
-
|
133
|
-
task :assemble_docs => [docs_index, :pre_publish, :clobber_target] do
|
134
|
-
cmd(*%w{cp -a}) do |cmd|
|
135
|
-
cmd.options << source_dir + "/*"
|
136
|
-
cmd.options << target_dir
|
137
|
-
end.must_succeed!
|
138
|
-
end
|
139
|
-
|
140
|
-
task :publish => [:assemble_docs, :on_branch] do
|
141
|
-
FileUtils.cd target_dir do
|
142
|
-
git("add", ".")
|
143
|
-
git("commit", "-m", "'Corundum auto-publish'")
|
144
|
-
git("push", "origin", branch)
|
145
|
-
end
|
146
|
-
end
|
147
|
-
end
|
148
|
-
|
149
|
-
desc "Push documentation files to Github Pages"
|
150
|
-
task root_task => self[:publish]
|
151
|
-
end
|
152
|
-
end
|
153
|
-
end
|