comfy_archive 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +27 -0
- data/LICENSE +21 -0
- data/README.md +43 -0
- data/Rakefile +5 -0
- data/app/assets/config/manifest.js +0 -0
- data/app/controllers/comfy/admin/archive/indices_controller.rb +65 -0
- data/app/controllers/comfy/archive/index_controller.rb +45 -0
- data/app/models/comfy/archive/index.rb +36 -0
- data/app/views/comfy/admin/archive/indices/_form.html.haml +14 -0
- data/app/views/comfy/admin/archive/indices/edit.html.haml +5 -0
- data/app/views/comfy/admin/archive/indices/index.html.haml +29 -0
- data/app/views/comfy/admin/archive/indices/new.html.haml +5 -0
- data/app/views/comfy/admin/archive/partials/_navigation.html.haml +4 -0
- data/app/views/comfy/archive/index/index.html.haml +31 -0
- data/bin/bundle +3 -0
- data/bin/rails +4 -0
- data/bin/rake +4 -0
- data/bin/setup +36 -0
- data/bin/update +31 -0
- data/bin/yarn +11 -0
- data/comfy_archive.gemspec +27 -0
- data/config/application.rb +39 -0
- data/config/archive_routes.rb +8 -0
- data/config/boot.rb +7 -0
- data/config/database.yml +11 -0
- data/config/environment.rb +7 -0
- data/config/environments/development.rb +64 -0
- data/config/environments/test.rb +51 -0
- data/config/initializers/comfy_archive.rb +3 -0
- data/config/locales/en.yml +57 -0
- data/config/storage.yml +35 -0
- data/config.ru +6 -0
- data/db/migrate/00_create_cms.rb +167 -0
- data/db/migrate/01_create_archive.rb +12 -0
- data/lib/comfy_archive/configuration.rb +15 -0
- data/lib/comfy_archive/engine.rb +66 -0
- data/lib/comfy_archive/routes/archive.rb +18 -0
- data/lib/comfy_archive/routes/archive_admin.rb +20 -0
- data/lib/comfy_archive/routing.rb +4 -0
- data/lib/comfy_archive/version.rb +7 -0
- data/lib/comfy_archive.rb +29 -0
- data/lib/generators/comfy/archive/README +12 -0
- data/lib/generators/comfy/archive/archive_generator.rb +53 -0
- metadata +101 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 22cc14df3fd53a58e65d4c3d9e262388d6969414fd7b4a7a8065b2749a2e87f0
|
4
|
+
data.tar.gz: a0709230779817c4011fd429c73859a9a172713214fea66322d9a48b165e5e90
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 23801bb7a1ecc7c6582e6a88ea27fda60de910a4bceb9dc124bdc9ad67061c92632d229098ccc9ea76db3dc7d6a3b4fc13d723c1fd5244e48a22bc3a43245a45
|
7
|
+
data.tar.gz: 29840c80f9337ef60018beeb1c88dcf69a89091ad6a69718e80818924eb9d3a78173cb4f9ad453a52a5ca21d09a238bfc723db02fb939b6c688b97ff5719c3ad
|
data/.gitignore
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source "http://rubygems.org"
|
4
|
+
|
5
|
+
gemspec
|
6
|
+
|
7
|
+
# CMS has dependency on prerelease and Bundler chokes on it
|
8
|
+
gem "rails", "~> 5.2.0.rc1"
|
9
|
+
|
10
|
+
group :development, :test do
|
11
|
+
gem "byebug", "~> 10.0.0", platforms: %i[mri mingw x64_mingw]
|
12
|
+
gem "kaminari", "~> 1.1.1"
|
13
|
+
gem "puma", "~> 3.11.2"
|
14
|
+
gem "rubocop", "~> 0.55.0", require: false
|
15
|
+
gem "sqlite3", "~> 1.3.13"
|
16
|
+
end
|
17
|
+
|
18
|
+
group :development do
|
19
|
+
gem "listen", "~> 3.1.5"
|
20
|
+
gem "web-console", "~> 3.5.1"
|
21
|
+
end
|
22
|
+
|
23
|
+
group :test do
|
24
|
+
gem "coveralls", "~> 0.8.21", require: false
|
25
|
+
gem "mocha", "~> 1.3.0", require: false
|
26
|
+
gem "rails-controller-testing", "~> 1.0.2"
|
27
|
+
end
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
Copyright 2013-2018 Oleg Khabarov
|
2
|
+
Copyright 2019 Discovery Map International, Inc.
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
a copy of this software and associated documentation files (the
|
6
|
+
"Software"), to deal in the Software without restriction, including
|
7
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be
|
13
|
+
included in all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# ComfyArchive
|
2
|
+
|
3
|
+
ComfyArchive is a management engine for chronologically & categorically archived sections for [Comfortable Mexican Sofa](https://github.com/comfy/comfortable-mexican-sofa) 2.x. You can select one or more Comfortable Mexican Sofa pages to act as an index for child pages, which will then be organized both cronologically, by year and month, and by category.
|
4
|
+
|
5
|
+
## Dependencies
|
6
|
+
|
7
|
+
Make sure that you have [ComfortableMexicanSofa](https://github.com/comfy/comfortable-mexican-sofa) installed first.
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
1) Add gem definition to your Gemfile:
|
12
|
+
|
13
|
+
gem "comfy_archive", "~> 0.1.1"
|
14
|
+
|
15
|
+
2) From your Rails project's root run:
|
16
|
+
|
17
|
+
bundle install
|
18
|
+
rails generate comfy:archive
|
19
|
+
rake db:migrate
|
20
|
+
|
21
|
+
3) Add the following lines to your `config/routes.rb` file, after the "`comfy_route :cms_admin`" line and before the "`comfy_route :cms`" line:
|
22
|
+
|
23
|
+
comfy_route :archive_admin
|
24
|
+
comfy_route :archive
|
25
|
+
|
26
|
+
4) You should also find view templates in your `/app/views/comfy/archive` folder. Feel free to adjust them as you see fit.
|
27
|
+
|
28
|
+
## Configuration
|
29
|
+
|
30
|
+
1) Add a `datetime` tag to the layout used by any page which will be ordered chronologically under an index page, then set the field to a valid date & time in the pages themselves.
|
31
|
+
|
32
|
+
2) Add a new Archive Index, selecting the parent page (_Important_: can not be the root page!) which will act as an index for child pages and enter the name of the `datetime` tag you created in Step 1
|
33
|
+
|
34
|
+
## Architecture
|
35
|
+
|
36
|
+
* `ComfyArchive`: Rails Engine which manages configuration, adds scopes & associations to `Comfy::Cms::Site` & `Comfy::Cms::Page` models, and adds route matching methods
|
37
|
+
* `Comfy::Archive::Index`: A model which represents pages which will become chronological archive pages, it has a `Comfy::Cms::Page` association and also the name of the page's `datetime` fragment to use for chronological ordering
|
38
|
+
* `Comfy::Admin::Archive::IndicesController`: A Comfortable Mexican Sofa admin controller for managing `Comfy::Archive::Index` models
|
39
|
+
* `Comfy::Archive::IndexController`: A controller for rendering `Comfy::Archive::Index` pages, plus chronological & categorical archive pages
|
40
|
+
|
41
|
+
---
|
42
|
+
|
43
|
+
Copyright (c) 2019 Discovery Map International, Inc.
|
data/Rakefile
ADDED
File without changes
|
@@ -0,0 +1,65 @@
|
|
1
|
+
class Comfy::Admin::Archive::IndicesController < Comfy::Admin::Cms::BaseController
|
2
|
+
|
3
|
+
before_action :build_index, only: %i[new create]
|
4
|
+
before_action :load_index, only: %i[edit update destroy]
|
5
|
+
before_action :authorize
|
6
|
+
|
7
|
+
def index
|
8
|
+
return redirect_to action: :new if @site.archive_indices.count.zero?
|
9
|
+
|
10
|
+
indices_scope = @site.archive_indices
|
11
|
+
@indices = comfy_paginate(indices_scope)
|
12
|
+
end
|
13
|
+
|
14
|
+
def new
|
15
|
+
render
|
16
|
+
end
|
17
|
+
|
18
|
+
def create
|
19
|
+
@index.save!
|
20
|
+
flash[:success] = t(".created")
|
21
|
+
redirect_to action: :edit, id: @index
|
22
|
+
|
23
|
+
rescue ActiveRecord::RecordInvalid
|
24
|
+
flash.now[:danger] = t(".create_failure")
|
25
|
+
render action: :new
|
26
|
+
end
|
27
|
+
|
28
|
+
def edit
|
29
|
+
render
|
30
|
+
end
|
31
|
+
|
32
|
+
def update
|
33
|
+
@index.update_attributes!(index_params)
|
34
|
+
flash[:success] = t(".updated")
|
35
|
+
redirect_to action: :edit, id: @index
|
36
|
+
|
37
|
+
rescue ActiveRecord::RecordInvalid
|
38
|
+
flash.now[:danger] = t(".update_failure")
|
39
|
+
render action: :edit
|
40
|
+
end
|
41
|
+
|
42
|
+
def destroy
|
43
|
+
@index.destroy
|
44
|
+
flash[:success] = t(".deleted")
|
45
|
+
redirect_to action: :index
|
46
|
+
end
|
47
|
+
|
48
|
+
protected
|
49
|
+
|
50
|
+
def load_index
|
51
|
+
@index = @site.archive_indices.find(params[:id])
|
52
|
+
rescue ActiveRecord::RecordNotFound
|
53
|
+
flash[:danger] = t(".not_found")
|
54
|
+
redirect_to action: :index
|
55
|
+
end
|
56
|
+
|
57
|
+
def build_index
|
58
|
+
@index = @site.archive_indices.new(index_params)
|
59
|
+
end
|
60
|
+
|
61
|
+
def index_params
|
62
|
+
params.fetch(:index, {}).permit!
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'cgi'
|
2
|
+
|
3
|
+
class Comfy::Archive::IndexController < Comfy::Cms::ContentController
|
4
|
+
|
5
|
+
include Comfy::Paginate
|
6
|
+
|
7
|
+
before_action :load_index,
|
8
|
+
:authenticate,
|
9
|
+
:authorize,
|
10
|
+
only: :index
|
11
|
+
|
12
|
+
def index
|
13
|
+
unless @cms_index && @cms_index.page == @cms_page
|
14
|
+
show
|
15
|
+
else
|
16
|
+
scope = @cms_index.children(true).chronologically(@cms_index.datetime_fragment)
|
17
|
+
if params[:year]
|
18
|
+
@year = params[:year]
|
19
|
+
scope = scope.for_year(@cms_index.datetime_fragment, @year)
|
20
|
+
if params[:month]
|
21
|
+
@month = params[:month]
|
22
|
+
scope = scope.for_month(@cms_index.datetime_fragment, @month)
|
23
|
+
end
|
24
|
+
elsif params[:category]
|
25
|
+
@category = CGI.unescape(params[:category])
|
26
|
+
scope = scope.for_category(@category).distinct(false)
|
27
|
+
end
|
28
|
+
|
29
|
+
@archive_pages = comfy_paginate(scope, per_page: ComfyArchive.config.posts_per_page)
|
30
|
+
render layout: app_layout
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
protected
|
35
|
+
|
36
|
+
def load_index
|
37
|
+
load_cms_page
|
38
|
+
if @cms_page
|
39
|
+
unless @cms_index = Comfy::Archive::Index.find_by(page: @cms_page)
|
40
|
+
@cms_index = Comfy::Archive::Index.find_by(page: @cms_page.parent)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
class Comfy::Archive::Index < ActiveRecord::Base
|
2
|
+
|
3
|
+
self.table_name = "comfy_archive_indices"
|
4
|
+
|
5
|
+
# -- Relationships -----------------------------------------------------------
|
6
|
+
belongs_to :site,
|
7
|
+
class_name: "Comfy::Cms::Site"
|
8
|
+
belongs_to :page,
|
9
|
+
class_name: "Comfy::Cms::Page"
|
10
|
+
|
11
|
+
# -- Validations -------------------------------------------------------------
|
12
|
+
validates :label, :datetime_fragment,
|
13
|
+
presence: true
|
14
|
+
validates :page,
|
15
|
+
presence: true,
|
16
|
+
uniqueness: { scope: :page_id }
|
17
|
+
|
18
|
+
# -- Instance Mathods --------------------------------------------------------
|
19
|
+
def url(relative: false)
|
20
|
+
page.url(relative: relative)
|
21
|
+
end
|
22
|
+
|
23
|
+
def children(published = false)
|
24
|
+
if published
|
25
|
+
page.children.published
|
26
|
+
else
|
27
|
+
page.children
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def categories(published = false)
|
32
|
+
category_ids = Comfy::Cms::Categorization.where(categorized_type: "Comfy::Cms::Page", categorized_id: self.children(published)).pluck(:category_id).uniq
|
33
|
+
Comfy::Cms::Category.where(id: category_ids)
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
= comfy_admin_partial "comfy/admin/archive/partials/index_form_before", form: form
|
2
|
+
|
3
|
+
= form.text_field :label
|
4
|
+
|
5
|
+
- if (options = ::Comfy::Cms::Page.options_for_select(site: @site, current_page: @index.page, exclude_self: false)).present?
|
6
|
+
= form.select :page_id, options, bootstrap: {custom_control: true}
|
7
|
+
|
8
|
+
= form.text_field :datetime_fragment
|
9
|
+
|
10
|
+
= comfy_admin_partial "comfy/admin/archive/partials/index_form_after", form: form
|
11
|
+
|
12
|
+
= form.form_actions do
|
13
|
+
= submit_tag t(@index.new_record? ? ".create" : ".update"), class: "btn btn-primary ml-sm-1", data: {disable_with: false}
|
14
|
+
= link_to t(".cancel"), comfy_admin_archive_indices_path(@site, @index), class: "btn btn-link"
|
@@ -0,0 +1,29 @@
|
|
1
|
+
.page-header
|
2
|
+
= link_to t('.new_link'), new_comfy_admin_archive_index_path(@site), class: 'btn btn-secondary float-right'
|
3
|
+
%h2= t('.title')
|
4
|
+
|
5
|
+
= comfy_admin_partial "comfy/admin/blog/partials/indices_before"
|
6
|
+
|
7
|
+
= comfy_paginate @indices
|
8
|
+
|
9
|
+
%ul.list
|
10
|
+
- @indices.each do |index|
|
11
|
+
%li
|
12
|
+
.row
|
13
|
+
.col-md-8.item
|
14
|
+
.item-content
|
15
|
+
.item-title
|
16
|
+
= link_to index.label, edit_comfy_admin_archive_index_path(@site, index)
|
17
|
+
.item-meta
|
18
|
+
- link = index.url
|
19
|
+
= link_to link, link, target: "_blank"
|
20
|
+
%br
|
21
|
+
|
22
|
+
.col-md-4.d-flex.align-items-center.justify-content-md-end
|
23
|
+
.btn-group.btn-group-sm
|
24
|
+
= link_to t('.edit'), edit_comfy_admin_archive_index_path(@site, index), class: 'btn btn-outline-secondary'
|
25
|
+
= link_to t('.delete'), comfy_admin_archive_index_path(@site, index), method: :delete, data: {confirm: t('.are_you_sure')}, class: 'btn btn-danger'
|
26
|
+
|
27
|
+
= comfy_paginate @indices
|
28
|
+
|
29
|
+
= comfy_admin_partial "comfy/admin/blog/partials/indices_after"
|
@@ -0,0 +1,31 @@
|
|
1
|
+
- require 'cgi'
|
2
|
+
|
3
|
+
- site_path = @cms_index.url(relative: false)
|
4
|
+
|
5
|
+
%h2
|
6
|
+
= link_to @cms_index.page.label, site_path
|
7
|
+
|
8
|
+
- @archive_pages.each do |page|
|
9
|
+
%h3
|
10
|
+
= link_to page.label, page.url
|
11
|
+
.date
|
12
|
+
= page.published_at(@cms_index.datetime_fragment).to_s(:db)
|
13
|
+
|
14
|
+
= comfy_paginate @archive_pages
|
15
|
+
|
16
|
+
%h4 Archives
|
17
|
+
- case ActiveRecord::Base.connection.adapter_name.downcase.to_sym
|
18
|
+
- when :mysql, :mysql2
|
19
|
+
- dates = @cms_index.children(true).chronologically(@cms_index.datetime_fragment).group(:year, :month).unscope(:order).order(year: :desc, month: :desc).pluck(Arel.sql("YEAR(comfy_cms_fragments.datetime) as year, MONTH(comfy_cms_fragments.datetime) as month"))
|
20
|
+
- when :sqlite
|
21
|
+
- dates = @cms_index.children(true).chronologically(@cms_index.datetime_fragment).group(:year, :month).unscope(:order).order(year: :desc, month: :desc).pluck(Arel.sql("strftime('%Y', comfy_cms_fragments.datetime) as year, strftime('%m', comfy_cms_fragments.datetime) as month"))
|
22
|
+
- else
|
23
|
+
- raise NotImplementedError, "Unknown adapter type '#{ActiveRecord::Base.connection.adapter_name}'"
|
24
|
+
- dates.each do |(year, month)|
|
25
|
+
%li
|
26
|
+
- date = [I18n.t("date.month_names")[month.to_i], year].join(" ")
|
27
|
+
= link_to date, comfy_archive_pages_of_month_path(site_path, year: year, month: month)
|
28
|
+
|
29
|
+
%h4 Categories
|
30
|
+
- @cms_index.categories(true).each do |category|
|
31
|
+
= link_to category.label, comfy_archive_pages_of_category_path(site_path, category: CGI.escape(category.label))
|
data/bin/bundle
ADDED
data/bin/rails
ADDED
data/bin/rake
ADDED
data/bin/setup
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'fileutils'
|
3
|
+
include FileUtils
|
4
|
+
|
5
|
+
# path to your application root.
|
6
|
+
APP_ROOT = File.expand_path('..', __dir__)
|
7
|
+
|
8
|
+
def system!(*args)
|
9
|
+
system(*args) || abort("\n== Command #{args} failed ==")
|
10
|
+
end
|
11
|
+
|
12
|
+
chdir APP_ROOT do
|
13
|
+
# This script is a starting point to setup your application.
|
14
|
+
# Add necessary setup steps to this file.
|
15
|
+
|
16
|
+
puts '== Installing dependencies =='
|
17
|
+
system! 'gem install bundler --conservative'
|
18
|
+
system('bundle check') || system!('bundle install')
|
19
|
+
|
20
|
+
# Install JavaScript dependencies if using Yarn
|
21
|
+
# system('bin/yarn')
|
22
|
+
|
23
|
+
# puts "\n== Copying sample files =="
|
24
|
+
# unless File.exist?('config/database.yml')
|
25
|
+
# cp 'config/database.yml.sample', 'config/database.yml'
|
26
|
+
# end
|
27
|
+
|
28
|
+
puts "\n== Preparing database =="
|
29
|
+
system! 'bin/rails db:setup'
|
30
|
+
|
31
|
+
puts "\n== Removing old logs and tempfiles =="
|
32
|
+
system! 'bin/rails log:clear tmp:clear'
|
33
|
+
|
34
|
+
puts "\n== Restarting application server =="
|
35
|
+
system! 'bin/rails restart'
|
36
|
+
end
|
data/bin/update
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'fileutils'
|
3
|
+
include FileUtils
|
4
|
+
|
5
|
+
# path to your application root.
|
6
|
+
APP_ROOT = File.expand_path('..', __dir__)
|
7
|
+
|
8
|
+
def system!(*args)
|
9
|
+
system(*args) || abort("\n== Command #{args} failed ==")
|
10
|
+
end
|
11
|
+
|
12
|
+
chdir APP_ROOT do
|
13
|
+
# This script is a way to update your development environment automatically.
|
14
|
+
# Add necessary update steps to this file.
|
15
|
+
|
16
|
+
puts '== Installing dependencies =='
|
17
|
+
system! 'gem install bundler --conservative'
|
18
|
+
system('bundle check') || system!('bundle install')
|
19
|
+
|
20
|
+
# Install JavaScript dependencies if using Yarn
|
21
|
+
# system('bin/yarn')
|
22
|
+
|
23
|
+
puts "\n== Updating database =="
|
24
|
+
system! 'bin/rails db:migrate'
|
25
|
+
|
26
|
+
puts "\n== Removing old logs and tempfiles =="
|
27
|
+
system! 'bin/rails log:clear tmp:clear'
|
28
|
+
|
29
|
+
puts "\n== Restarting application server =="
|
30
|
+
system! 'bin/rails restart'
|
31
|
+
end
|
data/bin/yarn
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
VENDOR_PATH = File.expand_path('..', __dir__)
|
3
|
+
Dir.chdir(VENDOR_PATH) do
|
4
|
+
begin
|
5
|
+
exec "yarnpkg #{ARGV.join(' ')}"
|
6
|
+
rescue Errno::ENOENT
|
7
|
+
$stderr.puts "Yarn executable was not detected in the system."
|
8
|
+
$stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
|
9
|
+
exit 1
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
$LOAD_PATH.push File.expand_path("lib", __dir__)
|
4
|
+
|
5
|
+
require "comfy_archive/version"
|
6
|
+
|
7
|
+
# Describe your gem and declare its dependencies:
|
8
|
+
Gem::Specification.new do |s|
|
9
|
+
s.name = "comfy_archive"
|
10
|
+
s.version = ComfyArchive::VERSION
|
11
|
+
s.authors = ["Morgan Aldridge"]
|
12
|
+
s.email = ["morgan@discoverymap.com"]
|
13
|
+
s.homepage = "http://github.com/discoverymap/comfy-archive"
|
14
|
+
s.summary = "Chronological Archives Engine for ComfortableMexicanSofa"
|
15
|
+
s.description = "Chronological Archives Engine for ComfortableMexicanSofa"
|
16
|
+
s.license = "MIT"
|
17
|
+
|
18
|
+
s.files = `git ls-files -z`.split("\x0").reject do |f|
|
19
|
+
f.match(%r{^(test|doc)/})
|
20
|
+
end
|
21
|
+
|
22
|
+
s.require_paths = ["lib"]
|
23
|
+
|
24
|
+
s.required_ruby_version = ">= 2.3.0"
|
25
|
+
|
26
|
+
s.add_dependency "comfortable_mexican_sofa", ">= 2.0.14"
|
27
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "boot"
|
4
|
+
|
5
|
+
require "rails/all"
|
6
|
+
|
7
|
+
# Require the gems listed in Gemfile, including any gems
|
8
|
+
# you've limited to :test, :development, or :production.
|
9
|
+
Bundler.require(*Rails.groups)
|
10
|
+
|
11
|
+
module ComfyArchive
|
12
|
+
class Application < Rails::Application
|
13
|
+
|
14
|
+
require_relative "../lib/comfy_archive"
|
15
|
+
|
16
|
+
config.load_defaults 5.2
|
17
|
+
|
18
|
+
# Settings in config/environments/* take precedence over those specified here.
|
19
|
+
# Application configuration should go into files in config/initializers
|
20
|
+
# -- all .rb files in that directory are automatically loaded.
|
21
|
+
|
22
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
23
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
24
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
25
|
+
|
26
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
27
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
28
|
+
# config.i18n.default_locale = :de
|
29
|
+
|
30
|
+
# Ensuring that all ActiveStorage routes are loaded before out globbing route.
|
31
|
+
config.railties_order = [ActiveStorage::Engine, :main_app, :all]
|
32
|
+
|
33
|
+
# Making sure we don't load our dev routes as part of the engine
|
34
|
+
config.paths["config/routes.rb"] << "config/archive_routes.rb"
|
35
|
+
|
36
|
+
config.i18n.enforce_available_locales = true
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
data/config/boot.rb
ADDED
data/config/database.yml
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
defined?(ComfyArchive::Application) && ComfyArchive::Application.configure do
|
4
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
5
|
+
|
6
|
+
# In the development environment your application's code is reloaded on
|
7
|
+
# every request. This slows down response time but is perfect for development
|
8
|
+
# since you don't have to restart the web server when you make code changes.
|
9
|
+
config.cache_classes = false
|
10
|
+
|
11
|
+
# Do not eager load code on boot.
|
12
|
+
config.eager_load = false
|
13
|
+
|
14
|
+
# Show full error reports.
|
15
|
+
config.consider_all_requests_local = true
|
16
|
+
|
17
|
+
# Enable/disable caching. By default caching is disabled.
|
18
|
+
# Run rails dev:cache to toggle caching.
|
19
|
+
if Rails.root.join("tmp/caching-dev.txt").exist?
|
20
|
+
config.action_controller.perform_caching = true
|
21
|
+
|
22
|
+
config.cache_store = :memory_store
|
23
|
+
config.public_file_server.headers = {
|
24
|
+
"Cache-Control" => "public, max-age=#{2.days.to_i}"
|
25
|
+
}
|
26
|
+
else
|
27
|
+
config.action_controller.perform_caching = false
|
28
|
+
|
29
|
+
config.cache_store = :null_store
|
30
|
+
end
|
31
|
+
|
32
|
+
# Store uploaded files on the local file system (see config/storage.yml for options)
|
33
|
+
config.active_storage.service = :local
|
34
|
+
|
35
|
+
# Don't care if the mailer can't send.
|
36
|
+
config.action_mailer.raise_delivery_errors = false
|
37
|
+
|
38
|
+
config.action_mailer.perform_caching = false
|
39
|
+
|
40
|
+
# Print deprecation notices to the Rails logger.
|
41
|
+
config.active_support.deprecation = :log
|
42
|
+
|
43
|
+
# Raise an error on page load if there are pending migrations.
|
44
|
+
config.active_record.migration_error = :page_load
|
45
|
+
|
46
|
+
# Debug mode disables concatenation and preprocessing of assets.
|
47
|
+
# This option may cause significant delays in view rendering with a large
|
48
|
+
# number of complex assets.
|
49
|
+
config.assets.debug = true
|
50
|
+
|
51
|
+
# Suppress logger output for asset requests.
|
52
|
+
config.assets.quiet = true
|
53
|
+
|
54
|
+
# Raises error for missing translations
|
55
|
+
# config.action_view.raise_on_missing_translations = true
|
56
|
+
|
57
|
+
# Use an evented file watcher to asynchronously detect changes in source code,
|
58
|
+
# routes, locales, etc. This feature depends on the listen gem.
|
59
|
+
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
|
60
|
+
|
61
|
+
config.active_job.queue_adapter = :inline
|
62
|
+
|
63
|
+
config.action_view.raise_on_missing_translations = true
|
64
|
+
end
|