guides 0.6.10 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +0 -6
- data/guides.gemspec +12 -1
- data/lib/guides.rb +4 -0
- data/lib/guides/cli.rb +1 -0
- data/lib/guides/helpers.rb +14 -4
- data/lib/guides/indexer.rb +18 -9
- data/lib/guides/version.rb +1 -1
- metadata +99 -71
data/Gemfile
CHANGED
data/guides.gemspec
CHANGED
@@ -4,6 +4,9 @@ $:.unshift lib unless $:.include?(lib)
|
|
4
4
|
|
5
5
|
require 'guides/version'
|
6
6
|
|
7
|
+
os = Gem::Platform.local.os
|
8
|
+
is_mingw = (os == "mingw32")
|
9
|
+
|
7
10
|
Gem::Specification.new do |s|
|
8
11
|
s.name = "guides"
|
9
12
|
s.version = Guides::VERSION
|
@@ -20,11 +23,19 @@ Gem::Specification.new do |s|
|
|
20
23
|
s.add_dependency "actionpack", "~> 3.0.0"
|
21
24
|
s.add_dependency "activesupport", "~> 3.0.0"
|
22
25
|
s.add_dependency "rack", "~> 1.2.1"
|
23
|
-
s.add_dependency "RedCloth", "~> 4.
|
26
|
+
s.add_dependency "RedCloth", "~> 4.2.7"
|
24
27
|
s.add_dependency "maruku", "~> 0.6.0"
|
25
28
|
s.add_dependency "thor", "~> 0.14.6"
|
26
29
|
s.add_dependency "thin", "~> 1.2.7"
|
27
30
|
|
31
|
+
if is_mingw
|
32
|
+
s.add_dependency 'eventmachine', '~> 1.0.0.beta'
|
33
|
+
end
|
34
|
+
|
35
|
+
s.add_development_dependency 'rspec', '~> 2.0'
|
36
|
+
s.add_development_dependency "faraday", "~> 0.5.0"
|
37
|
+
s.add_development_dependency 'packager'
|
38
|
+
|
28
39
|
s.files = `git ls-files`.split("\n")
|
29
40
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
30
41
|
s.executables = %w(guides)
|
data/lib/guides.rb
CHANGED
data/lib/guides/cli.rb
CHANGED
@@ -21,6 +21,7 @@ module Guides
|
|
21
21
|
desc "build", "build the guides output"
|
22
22
|
method_option "only", :type => :array
|
23
23
|
method_option "clean", :type => :boolean
|
24
|
+
method_option "edge", :type => :boolean, :default => false
|
24
25
|
method_option "production", :type => :boolean, :default => true, :banner => "use production mode", :aliases => "-p"
|
25
26
|
def build
|
26
27
|
if options[:clean]
|
data/lib/guides/helpers.rb
CHANGED
@@ -58,18 +58,28 @@ module Guides
|
|
58
58
|
content_tag(:code, c)
|
59
59
|
end
|
60
60
|
|
61
|
-
def
|
61
|
+
def guide_exists?(guide)
|
62
62
|
# Might be able to use build in view_paths methods but I couldn't figure them out - PW
|
63
|
-
|
63
|
+
view_paths.any? do |p|
|
64
64
|
Guides::Generator::EXTENSIONS.any?{|e| File.exist? "#{p}/#{guide["url"]}.#{e}" }
|
65
65
|
end
|
66
|
+
end
|
66
67
|
|
67
|
-
|
68
|
+
def guide_link(guide)
|
69
|
+
if guide_exists?(guide)
|
68
70
|
link_to guide["title"], "#{guide["url"]}.html"
|
69
71
|
else
|
70
72
|
guide["title"]
|
71
73
|
end
|
72
74
|
end
|
75
|
+
|
76
|
+
def guide_chapter_link(guide, chapter)
|
77
|
+
if guide_exists?(guide)
|
78
|
+
anchor = chapter.gsub(/\s/, '-').downcase
|
79
|
+
link_to(chapter, "#{guide["url"]}.html##{anchor}")
|
80
|
+
else
|
81
|
+
chapter
|
82
|
+
end
|
83
|
+
end
|
73
84
|
end
|
74
85
|
end
|
75
|
-
|
data/lib/guides/indexer.rb
CHANGED
@@ -30,20 +30,29 @@ module Guides
|
|
30
30
|
level_hash = ActiveSupport::OrderedHash.new
|
31
31
|
|
32
32
|
while s.scan_until(%r{^h(\d)(?:\((#.*?)\))?\s*\.\s*(.*)$})
|
33
|
-
level,
|
33
|
+
level, element_id, title = s[1].to_i, s[2], s[3].strip
|
34
34
|
|
35
35
|
if level < current_level
|
36
36
|
# This is needed. Go figure.
|
37
37
|
return level_hash
|
38
38
|
elsif level == current_level
|
39
|
-
index = counters.
|
40
|
-
|
39
|
+
index = counters.dup
|
40
|
+
if format = Guides.config['index_format']
|
41
|
+
index[0] = sprintf(format, index[0])
|
42
|
+
end
|
43
|
+
index = index.join('.')
|
41
44
|
|
42
|
-
|
45
|
+
element_id ||= '#' + title_to_element_id(title)
|
46
|
+
|
47
|
+
header_html = Guides.config['index_header'] || "{{index}} {{title}}"
|
48
|
+
values = { 'index' => index, 'title' => title }
|
49
|
+
header = header_html.gsub(/{{(.*?)}}/){ values[$1].to_str }
|
50
|
+
|
51
|
+
raise "Parsing Fail" unless @result.sub!(s.matched, "h#{level}(#{element_id}). #{header}")
|
43
52
|
|
44
53
|
key = {
|
45
54
|
:title => title,
|
46
|
-
:id =>
|
55
|
+
:id => element_id
|
47
56
|
}
|
48
57
|
# Recurse
|
49
58
|
counters << 1
|
@@ -58,12 +67,12 @@ module Guides
|
|
58
67
|
level_hash
|
59
68
|
end
|
60
69
|
|
61
|
-
def
|
62
|
-
|
63
|
-
if warnings &&
|
70
|
+
def title_to_element_id(title)
|
71
|
+
element_id = title.strip.parameterize.sub(/^\d+/, '')
|
72
|
+
if warnings && element_id.blank?
|
64
73
|
puts "BLANK ID: please put an explicit ID for section #{title}, as in h5(#my-id)"
|
65
74
|
end
|
66
|
-
|
75
|
+
element_id
|
67
76
|
end
|
68
77
|
end
|
69
78
|
end
|
data/lib/guides/version.rb
CHANGED
metadata
CHANGED
@@ -1,104 +1,135 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: guides
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.7.0
|
4
5
|
prerelease:
|
5
|
-
version: 0.6.10
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Yehuda Katz
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-09-28 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
16
15
|
name: actionpack
|
17
|
-
|
18
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &70106296837060 !ruby/object:Gem::Requirement
|
19
17
|
none: false
|
20
|
-
requirements:
|
18
|
+
requirements:
|
21
19
|
- - ~>
|
22
|
-
- !ruby/object:Gem::Version
|
20
|
+
- !ruby/object:Gem::Version
|
23
21
|
version: 3.0.0
|
24
22
|
type: :runtime
|
25
|
-
version_requirements: *id001
|
26
|
-
- !ruby/object:Gem::Dependency
|
27
|
-
name: activesupport
|
28
23
|
prerelease: false
|
29
|
-
|
24
|
+
version_requirements: *70106296837060
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: activesupport
|
27
|
+
requirement: &70106296836600 !ruby/object:Gem::Requirement
|
30
28
|
none: false
|
31
|
-
requirements:
|
29
|
+
requirements:
|
32
30
|
- - ~>
|
33
|
-
- !ruby/object:Gem::Version
|
31
|
+
- !ruby/object:Gem::Version
|
34
32
|
version: 3.0.0
|
35
33
|
type: :runtime
|
36
|
-
version_requirements: *id002
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
|
-
name: rack
|
39
34
|
prerelease: false
|
40
|
-
|
35
|
+
version_requirements: *70106296836600
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rack
|
38
|
+
requirement: &70106296836140 !ruby/object:Gem::Requirement
|
41
39
|
none: false
|
42
|
-
requirements:
|
40
|
+
requirements:
|
43
41
|
- - ~>
|
44
|
-
- !ruby/object:Gem::Version
|
42
|
+
- !ruby/object:Gem::Version
|
45
43
|
version: 1.2.1
|
46
44
|
type: :runtime
|
47
|
-
version_requirements: *id003
|
48
|
-
- !ruby/object:Gem::Dependency
|
49
|
-
name: RedCloth
|
50
45
|
prerelease: false
|
51
|
-
|
46
|
+
version_requirements: *70106296836140
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: RedCloth
|
49
|
+
requirement: &70106296835680 !ruby/object:Gem::Requirement
|
52
50
|
none: false
|
53
|
-
requirements:
|
51
|
+
requirements:
|
54
52
|
- - ~>
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
version: 4.
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 4.2.7
|
57
55
|
type: :runtime
|
58
|
-
version_requirements: *id004
|
59
|
-
- !ruby/object:Gem::Dependency
|
60
|
-
name: maruku
|
61
56
|
prerelease: false
|
62
|
-
|
57
|
+
version_requirements: *70106296835680
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: maruku
|
60
|
+
requirement: &70106296835220 !ruby/object:Gem::Requirement
|
63
61
|
none: false
|
64
|
-
requirements:
|
62
|
+
requirements:
|
65
63
|
- - ~>
|
66
|
-
- !ruby/object:Gem::Version
|
64
|
+
- !ruby/object:Gem::Version
|
67
65
|
version: 0.6.0
|
68
66
|
type: :runtime
|
69
|
-
version_requirements: *id005
|
70
|
-
- !ruby/object:Gem::Dependency
|
71
|
-
name: thor
|
72
67
|
prerelease: false
|
73
|
-
|
68
|
+
version_requirements: *70106296835220
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: thor
|
71
|
+
requirement: &70106296834760 !ruby/object:Gem::Requirement
|
74
72
|
none: false
|
75
|
-
requirements:
|
73
|
+
requirements:
|
76
74
|
- - ~>
|
77
|
-
- !ruby/object:Gem::Version
|
75
|
+
- !ruby/object:Gem::Version
|
78
76
|
version: 0.14.6
|
79
77
|
type: :runtime
|
80
|
-
version_requirements: *id006
|
81
|
-
- !ruby/object:Gem::Dependency
|
82
|
-
name: thin
|
83
78
|
prerelease: false
|
84
|
-
|
79
|
+
version_requirements: *70106296834760
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: thin
|
82
|
+
requirement: &70106296834300 !ruby/object:Gem::Requirement
|
85
83
|
none: false
|
86
|
-
requirements:
|
84
|
+
requirements:
|
87
85
|
- - ~>
|
88
|
-
- !ruby/object:Gem::Version
|
86
|
+
- !ruby/object:Gem::Version
|
89
87
|
version: 1.2.7
|
90
88
|
type: :runtime
|
91
|
-
|
92
|
-
|
93
|
-
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: *70106296834300
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: rspec
|
93
|
+
requirement: &70106296833840 !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ~>
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '2.0'
|
99
|
+
type: :development
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: *70106296833840
|
102
|
+
- !ruby/object:Gem::Dependency
|
103
|
+
name: faraday
|
104
|
+
requirement: &70106296833380 !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ~>
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 0.5.0
|
110
|
+
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: *70106296833380
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
name: packager
|
115
|
+
requirement: &70106296833000 !ruby/object:Gem::Requirement
|
116
|
+
none: false
|
117
|
+
requirements:
|
118
|
+
- - ! '>='
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
type: :development
|
122
|
+
prerelease: false
|
123
|
+
version_requirements: *70106296833000
|
124
|
+
description: A tool for creating version controlled guides for open source projects,
|
125
|
+
based on the Rails Guides framework
|
126
|
+
email:
|
94
127
|
- wycats@gmail.com
|
95
|
-
executables:
|
128
|
+
executables:
|
96
129
|
- guides
|
97
130
|
extensions: []
|
98
|
-
|
99
131
|
extra_rdoc_files: []
|
100
|
-
|
101
|
-
files:
|
132
|
+
files:
|
102
133
|
- .gitignore
|
103
134
|
- Gemfile
|
104
135
|
- Rakefile
|
@@ -233,32 +264,29 @@ files:
|
|
233
264
|
- spec/textile_transformer_spec.rb
|
234
265
|
homepage: http://yehudakatz.com
|
235
266
|
licenses: []
|
236
|
-
|
237
267
|
post_install_message:
|
238
268
|
rdoc_options: []
|
239
|
-
|
240
|
-
require_paths:
|
269
|
+
require_paths:
|
241
270
|
- lib
|
242
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
271
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
243
272
|
none: false
|
244
|
-
requirements:
|
245
|
-
- -
|
246
|
-
- !ruby/object:Gem::Version
|
247
|
-
version:
|
248
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
273
|
+
requirements:
|
274
|
+
- - ! '>='
|
275
|
+
- !ruby/object:Gem::Version
|
276
|
+
version: '0'
|
277
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
249
278
|
none: false
|
250
|
-
requirements:
|
251
|
-
- -
|
252
|
-
- !ruby/object:Gem::Version
|
279
|
+
requirements:
|
280
|
+
- - ! '>='
|
281
|
+
- !ruby/object:Gem::Version
|
253
282
|
version: 1.3.6
|
254
283
|
requirements: []
|
255
|
-
|
256
284
|
rubyforge_project: guides
|
257
|
-
rubygems_version: 1.
|
285
|
+
rubygems_version: 1.8.10
|
258
286
|
signing_key:
|
259
287
|
specification_version: 3
|
260
288
|
summary: Extracting the Rails Guides framework for the rest of us
|
261
|
-
test_files:
|
289
|
+
test_files:
|
262
290
|
- spec/build_spec.rb
|
263
291
|
- spec/fixtures/guides.yml
|
264
292
|
- spec/fixtures/source/article_four.textile
|