guides 0.6.4 → 0.6.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/Gemfile +4 -2
- data/Rakefile +37 -15
- data/lib/guides/generator.rb +2 -1
- data/lib/guides/helpers.rb +13 -0
- data/lib/guides/templates/source/_clickable_index.html.erb +2 -2
- data/lib/guides/templates/source/_full_index.html.erb +1 -1
- data/lib/guides/templates/source/layout.html.erb +1 -0
- data/lib/guides/version.rb +1 -1
- metadata +3 -4
- data/RELEASES.yml +0 -6
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -1,13 +1,4 @@
|
|
1
|
-
|
2
|
-
task :pkg do
|
3
|
-
system "rm -rf Guides"
|
4
|
-
system "mkdir -p Guides/local/guides/lib"
|
5
|
-
|
6
|
-
`git ls-files -- lib`.split("\n").each do |file|
|
7
|
-
system "mkdir -p #{File.dirname("Guides/local/guides/#{file}")}"
|
8
|
-
system "cp #{file} Guides/local/guides/#{file}"
|
9
|
-
end
|
10
|
-
|
1
|
+
file "Guides/local/guides/bundle" => "Gemfile" do
|
11
2
|
require "rbconfig"
|
12
3
|
|
13
4
|
unless Config::CONFIG["target_cpu"] == "universal"
|
@@ -22,12 +13,43 @@ task :pkg do
|
|
22
13
|
|
23
14
|
puts "Regenerating the bundle."
|
24
15
|
|
25
|
-
|
26
|
-
|
27
|
-
|
16
|
+
sh "rm -rf bundle"
|
17
|
+
sh "bundle --standalone --local --without development"
|
18
|
+
sh "mkdir -p Guides/local/guides"
|
19
|
+
sh "cp -R bundle Guides/local/guides/"
|
20
|
+
|
21
|
+
verbose(false) do
|
22
|
+
Dir.chdir("Guides/local/guides/bundle/ruby/1.9.1") do
|
23
|
+
Dir["{bin,cache,doc,specifications}"].each { |f| rm_rf f }
|
24
|
+
Dir["**/{ext,docs,test,spec}"].each { |f| rm_rf(f) if File.directory?(f) }
|
25
|
+
Dir["**/erubis-*/doc-api"].each {|f| rm_rf(f) }
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
28
29
|
|
29
|
-
|
30
|
+
file "Guides/local/guides/lib"
|
30
31
|
|
31
|
-
|
32
|
+
`git ls-files -- lib`.split("\n").each do |file|
|
33
|
+
dest = "Guides/local/guides/#{file}"
|
34
|
+
file dest => file do
|
35
|
+
verbose(false) { mkdir_p File.dirname(dest) }
|
36
|
+
cp_r file, dest
|
37
|
+
end
|
38
|
+
task "Guides/local/guides/lib" => dest
|
39
|
+
end
|
40
|
+
|
41
|
+
file "Guides/bin/guides" => "bin/guides" do
|
42
|
+
guides = File.read("bin/guides").sub(/\A#.*/, "#!/usr/local/ruby1.9/bin/ruby -I /usr/local/guides/bundle -r bundler/setup")
|
43
|
+
|
44
|
+
sh "mkdir -p Guides/bin"
|
32
45
|
File.open("Guides/bin/guides", "w") { |file| file.puts guides }
|
33
46
|
end
|
47
|
+
|
48
|
+
desc "Prep the release for PackageMaker"
|
49
|
+
task :pkg => ["Guides/local/guides/bundle", "Guides/local/guides/lib", "Guides/bin/guides"]
|
50
|
+
|
51
|
+
task :rm do
|
52
|
+
rm_rf "Guides"
|
53
|
+
end
|
54
|
+
|
55
|
+
task :clean => [:rm, :pkg]
|
data/lib/guides/generator.rb
CHANGED
@@ -61,7 +61,8 @@ module Guides
|
|
61
61
|
class Generator
|
62
62
|
attr_reader :guides_dir, :source_dir, :output_dir, :edge, :warnings, :all
|
63
63
|
|
64
|
-
|
64
|
+
EXTENSIONS = %w(textile html.erb)
|
65
|
+
GUIDES_RE = /\.(?:#{EXTENSIONS.map{|e| Regexp.escape(e)}.join('|')})$/
|
65
66
|
LOCAL_ASSETS = File.expand_path("../templates/assets", __FILE__)
|
66
67
|
|
67
68
|
def initialize(options)
|
data/lib/guides/helpers.rb
CHANGED
@@ -47,6 +47,19 @@ module Guides
|
|
47
47
|
c = capture(&block)
|
48
48
|
content_tag(:code, c)
|
49
49
|
end
|
50
|
+
|
51
|
+
def guide_link(guide)
|
52
|
+
# Might be able to use build in view_paths methods but I couldn't figure them out - PW
|
53
|
+
exists = view_paths.any? do |p|
|
54
|
+
Guides::Generator::EXTENSIONS.any?{|e| File.exist? "#{p}/#{guide["url"]}.#{e}" }
|
55
|
+
end
|
56
|
+
|
57
|
+
if exists
|
58
|
+
link_to guide["title"], "#{guide["url"]}.html"
|
59
|
+
else
|
60
|
+
guide["title"]
|
61
|
+
end
|
62
|
+
end
|
50
63
|
end
|
51
64
|
end
|
52
65
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<% lgroup.each do |group, guides| %>
|
3
3
|
<dt><%= group %></dt>
|
4
4
|
<% guides.each do |guide| %>
|
5
|
-
<dd><%=
|
5
|
+
<dd><%= guide_link(guide) %></dd>
|
6
6
|
<% end %>
|
7
7
|
<% end %>
|
8
8
|
</dl>
|
@@ -10,7 +10,7 @@
|
|
10
10
|
<% rgroup.each do |group, guides| %>
|
11
11
|
<dt><%= group %></dt>
|
12
12
|
<% guides.each do |guide| %>
|
13
|
-
<dd><%=
|
13
|
+
<dd><%= guide_link(guide) %></dd>
|
14
14
|
<% end %>
|
15
15
|
<% end %>
|
16
16
|
</dl>
|
data/lib/guides/version.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 6
|
8
|
-
-
|
9
|
-
version: 0.6.
|
8
|
+
- 5
|
9
|
+
version: 0.6.5
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Yehuda Katz
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-01-
|
17
|
+
date: 2011-01-20 00:00:00 -08:00
|
18
18
|
default_executable: guides
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -119,7 +119,6 @@ extra_rdoc_files: []
|
|
119
119
|
files:
|
120
120
|
- .gitignore
|
121
121
|
- Gemfile
|
122
|
-
- RELEASES.yml
|
123
122
|
- Rakefile
|
124
123
|
- bin/guides
|
125
124
|
- guides.gemspec
|