hanmoto 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 16c6dd4a2ee539e1791b0451653781f60b44b9aa
4
- data.tar.gz: 42bbe33b0040b592904fb0a3602f14b729a6ac95
3
+ metadata.gz: 530884ee98404b502667b6a9714ff62cdaf998ae
4
+ data.tar.gz: 215a3ade3d62f7709aef8bc449d74a3801a275fb
5
5
  SHA512:
6
- metadata.gz: 14f26baf15b8f62e726e1b736fe908ee91d984533fad4d5c158631c2004f627c833fcbef721778b984162c7bf420c4078ff18fffb728d0400c1fd3768efc6352
7
- data.tar.gz: b02e834d04555f1b006259a2ffb86abffc8ece4917c5f41bfa132c89a42bdc51a5c426e6afed8700a576bbbc7b641341998f5a285091ba387b46d59574802138
6
+ metadata.gz: cf8ab9f19764c7508c8c38095cd4b97bc69d7c42bf0d87a2e018e2cb019ff637be6de52c4abca52896ec25f58c37cf73aa0e7e94b4feb48a8d0120519e971d37
7
+ data.tar.gz: 5a5994376a402e275db0951db40411cc13405a2634fb9125d96c17b6c321c1df06ba5d4d05c72aeed7a14aeb42f175dceed02584d7feff0a0c515de7675681d2
data/README.md CHANGED
@@ -9,6 +9,7 @@ Inspired by [gakubuchi](https://github.com/yasaichi/gakubuchi).
9
9
  In app/views/public_pages/404.html.haml:
10
10
 
11
11
  ```haml
12
+ - provide(:title, 'Not found')
12
13
  %h1 Not found
13
14
  %p This webpage is not found.
14
15
  %p= link_to 'Home', root_path
@@ -17,6 +18,7 @@ In app/views/public_pages/404.html.haml:
17
18
  In app/views/public_pages/500.html.haml:
18
19
 
19
20
  ```haml
21
+ - provide(:title, 'Server error')
20
22
  %h1 Server error
21
23
  %p This webpage is not working.
22
24
  ```
@@ -52,7 +54,7 @@ rake assets:precompile
52
54
  or
53
55
 
54
56
  ```
55
- rake hanmoto:generate
57
+ rake hanmoto:publish
56
58
  ```
57
59
 
58
60
  This will generate `public/404.html`, `public/500.html`, and `public/robots.txt`.
@@ -3,12 +3,16 @@
3
3
  require 'hanmoto/task'
4
4
 
5
5
  module Hanmoto
6
- class Railtie < Rails::Engine
6
+ class Railtie < Rails::Railtie
7
7
  # options
8
8
  config.hanmoto = ActiveSupport::OrderedOptions.new
9
9
  config.hanmoto.view_dir = 'public_pages'
10
10
  config.hanmoto.layouts = {
11
11
  html: 'public',
12
12
  }
13
+
14
+ rake_tasks do
15
+ load File.expand_path('../../tasks/hanmoto_tasks.rake', __FILE__)
16
+ end
13
17
  end
14
18
  end
@@ -19,7 +19,7 @@ module Hanmoto
19
19
  Dir.foreach(Rails.root.join('app', 'views', @view_dir)) do |file|
20
20
  next if file.start_with?('.')
21
21
  name, format = file.split('.', 3)
22
- output_path = Rails.root.join('public', [name, format].join('.'))
22
+ output_path = Rails.public_path.join([name, format].join('.'))
23
23
  layout = @layouts[format.to_sym]
24
24
  body = ApplicationController.renderer.render("#{@view_dir}/#{name}", layout: layout)
25
25
  path = output_path(name, format)
@@ -29,7 +29,7 @@ module Hanmoto
29
29
  end
30
30
 
31
31
  def output_path(name, format)
32
- Rails.root.join('public', [name, ext_by_format(format)].join('.'))
32
+ Rails.public_path.join([name, ext_by_format(format)].join('.'))
33
33
  end
34
34
 
35
35
  def ext_by_format(format)
@@ -1,3 +1,3 @@
1
1
  module Hanmoto
2
- VERSION = '0.1.0'
2
+ VERSION = '0.2.0'
3
3
  end
@@ -1,10 +1,10 @@
1
1
  namespace :hanmoto do
2
2
  desc 'generate public pages'
3
- task generate: :environment do
3
+ task publish: :environment do
4
4
  Hanmoto::Task.run(Rails.application.config.hanmoto)
5
5
  end
6
6
  end
7
7
 
8
8
  Rake::Task['assets:precompile'].enhance do
9
- Rake::Task['hanmoto:generate'].invoke
9
+ Rake::Task['hanmoto:publish'].invoke
10
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hanmoto
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - aki77