diff options
author | Gannon McGibbon <gannon.mcgibbon@gmail.com> | 2018-11-23 12:18:59 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-23 12:18:59 -0500 |
commit | a190e8cc9fd7c459631ffd98e254adb3638afd18 (patch) | |
tree | 928dfdd254711b4157091d117a58e0855476ccf6 /guides | |
parent | 4d4655f1d60b882d4f1854ec7f93bc50e8a80402 (diff) | |
parent | 5020c2e3022ad9f07c29679f489cdb836425c552 (diff) | |
download | rails-a190e8cc9fd7c459631ffd98e254adb3638afd18.tar.gz rails-a190e8cc9fd7c459631ffd98e254adb3638afd18.tar.bz2 rails-a190e8cc9fd7c459631ffd98e254adb3638afd18.zip |
Merge pull request #34507 from albertoalmagro/rename-rtl-as-direction
Use direction instead of rtl flag
Diffstat (limited to 'guides')
-rw-r--r-- | guides/rails_guides.rb | 14 | ||||
-rw-r--r-- | guides/rails_guides/generator.rb | 25 |
2 files changed, 21 insertions, 18 deletions
diff --git a/guides/rails_guides.rb b/guides/rails_guides.rb index b24c0205d5..28a7c94ca9 100644 --- a/guides/rails_guides.rb +++ b/guides/rails_guides.rb @@ -20,11 +20,11 @@ version = env_value["RAILS_VERSION"] edge = `git rev-parse HEAD`.strip unless version RailsGuides::Generator.new( - edge: edge, - version: version, - all: env_flag["ALL"], - only: env_value["ONLY"], - kindle: env_flag["KINDLE"], - language: env_value["GUIDES_LANGUAGE"], - rtl: env_value["RTL"] + edge: edge, + version: version, + all: env_flag["ALL"], + only: env_value["ONLY"], + kindle: env_flag["KINDLE"], + language: env_value["GUIDES_LANGUAGE"], + direction: env_value["DIRECTION"].to_sym ).generate diff --git a/guides/rails_guides/generator.rb b/guides/rails_guides/generator.rb index 3d8f54ab34..1f0a2063f2 100644 --- a/guides/rails_guides/generator.rb +++ b/guides/rails_guides/generator.rb @@ -17,14 +17,14 @@ module RailsGuides class Generator GUIDES_RE = /\.(?:erb|md)\z/ - def initialize(edge:, version:, all:, only:, kindle:, language:, rtl: false) - @edge = edge - @version = version - @all = all - @only = only - @kindle = kindle - @language = language - @rtl = rtl + def initialize(edge:, version:, all:, only:, kindle:, language:, direction: :ltr) + @edge = edge + @version = version + @all = all + @only = only + @kindle = kindle + @language = language + @direction = direction if @kindle check_for_kindlegen @@ -118,12 +118,15 @@ module RailsGuides def copy_assets FileUtils.cp_r(Dir.glob("#{@guides_dir}/assets/*"), @output_dir) - if @rtl - FileUtils.rm(Dir.glob("#{@output_dir}/stylesheets/main.css")) - FileUtils.mv("#{@output_dir}/stylesheets/main.rtl.css", "#{@output_dir}/stylesheets/main.css") + if @direction == :rtl + overwrite_css_with_right_to_left_direction end end + def overwrite_css_with_right_to_left_direction + FileUtils.mv("#{@output_dir}/stylesheets/main.rtl.css", "#{@output_dir}/stylesheets/main.css") + end + def output_file_for(guide) if guide.end_with?(".md") guide.sub(/md\z/, "html") |