starter 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/starter/markdown.rb +15 -0
- data/lib/starter/tasks/github.rb +19 -0
- metadata +2 -2
data/lib/starter/markdown.rb
CHANGED
@@ -80,6 +80,21 @@ module Starter
|
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
83
|
+
def gfm_toc(string)
|
84
|
+
toc = []
|
85
|
+
string.each_line do |line|
|
86
|
+
regex = %r{^(\#{1,8})\s+(.+)$}
|
87
|
+
if match = regex.match(line)
|
88
|
+
_all, hashes, text = match.to_a
|
89
|
+
depth = hashes.size - 1
|
90
|
+
text = text.strip
|
91
|
+
anchor = text.downcase.gsub(/[\s]+/, "-").tr(":`", "")
|
92
|
+
puts anchor.inspect
|
93
|
+
toc << (" " * depth) + "* [#{text}](##{anchor})"
|
94
|
+
end
|
95
|
+
end
|
96
|
+
toc.join("\n") + "\n\n" + string
|
97
|
+
end
|
83
98
|
|
84
99
|
end
|
85
100
|
|
data/lib/starter/tasks/github.rb
CHANGED
@@ -53,6 +53,25 @@ task "github:issues" => "github_repo" do
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
+
desc "show issues for current milestone on GitHub"
|
57
|
+
task "github:milestones:current" => "github_repo" do
|
58
|
+
repo = $STARTER[:github_repo]
|
59
|
+
milestones = repo.milestones
|
60
|
+
sorted = milestones.sort_by {|m| m["due_on"] || "0" }
|
61
|
+
current = sorted.last
|
62
|
+
|
63
|
+
issues = repo.issues(:milestone => current.number).select do |issue|
|
64
|
+
issue["assignee"]
|
65
|
+
end.sort_by do |issue|
|
66
|
+
issue["assignee"]["login"]
|
67
|
+
end
|
68
|
+
|
69
|
+
issues.each do |issue|
|
70
|
+
login = issue["assignee"]["login"]
|
71
|
+
puts "* #{login} - [#{issue.number}](#{issue.html_url}) - #{issue.title}"
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
56
75
|
|
57
76
|
task "github_repo" => %w[ github_settings github_auth ] do
|
58
77
|
require 'ghee'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: starter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-03-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: git
|