2017-08-13 21:02:48 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-02-12 17:21:20 +08:00
|
|
|
$:.unshift __dir__
|
2009-10-11 04:59:13 +08:00
|
|
|
|
2017-02-12 17:21:20 +08:00
|
|
|
as_lib = File.expand_path("../activesupport/lib", __dir__)
|
|
|
|
ap_lib = File.expand_path("../actionpack/lib", __dir__)
|
|
|
|
av_lib = File.expand_path("../actionview/lib", __dir__)
|
2009-03-17 20:26:34 +08:00
|
|
|
|
2017-02-12 17:21:20 +08:00
|
|
|
$:.unshift as_lib if File.directory?(as_lib)
|
|
|
|
$:.unshift ap_lib if File.directory?(ap_lib)
|
|
|
|
$:.unshift av_lib if File.directory?(av_lib)
|
2009-02-04 09:44:58 +08:00
|
|
|
|
2010-03-16 05:06:27 +08:00
|
|
|
require "rails_guides/generator"
|
2017-02-12 17:21:20 +08:00
|
|
|
require "active_support/core_ext/object/blank"
|
|
|
|
|
|
|
|
env_value = ->(name) { ENV[name].presence }
|
|
|
|
env_flag = ->(name) { "1" == env_value[name] }
|
|
|
|
|
|
|
|
version = env_value["RAILS_VERSION"]
|
|
|
|
edge = `git rev-parse HEAD`.strip unless version
|
|
|
|
|
|
|
|
RailsGuides::Generator.new(
|
2018-11-23 03:48:25 +08:00
|
|
|
edge: edge,
|
|
|
|
version: version,
|
|
|
|
all: env_flag["ALL"],
|
|
|
|
only: env_value["ONLY"],
|
2022-07-06 14:59:06 +08:00
|
|
|
epub: env_flag["EPUB"],
|
2018-11-23 03:48:25 +08:00
|
|
|
language: env_value["GUIDES_LANGUAGE"],
|
2024-05-01 19:58:39 +08:00
|
|
|
direction: env_value["DIRECTION"],
|
|
|
|
lint: env_flag["GUIDES_LINT"]
|
2017-02-12 17:21:20 +08:00
|
|
|
).generate
|