1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

download guides for the Kindle and Kindle apps from the home page

This commit is contained in:
Xavier Noria 2011-12-25 04:07:49 -08:00
parent 05b8faa204
commit 46e2db0da6
4 changed files with 21 additions and 6 deletions

View file

@ -341,6 +341,14 @@ h6 {
margin-top: 0.25em;
}
#mainCol dd.kindle, #subCol dd.kindle {
background: #d5e9f6 url(../images/tab_info.gif) no-repeat left top;
border: none;
padding: 1.25em 1em 1.25em 48px;
margin-left: 0;
margin-top: 0.25em;
}
#mainCol div.warning, #subCol dd.warning {
background: #f9d9d8 url(../images/tab_red.gif) no-repeat left top;
border: none;

View file

@ -117,15 +117,18 @@ module RailsGuides
end
def generate_mobi
opf = "#{output_dir}/rails_guides.opf"
mobi = "ruby_on_rails_guides_#@version%s.mobi" % (@lang.present? ? ".#@lang" : '')
out = "#{output_dir}/kindlegen.out"
opf = "#{output_dir}/rails_guides.opf"
out = "#{output_dir}/kindlegen.out"
system "kindlegen #{opf} -o #{mobi} > #{out} 2>&1"
puts "Guides compiled as Kindle book to #{mobi}"
puts "(kindlegen log at #{out})."
end
def mobi
"ruby_on_rails_guides_#@version%s.mobi" % (@lang.present? ? ".#@lang" : '')
end
def initialize_dirs(output)
@guides_dir = File.join(File.dirname(__FILE__), '..')
@source_dir = "#@guides_dir/source/#@lang"
@ -196,7 +199,7 @@ module RailsGuides
layout = kindle? ? 'kindle/layout' : 'layout'
File.open(output_path, 'w') do |f|
view = ActionView::Base.new(source_dir, :version => @version)
view = ActionView::Base.new(source_dir, :version => @version, :mobi => "kindle/#{mobi}")
view.extend(Helpers)
if guide =~ /\.(\w+)\.erb$/

View file

@ -9,6 +9,10 @@ Ruby on Rails Guides
<% content_for :index_section do %>
<div id="subCol">
<dl>
<dd class="kindle">Rails Guides are also available for the <%= link_to 'Kindle', 'https://kindle.amazon.com' %>
and <%= link_to 'Free Kindle Reading Apps', 'www.amazon.com/gp/kindle/kcp' %> for the iPad,
iPhone, Mac, Android, etc. Download them from <%= link_to 'here', @mobi %>.
</dd>
<dd class="work-in-progress">Guides marked with this icon are currently being worked on. While they might still be useful to you, they may contain incomplete information and even errors. You can help by reviewing them and posting your comments and corrections to the author.</dd>
</dl>
</div>
@ -22,5 +26,5 @@ Ruby on Rails Guides
<p><%= document['description'] %></p>
<% end %>
<% end %>
</dl>
</dl>
<% end %>

View file

@ -2,4 +2,4 @@
<h3>Kindle Edition</h3>
The Kindle Edition of the Rails Guides should be considered a 'work in progress'. Track changes and raise issues at <a href="https://github.com/mipearson/rails/tree/guides_for_kindle">https://github.com/mipearson/rails/tree/guides_for_kindle</a>.
The Kindle Edition of the Rails Guides should be considered a work in progress. Feedback is really welcome, please see the "Feedback" section at the end of each guide for instructions.