This section explains how to install MarkdownRecord into a host application.
First, add this line to your application's Gemfile:
gem "markdown_record"
And then execute:
$ bundle install
Then, from the root directory of your application run:
$ rails g markdown_record --demo
Note: if you are already familiar with MarkdownRecord and don't want to install the demo content, you can omit the --demo argument.
The above command will install the engine, resulting in the following output and changes to your application:
create markdown_record/content
create markdown_record/layouts
create markdown_record/rendered
exist markdown_record/content
create markdown_record/content/1_test_files_home.md.erb
create markdown_record/content/2_content_dsl_tests/1_content_dsl.md.erb
create markdown_record/content/2_content_dsl_tests/2_nested_directory/1_associations.md.erb
exist markdown_record/layouts
create markdown_record/layouts/_concatenated_layout.html.erb
create markdown_record/layouts/_custom_layout.html.erb
create markdown_record/layouts/_file_layout.html.erb
create markdown_record/layouts/_global_layout.html.erb
exist app/assets/images
create app/assets/images/ruby-logo.png
create config/initializers/markdown_record.rb
create Thorfile
create lib/tasks/render_content.thor
gsub config/routes.rb
gsub config/routes.rb
The files and folders inside markdown_record/content
are for demo purposes only, and can be deleted once you are ready to create your own content.
By default, MarkdownRecord will look in the markdown_record/content
directory for all your content, and all rendered content will be saved to the markdown_record/rendered
directory.
The engine will be mounted in config/routes.rb
under the mdr
path by default.
An initializer will be created for you, where you will be able to configure the engine to use different directories and change other default settings. A later section of this guide will provide more details on configuration options.
A Thorfile
and some thor tasks will also be added to your application. These tasks are used to render your content to HTML and JSON.
The final step in the installation process is to render the demo content that was installed in markdown_record/content
. To do so, run this Thor task in your application's root directory:
thor render_content:all -s
You should see the following output:
---------------------------------------------------------------
rendering html and json content with options {:concat=>true, :deep=>true, :save=>true, :render_content_fragment_json=>true} ...
---------------------------------------------------------------
rendered: /markdown_record/rendered/content_fragments.json
rendered: /markdown_record/rendered/content.json
rendered: /markdown_record/rendered/content/rendering_basics_fragments.json
rendered: /markdown_record/rendered/content/rendering_basics.json
rendered: /markdown_record/rendered/content/home_fragments.json
rendered: /markdown_record/rendered/content/home.json
rendered: /markdown_record/rendered/content/controller_helpers_fragments.json
rendered: /markdown_record/rendered/content/controller_helpers.json
rendered: /markdown_record/rendered/content/erb_syntax_and_view_helpers_fragments.json
rendered: /markdown_record/rendered/content/erb_syntax_and_view_helpers.json
rendered: /markdown_record/rendered/content/layouts_fragments.json
rendered: /markdown_record/rendered/content/layouts.json
rendered: /markdown_record/rendered/content/configuration_fragments.json
rendered: /markdown_record/rendered/content/configuration.json
rendered: /markdown_record/rendered/content/sandbox_fragments.json
rendered: /markdown_record/rendered/content/sandbox.json
rendered: /markdown_record/rendered/content/sandbox/sandbox_nested_fragments.json
rendered: /markdown_record/rendered/content/sandbox/sandbox_nested.json
rendered: /markdown_record/rendered/content/sandbox/sandbox_nested/bar_fragments.json
rendered: /markdown_record/rendered/content/sandbox/sandbox_nested/bar.json
rendered: /markdown_record/rendered/content/sandbox/foo_fragments.json
rendered: /markdown_record/rendered/content/sandbox/foo.json
rendered: /markdown_record/rendered/content/content_frags_fragments.json
rendered: /markdown_record/rendered/content/content_frags.json
rendered: /markdown_record/rendered/content/content_dsl_fragments.json
rendered: /markdown_record/rendered/content/content_dsl.json
rendered: /markdown_record/rendered/content/routes_fragments.json
rendered: /markdown_record/rendered/content/routes.json
rendered: /markdown_record/rendered/content/model_basics_fragments.json
rendered: /markdown_record/rendered/content/model_basics.json
rendered: /markdown_record/rendered/content/installation_fragments.json
rendered: /markdown_record/rendered/content/installation.json
rendered: /markdown_record/rendered/content/custom_models_and_associations_fragments.json
rendered: /markdown_record/rendered/content/custom_models_and_associations.json
rendered: /markdown_record/rendered/content.html
rendered: /markdown_record/rendered/content/rendering_basics.html
rendered: /markdown_record/rendered/content/home.html
rendered: /markdown_record/rendered/content/controller_helpers.html
rendered: /markdown_record/rendered/content/erb_syntax_and_view_helpers.html
rendered: /markdown_record/rendered/content/layouts.html
rendered: /markdown_record/rendered/content/configuration.html
rendered: /markdown_record/rendered/content/sandbox.html
rendered: /markdown_record/rendered/content/sandbox/sandbox_nested.html
rendered: /markdown_record/rendered/content/sandbox/sandbox_nested/bar.html
rendered: /markdown_record/rendered/content/sandbox/foo.html
rendered: /markdown_record/rendered/content/content_frags.html
rendered: /markdown_record/rendered/content/content_dsl.html
rendered: /markdown_record/rendered/content/routes.html
rendered: /markdown_record/rendered/content/model_basics.html
rendered: /markdown_record/rendered/content/installation.html
rendered: /markdown_record/rendered/content/custom_models_and_associations.html
---------------------------------------------------------------
51 files rendered.
51 files saved.
Congratulations! You have installed MarkdownRecord. If you are not viewing this from the host application already, go ahead and start your Rails server and navigate to your local host demo to continue following this guide.
Alternatively, you can find the complete usage guide here.
The above content was rendered from source files at: content/v_0_1/installation