Class: Frozen::Generators::MdGenerator
Constant Summary
Constants included
from Nodeable
Nodeable::REQUIRED_EXECUTABLES
Instance Method Summary
collapse
Instance Method Details
#add_config ⇒ Object
33
34
35
36
37
38
39
|
# File 'lib/generators/frozen/md_generator.rb', line 33
def add_config
append_to_application_config <<~RUBY
# frozen:md
config.assets.paths << Rails.root.join("content")
config.action_dispatch.rescue_responses["Decant::FileNotFound"] = :not_found
RUBY
end
|
#add_gems ⇒ Object
10
11
12
13
14
15
16
17
18
|
# File 'lib/generators/frozen/md_generator.rb', line 10
def add_gems
add_frozen_gems <<~RUBY
# frozen:md
gem "decant"
gem "kramdown"
gem "kramdown-parser-gfm"
gem "rouge"
RUBY
end
|
#add_routes ⇒ Object
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/generators/frozen/md_generator.rb', line 41
def add_routes
append_to_routes <<~RUBY
root "categories#index"
# frozen:md
constraints slug: Regexp.union(Category.all.map(&:slug)) do
resources :categories, param: :slug, only: [ :index, :show ]
end
resources :pages, param: :slug, only: [ :show ]
RUBY
end
|
#bundle_gems ⇒ Object
20
21
22
|
# File 'lib/generators/frozen/md_generator.rb', line 20
def bundle_gems
bundle!
end
|
#copy_files ⇒ Object
24
25
26
27
28
29
30
31
|
# File 'lib/generators/frozen/md_generator.rb', line 24
def copy_files
copy_directory "controllers", "app/controllers"
copy_directory "helpers", "app/helpers"
copy_directory "models", "app/models"
copy_directory "views", "app/views"
copy_directory "initializers", "config/initializers"
copy_directory "pages", "content/pages"
end
|
#generate_rouge_css_stylesheet ⇒ Object
58
59
60
|
# File 'lib/generators/frozen/md_generator.rb', line 58
def generate_rouge_css_stylesheet
run "rougify style gruvbox.dark > app/assets/rouge/rouge.css"
end
|
#prepare_rouge ⇒ Object
53
54
55
56
|
# File 'lib/generators/frozen/md_generator.rb', line 53
def prepare_rouge
copy_directory "assets/rouge", "app/assets/rouge"
copy_file "assets/application.css", "app/assets/application.css", force: true
end
|