comfy_archive 0.1.1
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 +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
@@ -0,0 +1,51 @@
|
|
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
|
+
# The test environment is used exclusively to run your application's
|
7
|
+
# test suite. You never need to work with it otherwise. Remember that
|
8
|
+
# your test database is "scratch space" for the test suite and is wiped
|
9
|
+
# and recreated between test runs. Don't rely on the data there!
|
10
|
+
config.cache_classes = true
|
11
|
+
|
12
|
+
# Do not eager load code on boot. This avoids loading your whole application
|
13
|
+
# just for the purpose of running a single test. If you are using a tool that
|
14
|
+
# preloads Rails for running tests, you may have to set it to true.
|
15
|
+
config.eager_load = false
|
16
|
+
|
17
|
+
# Configure public file server for tests with Cache-Control for performance.
|
18
|
+
config.public_file_server.enabled = true
|
19
|
+
config.public_file_server.headers = {
|
20
|
+
"Cache-Control" => "public, max-age=#{1.hour.to_i}"
|
21
|
+
}
|
22
|
+
|
23
|
+
# Show full error reports and disable caching.
|
24
|
+
config.consider_all_requests_local = true
|
25
|
+
config.action_controller.perform_caching = false
|
26
|
+
|
27
|
+
# Raise exceptions instead of rendering exception templates.
|
28
|
+
config.action_dispatch.show_exceptions = false
|
29
|
+
|
30
|
+
# Disable request forgery protection in test environment.
|
31
|
+
config.action_controller.allow_forgery_protection = false
|
32
|
+
|
33
|
+
# Store uploaded files on the local file system in a temporary directory
|
34
|
+
config.active_storage.service = :test
|
35
|
+
config.action_mailer.perform_caching = false
|
36
|
+
|
37
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
38
|
+
# The :test delivery method accumulates sent emails in the
|
39
|
+
# ActionMailer::Base.deliveries array.
|
40
|
+
config.action_mailer.delivery_method = :test
|
41
|
+
|
42
|
+
# Print deprecation notices to the stderr.
|
43
|
+
config.active_support.deprecation = :stderr
|
44
|
+
|
45
|
+
# Raises error for missing translations
|
46
|
+
# config.action_view.raise_on_missing_translations = true
|
47
|
+
|
48
|
+
config.active_job.queue_adapter = :inline
|
49
|
+
|
50
|
+
config.action_view.raise_on_missing_translations = true
|
51
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# Files in the config/locales directory are used for internationalization
|
2
|
+
# and are automatically loaded by Rails. If you want to use locales other
|
3
|
+
# than English, add the necessary files in this directory.
|
4
|
+
#
|
5
|
+
# To use the locales, use `I18n.t`:
|
6
|
+
#
|
7
|
+
# I18n.t 'hello'
|
8
|
+
#
|
9
|
+
# In views, this is aliased to just `t`:
|
10
|
+
#
|
11
|
+
# <%= t('hello') %>
|
12
|
+
#
|
13
|
+
# To use a different locale, set it with `I18n.locale`:
|
14
|
+
#
|
15
|
+
# I18n.locale = :es
|
16
|
+
#
|
17
|
+
# This would use the information in config/locales/es.yml.
|
18
|
+
#
|
19
|
+
# To learn more, please read the Rails Internationalization guide
|
20
|
+
# available at http://guides.rubyonrails.org/i18n.html.
|
21
|
+
|
22
|
+
en:
|
23
|
+
# ComfyArchive
|
24
|
+
activerecord:
|
25
|
+
models:
|
26
|
+
comfy/archive/index: Post
|
27
|
+
attributes:
|
28
|
+
comfy/archive/index:
|
29
|
+
label: Label
|
30
|
+
datetime_fragment: DateTime Fragment
|
31
|
+
comfy:
|
32
|
+
admin:
|
33
|
+
cms:
|
34
|
+
base:
|
35
|
+
archives: Archives
|
36
|
+
archive:
|
37
|
+
indices:
|
38
|
+
created: Archive Index created
|
39
|
+
create_failure: Failed to create Archive Index
|
40
|
+
updated: Archive Index updated
|
41
|
+
update_failure: Failed to update Archive Index
|
42
|
+
deleted: Archive Index removed
|
43
|
+
not_found: Archive Index not found
|
44
|
+
index:
|
45
|
+
title: Archive Indices
|
46
|
+
new_link: New Archive Index
|
47
|
+
edit: Edit
|
48
|
+
delete: Delete
|
49
|
+
are_you_sure: Are you sure?
|
50
|
+
new:
|
51
|
+
title: New Archive Index
|
52
|
+
edit:
|
53
|
+
title: Edit Archive Index
|
54
|
+
form:
|
55
|
+
create: Create Index
|
56
|
+
update: Update Index
|
57
|
+
cancel: Cancel
|
data/config/storage.yml
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
test:
|
2
|
+
service: Disk
|
3
|
+
root: <%= Rails.root.join("tmp/storage") %>
|
4
|
+
|
5
|
+
local:
|
6
|
+
service: Disk
|
7
|
+
root: <%= Rails.root.join("storage") %>
|
8
|
+
|
9
|
+
# Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
|
10
|
+
# amazon:
|
11
|
+
# service: S3
|
12
|
+
# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
|
13
|
+
# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
|
14
|
+
# region: us-east-1
|
15
|
+
# bucket: your_own_bucket
|
16
|
+
|
17
|
+
# Remember not to checkin your GCS keyfile to a repository
|
18
|
+
# google:
|
19
|
+
# service: GCS
|
20
|
+
# project: your_project
|
21
|
+
# keyfile: <%= Rails.root.join("path/to/gcs.keyfile") %>
|
22
|
+
# bucket: your_own_bucket
|
23
|
+
|
24
|
+
# Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
|
25
|
+
# microsoft:
|
26
|
+
# service: AzureStorage
|
27
|
+
# path: your_azure_storage_path
|
28
|
+
# storage_account_name: your_account_name
|
29
|
+
# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
|
30
|
+
# container: your_container_name
|
31
|
+
|
32
|
+
# mirror:
|
33
|
+
# service: Mirror
|
34
|
+
# primary: local
|
35
|
+
# mirrors: [ amazon, google, microsoft ]
|
data/config.ru
ADDED
@@ -0,0 +1,167 @@
|
|
1
|
+
class CreateCms < ActiveRecord::Migration[5.2]
|
2
|
+
|
3
|
+
LIMIT = 16777215
|
4
|
+
|
5
|
+
def change
|
6
|
+
|
7
|
+
# -- Active Storage --------------------------------------------------------
|
8
|
+
create_table :active_storage_blobs do |t|
|
9
|
+
t.string :key, null: false
|
10
|
+
t.string :filename, null: false
|
11
|
+
t.string :content_type
|
12
|
+
t.text :metadata
|
13
|
+
t.bigint :byte_size, null: false
|
14
|
+
t.string :checksum, null: false
|
15
|
+
t.datetime :created_at, null: false
|
16
|
+
|
17
|
+
t.index [:key], unique: true
|
18
|
+
end
|
19
|
+
|
20
|
+
create_table :active_storage_attachments do |t|
|
21
|
+
t.string :name, null: false
|
22
|
+
t.references :record, null: false, polymorphic: true, index: false
|
23
|
+
t.references :blob, null: false
|
24
|
+
t.datetime :created_at, null: false
|
25
|
+
|
26
|
+
t.index [:record_type, :record_id, :name, :blob_id],
|
27
|
+
name: "index_active_storage_attachments_uniqueness",
|
28
|
+
unique: true
|
29
|
+
end
|
30
|
+
|
31
|
+
# -- Sites -----------------------------------------------------------------
|
32
|
+
create_table :comfy_cms_sites, force: true do |t|
|
33
|
+
t.string :label, null: false
|
34
|
+
t.string :identifier, null: false
|
35
|
+
t.string :hostname, null: false
|
36
|
+
t.string :path
|
37
|
+
t.string :locale, null: false, default: "en"
|
38
|
+
t.timestamps
|
39
|
+
|
40
|
+
t.index :hostname
|
41
|
+
end
|
42
|
+
|
43
|
+
# -- Layouts ---------------------------------------------------------------
|
44
|
+
create_table :comfy_cms_layouts, force: true do |t|
|
45
|
+
t.integer :site_id, null: false
|
46
|
+
t.integer :parent_id
|
47
|
+
t.string :app_layout
|
48
|
+
t.string :label, null: false
|
49
|
+
t.string :identifier, null: false
|
50
|
+
t.text :content, limit: LIMIT
|
51
|
+
t.text :css, limit: LIMIT
|
52
|
+
t.text :js, limit: LIMIT
|
53
|
+
t.integer :position, null: false, default: 0
|
54
|
+
t.timestamps
|
55
|
+
|
56
|
+
t.index [:parent_id, :position]
|
57
|
+
t.index [:site_id, :identifier], unique: true
|
58
|
+
end
|
59
|
+
|
60
|
+
# -- Pages -----------------------------------------------------------------
|
61
|
+
create_table :comfy_cms_pages, force: true do |t|
|
62
|
+
t.integer :site_id, null: false
|
63
|
+
t.integer :layout_id
|
64
|
+
t.integer :parent_id
|
65
|
+
t.integer :target_page_id
|
66
|
+
t.string :label, null: false
|
67
|
+
t.string :slug
|
68
|
+
t.string :full_path, null: false
|
69
|
+
t.text :content_cache, limit: LIMIT
|
70
|
+
t.integer :position, null: false, default: 0
|
71
|
+
t.integer :children_count, null: false, default: 0
|
72
|
+
t.boolean :is_published, null: false, default: true
|
73
|
+
t.timestamps
|
74
|
+
|
75
|
+
t.index [:site_id, :full_path]
|
76
|
+
t.index [:parent_id, :position]
|
77
|
+
t.index [:is_published]
|
78
|
+
end
|
79
|
+
|
80
|
+
# -- Translations ----------------------------------------------------------
|
81
|
+
create_table :comfy_cms_translations, force: true do |t|
|
82
|
+
t.string :locale, null: false
|
83
|
+
t.integer :page_id, null: false
|
84
|
+
t.integer :layout_id
|
85
|
+
t.string :label, null: false
|
86
|
+
t.text :content_cache, limit: LIMIT
|
87
|
+
t.boolean :is_published, null: false, default: true
|
88
|
+
t.timestamps
|
89
|
+
|
90
|
+
t.index [:page_id]
|
91
|
+
t.index [:locale]
|
92
|
+
t.index [:is_published]
|
93
|
+
end
|
94
|
+
|
95
|
+
# -- Fragments -------------------------------------------------------------
|
96
|
+
create_table :comfy_cms_fragments, force: true do |t|
|
97
|
+
t.references :record, polymorphic: true
|
98
|
+
t.string :identifier, null: false
|
99
|
+
t.string :tag, null: false, default: "text"
|
100
|
+
t.text :content, limit: LIMIT
|
101
|
+
t.boolean :boolean, null: false, default: false
|
102
|
+
t.datetime :datetime
|
103
|
+
t.timestamps
|
104
|
+
|
105
|
+
t.index [:identifier]
|
106
|
+
t.index [:datetime]
|
107
|
+
t.index [:boolean]
|
108
|
+
end
|
109
|
+
|
110
|
+
# -- Snippets --------------------------------------------------------------
|
111
|
+
create_table :comfy_cms_snippets, force: true do |t|
|
112
|
+
t.integer :site_id, null: false
|
113
|
+
t.string :label, null: false
|
114
|
+
t.string :identifier, null: false
|
115
|
+
t.text :content, limit: LIMIT
|
116
|
+
t.integer :position, null: false, default: 0
|
117
|
+
t.timestamps
|
118
|
+
|
119
|
+
t.index [:site_id, :identifier], unique: true
|
120
|
+
t.index [:site_id, :position]
|
121
|
+
end
|
122
|
+
|
123
|
+
# -- Files -----------------------------------------------------------------
|
124
|
+
create_table :comfy_cms_files, force: true do |t|
|
125
|
+
t.integer :site_id, null: false
|
126
|
+
t.string :label, null: false, default: ""
|
127
|
+
t.text :description, limit: 2048
|
128
|
+
t.integer :position, null: false, default: 0
|
129
|
+
t.timestamps
|
130
|
+
|
131
|
+
t.index [:site_id, :position]
|
132
|
+
end
|
133
|
+
|
134
|
+
# -- Revisions -------------------------------------------------------------
|
135
|
+
create_table :comfy_cms_revisions, force: true do |t|
|
136
|
+
t.string :record_type, null: false
|
137
|
+
t.integer :record_id, null: false
|
138
|
+
t.text :data, limit: LIMIT
|
139
|
+
t.datetime :created_at
|
140
|
+
|
141
|
+
t.index [:record_type, :record_id, :created_at],
|
142
|
+
name: "index_cms_revisions_on_rtype_and_rid_and_created_at"
|
143
|
+
end
|
144
|
+
|
145
|
+
# -- Categories ------------------------------------------------------------
|
146
|
+
create_table :comfy_cms_categories, force: true do |t|
|
147
|
+
t.integer :site_id, null: false
|
148
|
+
t.string :label, null: false
|
149
|
+
t.string :categorized_type, null: false
|
150
|
+
|
151
|
+
t.index [:site_id, :categorized_type, :label],
|
152
|
+
unique: true,
|
153
|
+
name: "index_cms_categories_on_site_id_and_cat_type_and_label"
|
154
|
+
end
|
155
|
+
|
156
|
+
create_table :comfy_cms_categorizations, force: true do |t|
|
157
|
+
t.integer :category_id, null: false
|
158
|
+
t.string :categorized_type, null: false
|
159
|
+
t.integer :categorized_id, null: false
|
160
|
+
|
161
|
+
t.index [:category_id, :categorized_type, :categorized_id],
|
162
|
+
unique: true,
|
163
|
+
name: "index_cms_categorizations_on_cat_id_and_catd_type_and_catd_id"
|
164
|
+
end
|
165
|
+
|
166
|
+
end
|
167
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class CreateArchive < ActiveRecord::Migration[5.2]
|
2
|
+
def change
|
3
|
+
create_table :comfy_archive_indices do |t|
|
4
|
+
t.integer :site_id, null: false
|
5
|
+
t.string :label, null: false
|
6
|
+
t.string :datetime_fragment, null: false
|
7
|
+
t.integer :page_id, null: false
|
8
|
+
|
9
|
+
t.timestamps
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
#require "rubygems"
|
4
|
+
require "rails"
|
5
|
+
require "comfortable_mexican_sofa"
|
6
|
+
#require "comfy_archive"
|
7
|
+
|
8
|
+
module ComfyArchive
|
9
|
+
|
10
|
+
module CmsSiteExtensions
|
11
|
+
|
12
|
+
extend ActiveSupport::Concern
|
13
|
+
included do
|
14
|
+
has_many :archive_indices,
|
15
|
+
class_name: "Archive::Index",
|
16
|
+
dependent: :destroy
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
module CmsPageExtensions
|
22
|
+
|
23
|
+
extend ActiveSupport::Concern
|
24
|
+
included do
|
25
|
+
scope :chronologically, ->(datetime_fragment) { joins(:fragments).where(comfy_cms_fragments: {identifier: datetime_fragment}).reorder(Arel.sql("`comfy_cms_fragments`.`datetime` DESC")) }
|
26
|
+
scope :for_year, ->(datetime_fragment, year) {
|
27
|
+
case ActiveRecord::Base.connection.adapter_name.downcase.to_sym
|
28
|
+
when :mysql, :mysql2
|
29
|
+
chronologically(datetime_fragment).where("YEAR(comfy_cms_fragments.datetime) = ?", year)
|
30
|
+
when :sqlite
|
31
|
+
chronologically(datetime_fragment).where("strftime('%Y', comfy_cms_fragments.datetime) = ?", year.to_s)
|
32
|
+
else
|
33
|
+
raise NotImplementedError, "Unknown adapter type '#{ActiveRecord::Base.connection.adapter_name}'"
|
34
|
+
end
|
35
|
+
}
|
36
|
+
scope :for_month, ->(datetime_fragment, month) {
|
37
|
+
case ActiveRecord::Base.connection.adapter_name.downcase.to_sym
|
38
|
+
when :mysql, :mysql2
|
39
|
+
chronologically(datetime_fragment).where("MONTH(comfy_cms_fragments.datetime) = ?", month)
|
40
|
+
when :sqlite
|
41
|
+
chronologically(datetime_fragment).where("strftime('%m', comfy_cms_fragments.datetime) = ?", month.to_s)
|
42
|
+
else
|
43
|
+
raise NotImplementedError, "Unknown adapter type '#{ActiveRecord::Base.connection.adapter_name}'"
|
44
|
+
end
|
45
|
+
}
|
46
|
+
|
47
|
+
def published_at(datetime_fragment)
|
48
|
+
self.fragments.where(identifier: datetime_fragment).first.datetime
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
class Engine < ::Rails::Engine
|
55
|
+
|
56
|
+
initializer "comfy_archive.configuration" do
|
57
|
+
ComfortableMexicanSofa::ViewHooks.add(:navigation, "/comfy/admin/archive/partials/navigation")
|
58
|
+
config.to_prepare do
|
59
|
+
Comfy::Cms::Site.send :include, ComfyArchive::CmsSiteExtensions
|
60
|
+
Comfy::Cms::Page.send :include, ComfyArchive::CmsPageExtensions
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class ActionDispatch::Routing::Mapper
|
4
|
+
|
5
|
+
def comfy_route_archive(options = {})
|
6
|
+
scope module: :comfy, as: :comfy do
|
7
|
+
namespace :archive, path: options[:path] do
|
8
|
+
with_options constraints: { year: %r{\d{4}}, month: %r{\d{1,2}} } do |o|
|
9
|
+
o.get "*cms_path/:year", to: "index#index", as: :pages_of_year
|
10
|
+
o.get "*cms_path/:year/:month", to: "index#index", as: :pages_of_month
|
11
|
+
end
|
12
|
+
get "*cms_path/category/:category", to: "index#index", as: :pages_of_category
|
13
|
+
get "(*cms_path)", to: "index#index", as: :render_page, action: "/:format"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class ActionDispatch::Routing::Mapper
|
4
|
+
|
5
|
+
def comfy_route_archive_admin(options = {})
|
6
|
+
options[:path] ||= "admin"
|
7
|
+
path = [options[:path], "sites", ":site_id"].join("/")
|
8
|
+
|
9
|
+
scope module: :comfy, as: :comfy do
|
10
|
+
scope module: :admin do
|
11
|
+
namespace :archive, as: :admin, path: path, except: [:show] do
|
12
|
+
resources :indices, as: :archive_indices, path: "archive-indices" do
|
13
|
+
get :form_fragments, on: :member
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "comfy_archive/version"
|
4
|
+
require_relative "comfy_archive/engine"
|
5
|
+
require_relative "comfy_archive/configuration"
|
6
|
+
require_relative "comfy_archive/routing"
|
7
|
+
|
8
|
+
module ComfyArchive
|
9
|
+
|
10
|
+
class << self
|
11
|
+
|
12
|
+
# Modify Archive configuration
|
13
|
+
# Example:
|
14
|
+
# ComfyArchive.configure do |config|
|
15
|
+
# config.posts_per_page = 5
|
16
|
+
# end
|
17
|
+
def configure
|
18
|
+
yield configuration
|
19
|
+
end
|
20
|
+
|
21
|
+
# Accessor for ComfyArchive::Configuration
|
22
|
+
def configuration
|
23
|
+
@configuration ||= ComfyArchive::Configuration.new
|
24
|
+
end
|
25
|
+
alias config configuration
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
_____ __ _ _
|
2
|
+
/ ____| / _| /\ | | (_)
|
3
|
+
| | ___ _ __ ___ | |_ _ _ / \ _ __ ___| |__ ___ _____
|
4
|
+
| | / _ \| '_ ` _ \| _| | | | / /\ \ | '__/ __| '_ \| \ \ / / _ \
|
5
|
+
| |___| (_) | | | | | | | | |_| |/ ____ \| | | (__| | | | |\ V / __/
|
6
|
+
\_____\___/|_| |_| |_|_| \__, /_/ \_\_| \___|_| |_|_| \_/ \___|
|
7
|
+
__/ |
|
8
|
+
|___/
|
9
|
+
|
10
|
+
Hey! Everything is almost done. Please don't forget to
|
11
|
+
|
12
|
+
* run migrations -> `rake db:migrate`
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rails/generators/active_record"
|
4
|
+
|
5
|
+
module Comfy
|
6
|
+
module Generators
|
7
|
+
class ArchiveGenerator < Rails::Generators::Base
|
8
|
+
|
9
|
+
include Rails::Generators::Migration
|
10
|
+
include Thor::Actions
|
11
|
+
|
12
|
+
source_root File.expand_path("../../../..", __dir__)
|
13
|
+
|
14
|
+
def self.next_migration_number(dirname)
|
15
|
+
ActiveRecord::Generators::Base.next_migration_number(dirname)
|
16
|
+
end
|
17
|
+
|
18
|
+
def generate_migration
|
19
|
+
destination = File.expand_path("db/migrate/01_create_archive.rb", destination_root)
|
20
|
+
migration_dir = File.dirname(destination)
|
21
|
+
destination = self.class.migration_exists?(migration_dir, "create_archive")
|
22
|
+
|
23
|
+
if destination
|
24
|
+
puts "\e[0m\e[31mFound existing create_archive migration. Remove it if you want to regenerate.\e[0m"
|
25
|
+
else
|
26
|
+
migration_template "db/migrate/01_create_archive.rb", "db/migrate/create_archive.rb"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def generate_initialization
|
31
|
+
copy_file "config/initializers/comfy_archive.rb",
|
32
|
+
"config/initializers/comfy_archive.rb"
|
33
|
+
end
|
34
|
+
|
35
|
+
def generate_routing
|
36
|
+
route_string = <<-RUBY.strip_heredoc
|
37
|
+
comfy_route :archive_admin
|
38
|
+
comfy_route :archive
|
39
|
+
RUBY
|
40
|
+
route route_string
|
41
|
+
end
|
42
|
+
|
43
|
+
def generate_views
|
44
|
+
directory "app/views/comfy/archive", "app/views/comfy/archive"
|
45
|
+
end
|
46
|
+
|
47
|
+
def show_readme
|
48
|
+
readme "lib/generators/comfy/archive/README"
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
metadata
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: comfy_archive
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Morgan Aldridge
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-11-29 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: comfortable_mexican_sofa
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.0.14
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.0.14
|
27
|
+
description: Chronological Archives Engine for ComfortableMexicanSofa
|
28
|
+
email:
|
29
|
+
- morgan@discoverymap.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- ".gitignore"
|
35
|
+
- Gemfile
|
36
|
+
- LICENSE
|
37
|
+
- README.md
|
38
|
+
- Rakefile
|
39
|
+
- app/assets/config/manifest.js
|
40
|
+
- app/controllers/comfy/admin/archive/indices_controller.rb
|
41
|
+
- app/controllers/comfy/archive/index_controller.rb
|
42
|
+
- app/models/comfy/archive/index.rb
|
43
|
+
- app/views/comfy/admin/archive/indices/_form.html.haml
|
44
|
+
- app/views/comfy/admin/archive/indices/edit.html.haml
|
45
|
+
- app/views/comfy/admin/archive/indices/index.html.haml
|
46
|
+
- app/views/comfy/admin/archive/indices/new.html.haml
|
47
|
+
- app/views/comfy/admin/archive/partials/_navigation.html.haml
|
48
|
+
- app/views/comfy/archive/index/index.html.haml
|
49
|
+
- bin/bundle
|
50
|
+
- bin/rails
|
51
|
+
- bin/rake
|
52
|
+
- bin/setup
|
53
|
+
- bin/update
|
54
|
+
- bin/yarn
|
55
|
+
- comfy_archive.gemspec
|
56
|
+
- config.ru
|
57
|
+
- config/application.rb
|
58
|
+
- config/archive_routes.rb
|
59
|
+
- config/boot.rb
|
60
|
+
- config/database.yml
|
61
|
+
- config/environment.rb
|
62
|
+
- config/environments/development.rb
|
63
|
+
- config/environments/test.rb
|
64
|
+
- config/initializers/comfy_archive.rb
|
65
|
+
- config/locales/en.yml
|
66
|
+
- config/storage.yml
|
67
|
+
- db/migrate/00_create_cms.rb
|
68
|
+
- db/migrate/01_create_archive.rb
|
69
|
+
- lib/comfy_archive.rb
|
70
|
+
- lib/comfy_archive/configuration.rb
|
71
|
+
- lib/comfy_archive/engine.rb
|
72
|
+
- lib/comfy_archive/routes/archive.rb
|
73
|
+
- lib/comfy_archive/routes/archive_admin.rb
|
74
|
+
- lib/comfy_archive/routing.rb
|
75
|
+
- lib/comfy_archive/version.rb
|
76
|
+
- lib/generators/comfy/archive/README
|
77
|
+
- lib/generators/comfy/archive/archive_generator.rb
|
78
|
+
homepage: http://github.com/discoverymap/comfy-archive
|
79
|
+
licenses:
|
80
|
+
- MIT
|
81
|
+
metadata: {}
|
82
|
+
post_install_message:
|
83
|
+
rdoc_options: []
|
84
|
+
require_paths:
|
85
|
+
- lib
|
86
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: 2.3.0
|
91
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
requirements: []
|
97
|
+
rubygems_version: 3.0.3
|
98
|
+
signing_key:
|
99
|
+
specification_version: 4
|
100
|
+
summary: Chronological Archives Engine for ComfortableMexicanSofa
|
101
|
+
test_files: []
|