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 CHANGED
@@ -1,6 +1,9 @@
1
1
  Gemfile.lock
2
2
  tmp
3
+ vendor/cache
3
4
  devbin
4
5
  bundle
5
6
  Guides
6
7
  *.pmdoc
8
+ *.gem
9
+ *.pkg
data/Gemfile CHANGED
@@ -2,5 +2,7 @@ source "http://rubygems.org"
2
2
 
3
3
  gemspec
4
4
 
5
- gem "rspec", "~> 2.0"
6
- gem "faraday", "~> 0.5.0"
5
+ group :development do
6
+ gem "rspec", "~> 2.0"
7
+ gem "faraday", "~> 0.5.0"
8
+ end
data/Rakefile CHANGED
@@ -1,13 +1,4 @@
1
- desc "Prep the release for PackageMaker"
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
- system "rm -rf bundle"
26
- system "bundle --standalone"
27
- system "cp -R bundle Guides/local/guides/bundle"
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
- guides = File.read("bin/guides").sub(/\A#.*/, "#!/usr/local/ruby1.9test/bin/ruby -I /usr/local/guides/bundle -r bundler/setup")
30
+ file "Guides/local/guides/lib"
30
31
 
31
- system "mkdir -p Guides/bin"
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]
@@ -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
- GUIDES_RE = /\.(?:textile|html\.erb)$/
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)
@@ -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><%= link_to guide["title"], "#{guide["url"]}.html" %></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><%= link_to guide["title"], "#{guide["url"]}.html" %></dd>
13
+ <dd><%= guide_link(guide) %></dd>
14
14
  <% end %>
15
15
  <% end %>
16
16
  </dl>
@@ -3,7 +3,7 @@
3
3
 
4
4
  <dl>
5
5
  <% list.each do |guide| %>
6
- <dt><%= link_to guide["title"], "#{guide["url"]}.html" %></dt>
6
+ <dt><%= guide_link(guide) %></dt>
7
7
  <dd>
8
8
  <% if guide["construction"] %>
9
9
  <img src="images/construction.png" />
@@ -54,6 +54,7 @@
54
54
  <h2><%= Guides.meta["title"] %></h2>
55
55
  <p><%= Guides.meta["description"] %></p>
56
56
  <% end %>
57
+ <%= yield(:index_section) %>
57
58
  </div>
58
59
  </div>
59
60
 
@@ -1,3 +1,3 @@
1
1
  module Guides
2
- VERSION = "0.6.4"
2
+ VERSION = "0.6.5"
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 6
8
- - 4
9
- version: 0.6.4
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-16 00:00:00 -05:00
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
data/RELEASES.yml DELETED
@@ -1,6 +0,0 @@
1
- versions:
2
- "0.6.0":
3
- pkg: "https://github.com/downloads/wycats/guides/Guides-0.6.0.pkg"
4
- "0.6.1":
5
- pkg: "https://github.com/downloads/wycats/guides/Guides-0.6.1.pkg"
6
- patch: "https://github.com/wycats/guides/raw/patches/0.6.1.diff"