hanmoto 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 530884ee98404b502667b6a9714ff62cdaf998ae
4
- data.tar.gz: 215a3ade3d62f7709aef8bc449d74a3801a275fb
3
+ metadata.gz: e66e72321d84df130dffa4b8019a9dc51358e0a3
4
+ data.tar.gz: 76137c4702a891fb894b76df1d6fe628f4d96930
5
5
  SHA512:
6
- metadata.gz: cf8ab9f19764c7508c8c38095cd4b97bc69d7c42bf0d87a2e018e2cb019ff637be6de52c4abca52896ec25f58c37cf73aa0e7e94b4feb48a8d0120519e971d37
7
- data.tar.gz: 5a5994376a402e275db0951db40411cc13405a2634fb9125d96c17b6c321c1df06ba5d4d05c72aeed7a14aeb42f175dceed02584d7feff0a0c515de7675681d2
6
+ metadata.gz: 4dc24fcc55d04a87ceb9dacaa1a937c5c1b02ea92645ac279889e5176be05773fa4cfab102018c4063a37b1a89da40809efb261e7a470ceeed83610369a4ffb9
7
+ data.tar.gz: 9b06aecf392ca1cc64792063afcbe0ac938d36133cf3a9ce1ac38bb5f11473f4b03a37ec123853935f53e7fe43d3c77f0775e6262859f3e8b6fb9f64b0ee9c09
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'hanmoto/task'
4
+ require 'hanmoto/rake_task_extension'
4
5
 
5
6
  module Hanmoto
6
7
  class Railtie < Rails::Railtie
@@ -14,5 +15,7 @@ module Hanmoto
14
15
  rake_tasks do
15
16
  load File.expand_path('../../tasks/hanmoto_tasks.rake', __FILE__)
16
17
  end
18
+
19
+ Rails::Engine.prepend Hanmoto::RakeTaskExtension
17
20
  end
18
21
  end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Hanmoto
4
+ module RakeTaskExtension
5
+ def load_tasks(*args)
6
+ super
7
+
8
+ # NOTE: should add at last
9
+ Rake::Task['assets:precompile'].enhance do
10
+ Rake::Task['hanmoto:publish'].invoke
11
+ end
12
+
13
+ self
14
+ end
15
+ end
16
+ end
@@ -19,7 +19,6 @@ 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.public_path.join([name, format].join('.'))
23
22
  layout = @layouts[format.to_sym]
24
23
  body = ApplicationController.renderer.render("#{@view_dir}/#{name}", layout: layout)
25
24
  path = output_path(name, format)
@@ -28,12 +27,14 @@ module Hanmoto
28
27
  end
29
28
  end
30
29
 
31
- def output_path(name, format)
32
- Rails.public_path.join([name, ext_by_format(format)].join('.'))
33
- end
30
+ private
34
31
 
35
- def ext_by_format(format)
36
- EXTENSIONS.fetch(format.to_sym, format)
37
- end
32
+ def output_path(name, format)
33
+ Rails.public_path.join([name, ext_by_format(format)].join('.'))
34
+ end
35
+
36
+ def ext_by_format(format)
37
+ EXTENSIONS.fetch(format.to_sym, format)
38
+ end
38
39
  end
39
40
  end
@@ -1,3 +1,3 @@
1
1
  module Hanmoto
2
- VERSION = '0.2.0'
2
+ VERSION = '0.3.0'
3
3
  end
@@ -1,10 +1,8 @@
1
1
  namespace :hanmoto do
2
2
  desc 'generate public pages'
3
3
  task publish: :environment do
4
+ # NOTE: clear cache
5
+ ActionView::Base.assets_manifest = Sprockets::Railtie.build_manifest(Rails.application)
4
6
  Hanmoto::Task.run(Rails.application.config.hanmoto)
5
7
  end
6
8
  end
7
-
8
- Rake::Task['assets:precompile'].enhance do
9
- Rake::Task['hanmoto:publish'].invoke
10
- end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hanmoto
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - aki77
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-11 00:00:00.000000000 Z
11
+ date: 2018-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -78,6 +78,7 @@ files:
78
78
  - Rakefile
79
79
  - lib/hanmoto.rb
80
80
  - lib/hanmoto/railtie.rb
81
+ - lib/hanmoto/rake_task_extension.rb
81
82
  - lib/hanmoto/task.rb
82
83
  - lib/hanmoto/version.rb
83
84
  - lib/tasks/hanmoto_tasks.rake