corundum 0.0.6 → 0.0.7
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/README.md +56 -0
- data/doc/Specifications +1 -1
- data/doc/coverage/index.html +2451 -1997
- data/lib/corundum.rb +20 -29
- data/lib/corundum/browser-task.rb +21 -0
- data/lib/corundum/email.rb +11 -9
- data/lib/corundum/gem_building.rb +6 -3
- data/lib/corundum/gemcutter.rb +14 -10
- data/lib/corundum/gemspec_sanity.rb +11 -5
- data/lib/corundum/github-pages.rb +147 -0
- data/lib/corundum/rspec.rb +68 -82
- data/lib/corundum/rubyforge.rb +4 -10
- data/lib/corundum/simplecov.rb +41 -29
- data/lib/corundum/tasklib.rb +3 -53
- data/lib/corundum/tasklibs.rb +2 -0
- data/lib/corundum/version_control.rb +7 -7
- data/lib/corundum/version_control/git.rb +23 -29
- data/lib/corundum/version_control/monotone.rb +7 -15
- data/lib/corundum/yardoc.rb +36 -15
- data/spec/smoking_spec.rb +0 -2
- data/spec_help/file-sandbox.rb +10 -10
- metadata +39 -26
- data/doc/README +0 -2
- data/lib/corundum/configurable.rb +0 -54
- data/spec/bogus_spec.rb +0 -3
data/lib/corundum/rubyforge.rb
CHANGED
@@ -1,21 +1,15 @@
|
|
1
1
|
require 'corundum/tasklib'
|
2
2
|
|
3
|
-
|
4
3
|
#Big XXX: this totally isn't done. It's some notes against ever wanting to
|
5
4
|
#publish announcements to rubyforge ever again
|
6
5
|
|
7
6
|
module Corundum
|
8
7
|
class Publishing < TaskLib
|
9
|
-
|
10
|
-
:rubyforge
|
11
|
-
end
|
8
|
+
default_namespace :rubyforge
|
12
9
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
setting(:package_dir, nil)
|
17
|
-
setting(:gemspec, nil)
|
18
|
-
end
|
10
|
+
setting(:rubyforge, nested(:package_id => nil, :group_id => nil, :release_name => nil))
|
11
|
+
setting(:package_dir, nil)
|
12
|
+
setting(:gemspec, nil)
|
19
13
|
|
20
14
|
def define
|
21
15
|
desc "Publish the gem and its documentation to Rubyforge and Gemcutter"
|
data/lib/corundum/simplecov.rb
CHANGED
@@ -1,33 +1,45 @@
|
|
1
1
|
require 'corundum/tasklib'
|
2
|
+
require 'corundum/browser-task'
|
2
3
|
|
3
4
|
module Corundum
|
4
|
-
class
|
5
|
-
def
|
6
|
-
|
5
|
+
class RSpecReportTask < RSpecTask
|
6
|
+
def command_task
|
7
|
+
@command_task ||= file task_name do
|
8
|
+
decorated(command).must_succeed!
|
9
|
+
end
|
7
10
|
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class SimpleCov < TaskLib
|
14
|
+
default_namespace :coverage
|
15
|
+
|
16
|
+
setting(:test_lib)
|
17
|
+
setting(:browser)
|
18
|
+
setting(:code_files)
|
19
|
+
setting(:all_files)
|
20
|
+
|
21
|
+
setting(:report_path, nil)
|
22
|
+
setting(:config_path, nil)
|
23
|
+
|
24
|
+
setting(:report_dir, "doc/coverage")
|
25
|
+
setting(:config_file, ".simplecov")
|
26
|
+
setting(:filters, ["./spec"])
|
27
|
+
setting(:threshold, 80)
|
28
|
+
setting(:groups, {})
|
29
|
+
setting(:coverage_filter, proc do |path|
|
30
|
+
/\.rb$/ =~ path
|
31
|
+
end)
|
8
32
|
|
9
33
|
def default_configuration(toolkit, testlib)
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
setting(:config_file, ".simplecov")
|
15
|
-
setting(:config_path, nil)
|
16
|
-
setting(:filters, ["./spec"])
|
17
|
-
|
18
|
-
setting(:coverage_filter, proc do |path|
|
19
|
-
/\.rb$/ =~ path
|
20
|
-
end)
|
21
|
-
|
22
|
-
setting(:threshold, 80)
|
23
|
-
setting(:groups, {})
|
24
|
-
setting(:code_files, toolkit.files.code)
|
25
|
-
setting(:all_files, toolkit.file_lists.project + toolkit.file_lists.code + toolkit.file_lists.test)
|
34
|
+
self.test_lib = testlib
|
35
|
+
self.browser = toolkit.browser
|
36
|
+
self.code_files = toolkit.files.code
|
37
|
+
self.all_files = toolkit.file_lists.project + toolkit.file_lists.code + toolkit.file_lists.test
|
26
38
|
end
|
27
39
|
|
28
40
|
def resolve_configuration
|
29
|
-
|
30
|
-
|
41
|
+
self.config_path ||= File::expand_path(config_file, Rake::original_dir)
|
42
|
+
self.report_path ||= File::join(report_dir, "index.html")
|
31
43
|
end
|
32
44
|
|
33
45
|
def filter_lines
|
@@ -59,27 +71,27 @@ module Corundum
|
|
59
71
|
|
60
72
|
task :example_config do
|
61
73
|
$stderr.puts "Try this in #{config_path}"
|
74
|
+
$stderr.puts "(You can just do #$0 > #{config_path})"
|
62
75
|
$stderr.puts
|
63
76
|
puts config_file_contents
|
64
77
|
end
|
65
78
|
|
66
79
|
task :config_exists do
|
67
|
-
File::exists?(File::join(Rake::original_dir, ".simplecov")) or fail "No .simplecov"
|
80
|
+
File::exists?(File::join(Rake::original_dir, ".simplecov")) or fail "No .simplecov (try: rake #{self[:example_config]})"
|
68
81
|
end
|
69
82
|
|
70
83
|
directory File::dirname(report_path)
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
end
|
75
|
-
sh @test_lib.full_command(options)
|
84
|
+
RSpecReportTask.new(@test_lib) do |t|
|
85
|
+
t.task_name = report_path
|
86
|
+
t.rspec_opts += %w{-r simplecov}
|
76
87
|
end
|
88
|
+
file report_path => all_files
|
77
89
|
|
78
90
|
task :generate_report => [:preflight, report_path]
|
79
91
|
|
80
92
|
desc "View coverage in browser"
|
81
|
-
|
82
|
-
|
93
|
+
BrowserTask.new(self) do |t|
|
94
|
+
t.index_html = report_path
|
83
95
|
end
|
84
96
|
|
85
97
|
task :verify_coverage => :generate_report do
|
data/lib/corundum/tasklib.rb
CHANGED
@@ -1,57 +1,7 @@
|
|
1
|
-
require '
|
2
|
-
require 'rake/tasklib'
|
3
|
-
require 'corundum/configurable'
|
1
|
+
require 'mattock/tasklib'
|
4
2
|
|
5
3
|
module Corundum
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
def default_configuration(*tasklibs)
|
10
|
-
end
|
11
|
-
|
12
|
-
def resolve_configuration
|
13
|
-
end
|
14
|
-
|
15
|
-
def in_namespace(*tasknames)
|
16
|
-
if tasknames.empty?
|
17
|
-
if block_given?
|
18
|
-
if @namespace_name.nil?
|
19
|
-
yield
|
20
|
-
else
|
21
|
-
namespace @namespace_name do
|
22
|
-
yield
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
else
|
27
|
-
tasknames.map do |taskname|
|
28
|
-
[@namespace_name, taskname].compact.join(":")
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def root_task
|
34
|
-
@namespace_name || :default
|
35
|
-
end
|
36
|
-
|
37
|
-
def default_namespace
|
38
|
-
nil
|
39
|
-
end
|
40
|
-
|
41
|
-
def [](taskname)
|
42
|
-
in_namespace(taskname).first
|
43
|
-
end
|
44
|
-
|
45
|
-
def initialize(*tasklibs)
|
46
|
-
setting(:namespace_name, default_namespace)
|
47
|
-
|
48
|
-
default_configuration(*tasklibs)
|
49
|
-
|
50
|
-
yield self if block_given?
|
51
|
-
|
52
|
-
resolve_configuration
|
53
|
-
|
54
|
-
define
|
55
|
-
end
|
4
|
+
#TODO Add functionality or refactor away
|
5
|
+
class TaskLib < Mattock::TaskLib
|
56
6
|
end
|
57
7
|
end
|
data/lib/corundum/tasklibs.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'corundum'
|
1
2
|
require 'corundum/rspec'
|
2
3
|
require 'corundum/simplecov'
|
3
4
|
require 'corundum/gemspec_sanity'
|
@@ -7,3 +8,4 @@ require 'corundum/email'
|
|
7
8
|
require 'corundum/version_control/monotone'
|
8
9
|
require 'corundum/version_control/git'
|
9
10
|
require 'corundum/yardoc'
|
11
|
+
require 'corundum/github-pages'
|
@@ -2,15 +2,15 @@ require 'corundum/tasklib'
|
|
2
2
|
|
3
3
|
module Corundum
|
4
4
|
class VersionControl < TaskLib
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
default_namespace :version_control
|
6
|
+
|
7
|
+
required_fields(:gemspec, :build_finished_file, :gemspec_files, :tag)
|
8
8
|
|
9
9
|
def default_configuration(toolkit)
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
self.gemspec = toolkit.gemspec
|
11
|
+
self.build_finished_file = toolkit.finished_files.build
|
12
|
+
self.gemspec_files = toolkit.files.code + toolkit.files.test
|
13
|
+
self.tag = toolkit.gemspec.version.to_s
|
14
14
|
end
|
15
15
|
|
16
16
|
def define
|
@@ -2,35 +2,29 @@ require 'corundum/version_control'
|
|
2
2
|
|
3
3
|
module Corundum
|
4
4
|
class Git < VersionControl
|
5
|
-
|
6
|
-
super
|
7
|
-
setting(:branch, nil)
|
8
|
-
end
|
5
|
+
setting(:branch, nil)
|
9
6
|
|
10
7
|
def resolve_configuration
|
11
8
|
@branch ||= guess_branch
|
12
9
|
end
|
13
10
|
|
14
|
-
|
15
11
|
def git_command(*args)
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
pipe = IO.popen(command)
|
21
|
-
pid = pipe.pid
|
22
|
-
Process::wait(pid)
|
23
|
-
result = pipe.read
|
24
|
-
pipe.close
|
25
|
-
unless $?.exitstatus == 0
|
26
|
-
fail "Git exited with status #{$?.exitstatus}: \n#{result}"
|
12
|
+
Mattock::CommandLine.new("git", "--no-pager") do |cmd|
|
13
|
+
args.each do |arg|
|
14
|
+
cmd.options += [*arg]
|
15
|
+
end
|
27
16
|
end
|
28
|
-
|
17
|
+
end
|
18
|
+
|
19
|
+
def git(*args)
|
20
|
+
result = git_command(*args).run
|
21
|
+
result.must_succeed!
|
22
|
+
return result.stdout.lines.to_a
|
29
23
|
end
|
30
24
|
|
31
25
|
def guess_branch
|
32
26
|
puts "Guessing branch - configure Git > branch"
|
33
|
-
branch =
|
27
|
+
branch = git("branch").grep(/^\*/).first.sub(/\*\s*/,"").chomp
|
34
28
|
puts " Guessed: #{branch}"
|
35
29
|
return branch
|
36
30
|
end
|
@@ -40,28 +34,28 @@ module Corundum
|
|
40
34
|
|
41
35
|
in_namespace do
|
42
36
|
task :on_branch do
|
43
|
-
current_branch =
|
37
|
+
current_branch = git("branch").grep(/^\*/).first.sub(/\*\s*/,"").chomp
|
44
38
|
unless current_branch == branch
|
45
39
|
fail "Current branch \"#{current_branch}\" is not #{branch}"
|
46
40
|
end
|
47
41
|
end
|
48
42
|
|
49
43
|
task :not_tagged => :on_branch do
|
50
|
-
tags =
|
44
|
+
tags = git("tag", "-l", tag)
|
51
45
|
unless tags.empty?
|
52
46
|
fail "Tag #{tag} already exists in branch #{branch}"
|
53
47
|
end
|
54
48
|
end
|
55
49
|
|
56
50
|
task :workspace_committed => :on_branch do
|
57
|
-
diffs =
|
51
|
+
diffs = git("diff", "--stat", "HEAD")
|
58
52
|
unless diffs.empty?
|
59
53
|
fail "Workspace not committed:\n #{diffs.join(" \n")}"
|
60
54
|
end
|
61
55
|
end
|
62
56
|
|
63
57
|
task :gemspec_files_added => :on_branch do
|
64
|
-
list =
|
58
|
+
list = git(%w{ls-tree -r HEAD})
|
65
59
|
list.map! do |line|
|
66
60
|
line.split(/\s+/)[3]
|
67
61
|
end
|
@@ -73,29 +67,29 @@ module Corundum
|
|
73
67
|
end
|
74
68
|
|
75
69
|
task :is_pulled do
|
76
|
-
fetch =
|
70
|
+
fetch = git("fetch", "--dry-run")
|
77
71
|
unless fetch.empty?
|
78
72
|
fail "Remote branch has unpulled changes"
|
79
73
|
end
|
80
74
|
|
81
|
-
remote =
|
82
|
-
merge =
|
75
|
+
remote = git("config", "--get", "branch.#{branch}.remote").first.chomp
|
76
|
+
merge = git("config", "--get", "branch.#{branch}.merge").first.split("/").last.chomp
|
83
77
|
|
84
|
-
ancestor =
|
78
|
+
ancestor = git("merge-base", branch, "#{remote}/#{merge}").first.chomp
|
85
79
|
remote_rev = File::read(".git/refs/remotes/#{remote}/#{merge}").chomp
|
86
80
|
|
87
81
|
unless ancestor == remote_rev
|
88
|
-
fail "Unmerged changes with remote branch #{remote}/#{merge}"
|
82
|
+
fail "Unmerged changes with remote branch #{remote}/#{merge}\n#{ancestor.inspect}\n#{remote_rev.inspect}"
|
89
83
|
end
|
90
84
|
end
|
91
85
|
task :is_checked_in => :is_pulled
|
92
86
|
|
93
87
|
task :tag => :on_branch do
|
94
|
-
|
88
|
+
git("tag", tag)
|
95
89
|
end
|
96
90
|
|
97
91
|
task :push => :on_branch do
|
98
|
-
|
92
|
+
git("push")
|
99
93
|
end
|
100
94
|
|
101
95
|
task :check_in => [:push]
|
@@ -3,27 +3,19 @@ require 'strscan'
|
|
3
3
|
|
4
4
|
module Corundum
|
5
5
|
class Monotone < VersionControl
|
6
|
-
|
7
|
-
|
8
|
-
setting(:branch, nil)
|
9
|
-
end
|
6
|
+
|
7
|
+
setting(:branch, nil)
|
10
8
|
|
11
9
|
def resolve_configuration
|
12
10
|
@branch ||= guess_branch
|
13
11
|
end
|
14
12
|
|
15
13
|
def mtn_automate(cmd, *args)
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
result = pipe.read
|
22
|
-
pipe.close
|
23
|
-
unless $?.exitstatus == 0
|
24
|
-
fail "Monotone failed with exit status #{$?.exitstatus}: \n#{result}"
|
25
|
-
end
|
26
|
-
return result
|
14
|
+
result = Mattock::CommandLine.new("mtn", "automate", cmd) do |cmd|
|
15
|
+
cmd.options += args
|
16
|
+
end.run
|
17
|
+
result.must_succeed!
|
18
|
+
result.stdout
|
27
19
|
end
|
28
20
|
|
29
21
|
def parse_basic_io(string)
|
data/lib/corundum/yardoc.rb
CHANGED
@@ -1,33 +1,54 @@
|
|
1
1
|
require 'corundum/tasklib'
|
2
|
-
require 'yard
|
2
|
+
require 'yard'
|
3
3
|
|
4
4
|
module Corundum
|
5
5
|
class YARDoc < TaskLib
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
default_namespace :documentation
|
7
|
+
|
8
|
+
setting :gemspec
|
9
|
+
setting :options, nil
|
10
|
+
setting :browser
|
11
|
+
setting :yardoc_index, nil
|
12
|
+
|
13
|
+
setting(:target_dir, "yardoc")
|
14
|
+
setting(:readme, nil)
|
15
|
+
setting(:files, nested(:code => [], :docs => []))
|
16
|
+
setting(:extra_files, [])
|
9
17
|
|
10
18
|
def default_configuration(toolkit)
|
11
|
-
|
12
|
-
|
13
|
-
|
19
|
+
self.gemspec = toolkit.gemspec
|
20
|
+
toolkit.files.copy_settings_to(self.files)
|
21
|
+
self.browser = toolkit.browser
|
22
|
+
end
|
23
|
+
|
24
|
+
def resolve_configuration
|
25
|
+
self.options ||= gemspec.rdoc_options
|
26
|
+
self.options += [ "--output-dir", target_dir]
|
27
|
+
self.options += [ "--readme", readme ] if readme
|
28
|
+
self.options += files.code
|
29
|
+
unless files.docs.empty? and extra_files.empty?
|
30
|
+
self.options += [ "-" ] + files.docs + extra_files
|
31
|
+
end
|
32
|
+
self.yardoc_index ||= File::join(target_dir, "index.html")
|
14
33
|
end
|
15
34
|
|
16
35
|
def define
|
17
|
-
directory
|
36
|
+
directory target_dir
|
18
37
|
|
19
38
|
in_namespace do
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
39
|
+
file yardoc_index =>
|
40
|
+
FileList["README*"] + files.code + files.docs + extra_files do
|
41
|
+
YARD::CLI::Yardoc.run( *(options) )
|
42
|
+
end
|
43
|
+
|
44
|
+
desc "Open up a browser to view your documentation"
|
45
|
+
BrowserTask.new(self) do |t|
|
46
|
+
t.index_html = yardoc_index
|
26
47
|
end
|
27
48
|
end
|
28
49
|
|
29
50
|
desc "Generate documentation based on code using YARD"
|
30
|
-
task root_task =>
|
51
|
+
task root_task => yardoc_index
|
31
52
|
end
|
32
53
|
end
|
33
54
|
end
|