hanmoto 0.3.0 → 0.6.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
- SHA1:
3
- metadata.gz: e66e72321d84df130dffa4b8019a9dc51358e0a3
4
- data.tar.gz: 76137c4702a891fb894b76df1d6fe628f4d96930
2
+ SHA256:
3
+ metadata.gz: da6bbf38cd69573091e2fae901e11d5579f53f15bc677230202c9647d69de35c
4
+ data.tar.gz: 5004cd68e8603ac43a1c5d7de18a4cbc570bbb3e28338873264402f5198bff7d
5
5
  SHA512:
6
- metadata.gz: 4dc24fcc55d04a87ceb9dacaa1a937c5c1b02ea92645ac279889e5176be05773fa4cfab102018c4063a37b1a89da40809efb261e7a470ceeed83610369a4ffb9
7
- data.tar.gz: 9b06aecf392ca1cc64792063afcbe0ac938d36133cf3a9ce1ac38bb5f11473f4b03a37ec123853935f53e7fe43d3c77f0775e6262859f3e8b6fb9f64b0ee9c09
6
+ metadata.gz: bf49954755514dd3f94700a2a80397fc9b371d984d34cb4a68236ea2435946e8ccc981d900e509475f89d5f2549ec79c5c8c4183e604cc7df9a34e277c168ea1
7
+ data.tar.gz: bc2a076e3e7acbe17c36ee53793da092cf7fb8ce9fb70c93e1a6ee1812ff887620b9a423b304f603e430362acde7fcd4e0befd7c450607c93b4b464b02bcd6de
data/README.md CHANGED
@@ -79,6 +79,19 @@ Or install it yourself as:
79
79
  $ gem install hanmoto
80
80
  ```
81
81
 
82
+ ## Configuration
83
+
84
+ In `config/initializers/hanmoto.rb`, you can configure the following values.
85
+
86
+ ```ruby
87
+ Hanmoto.configure do |config|
88
+ # config.view_dir = 'public_page'
89
+ # config.layouts = {
90
+ # html: 'public',
91
+ # }
92
+ end
93
+ ```
94
+
82
95
  ## Contributing
83
96
 
84
97
  Contribution directions go here.
data/Rakefile CHANGED
@@ -1,26 +1,6 @@
1
- begin
2
- require 'bundler/setup'
3
- rescue LoadError
4
- puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
- end
6
-
7
- require 'rdoc/task'
8
-
9
- RDoc::Task.new(:rdoc) do |rdoc|
10
- rdoc.rdoc_dir = 'rdoc'
11
- rdoc.title = 'Hanmoto'
12
- rdoc.options << '--line-numbers'
13
- rdoc.rdoc_files.include('README.md')
14
- rdoc.rdoc_files.include('lib/**/*.rb')
15
- end
16
-
17
- APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
18
- load "rails/tasks/engine.rake"
19
-
20
- load "rails/tasks/statistics.rake"
21
-
22
- Bundler::GemHelper.install_tasks
23
-
1
+ require "bundler/gem_tasks"
24
2
  require "rspec/core/rake_task"
3
+
25
4
  RSpec::Core::RakeTask.new(:spec)
26
- task default: :spec
5
+
6
+ task :default => :spec
@@ -0,0 +1,18 @@
1
+ module Hanmoto
2
+ class Configuration
3
+ OPTIONS = %i[view_dir layouts]
4
+
5
+ attr_accessor *OPTIONS
6
+
7
+ def initialize
8
+ @view_dir = 'public_pages'
9
+ @layouts = {
10
+ html: 'public',
11
+ }
12
+ end
13
+
14
+ def to_h
15
+ OPTIONS.map { |name| [name, public_send(name)] }.to_h
16
+ end
17
+ end
18
+ end
@@ -5,13 +5,6 @@ require 'hanmoto/rake_task_extension'
5
5
 
6
6
  module Hanmoto
7
7
  class Railtie < Rails::Railtie
8
- # options
9
- config.hanmoto = ActiveSupport::OrderedOptions.new
10
- config.hanmoto.view_dir = 'public_pages'
11
- config.hanmoto.layouts = {
12
- html: 'public',
13
- }
14
-
15
8
  rake_tasks do
16
9
  load File.expand_path('../../tasks/hanmoto_tasks.rake', __FILE__)
17
10
  end
data/lib/hanmoto/task.rb CHANGED
@@ -6,8 +6,8 @@ module Hanmoto
6
6
  text: 'txt',
7
7
  }.freeze
8
8
 
9
- def self.run(*args)
10
- new(*args).run
9
+ def self.run(**args)
10
+ new(**args).run
11
11
  end
12
12
 
13
13
  def initialize(view_dir:, layouts: {})
@@ -1,3 +1,3 @@
1
1
  module Hanmoto
2
- VERSION = '0.3.0'
2
+ VERSION = '0.6.0'
3
3
  end
data/lib/hanmoto.rb CHANGED
@@ -1,3 +1,14 @@
1
1
  require 'hanmoto/railtie'
2
+ require 'hanmoto/configuration'
3
+
2
4
  module Hanmoto
5
+ class << self
6
+ def configure
7
+ yield(configuration)
8
+ end
9
+
10
+ def configuration
11
+ @configuration ||= Configuration.new
12
+ end
13
+ end
3
14
  end
@@ -2,7 +2,9 @@ namespace :hanmoto do
2
2
  desc 'generate public pages'
3
3
  task publish: :environment do
4
4
  # NOTE: clear cache
5
- ActionView::Base.assets_manifest = Sprockets::Railtie.build_manifest(Rails.application)
6
- Hanmoto::Task.run(Rails.application.config.hanmoto)
5
+ if defined?(ActionView::Base.assets_manifest)
6
+ ActionView::Base.assets_manifest = Sprockets::Railtie.build_manifest(Rails.application)
7
+ end
8
+ Hanmoto::Task.run(**Hanmoto.configuration.to_h)
7
9
  end
8
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.3.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - aki77
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-15 00:00:00.000000000 Z
11
+ date: 2022-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 5.1.0
19
+ version: 6.0.5
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 5.1.0
26
+ version: 6.0.5
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: sqlite3
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -77,6 +77,7 @@ files:
77
77
  - README.md
78
78
  - Rakefile
79
79
  - lib/hanmoto.rb
80
+ - lib/hanmoto/configuration.rb
80
81
  - lib/hanmoto/railtie.rb
81
82
  - lib/hanmoto/rake_task_extension.rb
82
83
  - lib/hanmoto/task.rb
@@ -86,7 +87,7 @@ homepage: https://github.com/aki77/hanmoto
86
87
  licenses:
87
88
  - MIT
88
89
  metadata: {}
89
- post_install_message:
90
+ post_install_message:
90
91
  rdoc_options: []
91
92
  require_paths:
92
93
  - lib
@@ -94,16 +95,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
94
95
  requirements:
95
96
  - - ">="
96
97
  - !ruby/object:Gem::Version
97
- version: '0'
98
+ version: 2.7.0
98
99
  required_rubygems_version: !ruby/object:Gem::Requirement
99
100
  requirements:
100
101
  - - ">="
101
102
  - !ruby/object:Gem::Version
102
103
  version: '0'
103
104
  requirements: []
104
- rubyforge_project:
105
- rubygems_version: 2.6.14
106
- signing_key:
105
+ rubygems_version: 3.3.7
106
+ signing_key:
107
107
  specification_version: 4
108
108
  summary: Public pages management with Asset Pipeline
109
109
  test_files: []