Skip to content

Instantly share code, notes, and snippets.

@mipearson
Created December 25, 2011 05:28
Show Gist options
  • Save mipearson/1518765 to your computer and use it in GitHub Desktop.
Save mipearson/1518765 to your computer and use it in GitHub Desktop.
diff --git a/railties/guides/rails_guides/generator.rb b/railties/guides/rails_guides/generator.rb
index 9504b65..f84d8bf 100644
--- a/railties/guides/rails_guides/generator.rb
+++ b/railties/guides/rails_guides/generator.rb
@@ -129,7 +129,16 @@ module RailsGuides
def initialize_dirs(output)
@guides_dir = File.join(File.dirname(__FILE__), '..')
@source_dir = "#@guides_dir/source/#@lang"
- @output_dir = output || "#@guides_dir/output/#@lang"
+ @output_dir = if output
+ output
+ elsif @kindle
+ "#@guides_dir/output/kindle/#@lang"
+ else
+ "#@guides_dir/output/#@lang"
+ end
+
end
def create_output_dir_if_needed
@@ -187,7 +196,7 @@ module RailsGuides
def generate_guide(guide, output_file)
output_path = output_path_for(output_file)
puts "Generating #{guide} as #{output_file}"
- layout = guide.start_with?('kindle/') ? 'kindle/layout' : 'layout'
+ layout = @kindle ? 'kindle/layout' : 'layout'
File.open(output_path, 'w') do |f|
view = ActionView::Base.new(source_dir, :version => @version)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment