cmor_core 0.0.1.pre

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.
Files changed (60) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +28 -0
  4. data/Rakefile +19 -0
  5. data/app/assets/config/cmor_core_manifest.js +2 -0
  6. data/app/assets/javascripts/cmor/core/application.js +13 -0
  7. data/app/assets/javascripts/cmor/core/application/keep.js +0 -0
  8. data/app/assets/javascripts/cmor/core/backend/application.js +13 -0
  9. data/app/assets/javascripts/cmor/core/backend/application/keep.js +0 -0
  10. data/app/assets/javascripts/cmor_core.js +1 -0
  11. data/app/assets/javascripts/cmor_core_backend.js +1 -0
  12. data/app/assets/stylesheets/cmor/core/application.css +4 -0
  13. data/app/assets/stylesheets/cmor/core/application/bootstrap-flex-row.css +35 -0
  14. data/app/assets/stylesheets/cmor/core/application/bottom-margin.css +10 -0
  15. data/app/assets/stylesheets/cmor_core.css +3 -0
  16. data/app/concerns/controller/store_remote_ip_concern.rb +15 -0
  17. data/app/controllers/cmor/core/application_controller.rb +7 -0
  18. data/app/controllers/cmor/core/home_controller.rb +10 -0
  19. data/app/helpers/cmor/core/application_helper.rb +17 -0
  20. data/app/jobs/cmor/core/application_job.rb +6 -0
  21. data/app/mailers/cmor/core/application_mailer.rb +8 -0
  22. data/app/models/cmor/core/application_record.rb +7 -0
  23. data/app/view_helpers/cmor/core/application_view_helper.rb +40 -0
  24. data/app/view_helpers/cmor/core/markup_view_helper.rb +12 -0
  25. data/app/views/cmor/core/backend/active_storage/attachments/_index_table.haml +7 -0
  26. data/app/views/cmor/core/backend/active_storage/blobs/_index_table.haml +15 -0
  27. data/app/views/layouts/cmor/core/application.html.erb +14 -0
  28. data/config/initializers/assets.rb +2 -0
  29. data/config/locales/de.yml +101 -0
  30. data/config/locales/en.yml +102 -0
  31. data/config/routes.rb +5 -0
  32. data/lib/cmor/core.rb +22 -0
  33. data/lib/cmor/core/configuration.rb +16 -0
  34. data/lib/cmor/core/engine.rb +14 -0
  35. data/lib/cmor/core/gemspec.rb +37 -0
  36. data/lib/cmor/core/spec_helpers/feature.rb +30 -0
  37. data/lib/cmor/core/version.rb +7 -0
  38. data/lib/cmor_core.rb +8 -0
  39. data/lib/generators/cmor/core/install/install_generator.rb +30 -0
  40. data/lib/generators/cmor/core/install/templates/frontend_controller.rb +2 -0
  41. data/lib/generators/cmor/core/install/templates/initializer.rb +7 -0
  42. data/lib/generators/cmor/core/install/templates/routes.source +3 -0
  43. data/lib/tasks/cmor_core_tasks.rake +4 -0
  44. data/spec/dummy/app/controllers/frontend_controller.rb +2 -0
  45. data/spec/dummy/config/initializers/cmor_core.rb +7 -0
  46. data/spec/dummy/config/initializers/content_security_policy.rb +25 -0
  47. data/spec/dummy/config/initializers/i18n.rb +2 -0
  48. data/spec/dummy/config/storage.yml +34 -0
  49. data/spec/dummy/db/development.sqlite3 +0 -0
  50. data/spec/dummy/db/migrate/20190325174253_create_active_storage_tables.active_storage.rb +27 -0
  51. data/spec/dummy/db/test.sqlite3 +0 -0
  52. data/spec/dummy/log/development.log +0 -0
  53. data/spec/dummy/tmp/development_secret.txt +1 -0
  54. data/spec/rails_helper.rb +62 -0
  55. data/spec/spec_helper.rb +96 -0
  56. data/spec/support/capybara.rb +1 -0
  57. data/spec/support/factory_bot.rb +5 -0
  58. data/spec/support/rao-shoulda_matchers.rb +5 -0
  59. data/spec/support/shoulda_matchers.rb +8 -0
  60. metadata +395 -0
@@ -0,0 +1,102 @@
1
+ en:
2
+ classes:
3
+ cmor/core/backend/engine: Core
4
+ routes:
5
+ cmor-core-backend-engine: core
6
+ or: or
7
+ activerecord:
8
+ models:
9
+ acts_as_taggable_on/tag:
10
+ one: Tag
11
+ other: Tag
12
+ acts_as_taggable_on/tagging:
13
+ one: Tagging
14
+ other: Tagging
15
+ delayed/backend/active_record/job:
16
+ one: Background job
17
+ other: Background jobs
18
+ i18n/backend/active_record/translation:
19
+ one: Translation
20
+ other: Translations
21
+ delayed/job:
22
+ one: Background job
23
+ other: Background jobs
24
+ active_storage/attachment:
25
+ one: File
26
+ other: Fileŝ
27
+ active_storage/blob:
28
+ one: File content
29
+ other: File contents
30
+ attributes:
31
+ acts_as_taggable_on/tag:
32
+ id: ID
33
+ name: Name
34
+ taggings_count: Taggings
35
+ color: Color
36
+ acts_as_taggable_on/tagging:
37
+ id: ID
38
+ tag: Tag
39
+ tag_id: Tag
40
+ taggable: Taggable object
41
+ taggable_id: Taggable object
42
+ taggable_type: Taggable object type
43
+ tagger: Tagger
44
+ tagger_id: Tagger
45
+ tagger_type: Tagger type
46
+ context: Context
47
+ created_at: Created at
48
+ delayed/backend/active_record/job:
49
+ id: ID
50
+ priority: Priority
51
+ attempts: Attempts
52
+ handler: Handler
53
+ last_error: Last error
54
+ run_at: Run at
55
+ locked_at: Locked at
56
+ failed_at: Failed at
57
+ locked_by: Locked by
58
+ queue: Queue
59
+ created_at: Created at
60
+ updated_at: Updated at
61
+ i18n/backend/active_record/translation:
62
+ id: ID
63
+ locale: Locale
64
+ key: Key
65
+ value: Value
66
+ interpolations: Interpolations
67
+ is_proc: Is proc?
68
+ created_at: Created at
69
+ updated_at: Updated at
70
+ delayed/job:
71
+ id: ID
72
+ priority: Priority
73
+ attempts: Attempts
74
+ handler: Handler
75
+ last_error: Last error
76
+ run_at: Run at
77
+ locked_at: Locked at
78
+ failed_at: Failed at
79
+ locked_by: Locked by
80
+ queue: Queue
81
+ created_at: Created at
82
+ updated_at: Updated at
83
+ active_storage/attachment:
84
+ id: ID
85
+ additional_actions: Additional actions
86
+ name: Name
87
+ record: Record
88
+ record_id: Record
89
+ record_type: Record type
90
+ blob: Blob
91
+ blob_id: Blob
92
+ created_at: Created at
93
+ active_storage/blob:
94
+ id: ID
95
+ additional_actions: Additional actions
96
+ key: Key
97
+ filename: Filename
98
+ content_type: Content type
99
+ metadata: Metadata
100
+ byte_size: Byte size
101
+ checksum: Checksum
102
+ created_at: Created at
data/config/routes.rb ADDED
@@ -0,0 +1,5 @@
1
+ Cmor::Core::Engine.routes.draw do
2
+ # localized do
3
+ # root to: 'home#index'
4
+ # end
5
+ end
data/lib/cmor/core.rb ADDED
@@ -0,0 +1,22 @@
1
+ require "cmor/core/configuration"
2
+ require "cmor/core/engine"
3
+
4
+ module Cmor
5
+ module Core
6
+ extend Configuration
7
+
8
+ module RemoteIpConcern
9
+ extend ActiveSupport::Concern
10
+
11
+ class_methods do
12
+ def remote_ip
13
+ RequestLocals.fetch(:remote_ip) { nil }
14
+ end
15
+ end
16
+ end
17
+
18
+ include RemoteIpConcern
19
+ end
20
+ end
21
+
22
+ Cmor.configure { |c| c.register_configuration(:core, Cmor::Core) }
@@ -0,0 +1,16 @@
1
+ require 'active_support/core_ext/module/delegation'
2
+ require 'active_support/core_ext/module/attribute_accessors'
3
+
4
+ module Cmor
5
+ module Core
6
+ module Configuration
7
+ def configure
8
+ yield self
9
+ end
10
+
11
+ mattr_accessor(:base_controller) { '::FrontendController' }
12
+ mattr_accessor(:markup_languages) { %w[ markdown rdoc textile ] }
13
+ mattr_accessor(:default_markup_language) { 'textile' }
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,14 @@
1
+ module Cmor
2
+ module Core
3
+ class Engine < ::Rails::Engine
4
+ isolate_namespace Cmor::Core
5
+
6
+ config.generators do |g|
7
+ g.test_framework :rspec, fixture: true
8
+ g.fixture_replacement :factory_girl, dir: 'spec/factories'
9
+ # g.form_builder :simple_form
10
+ # g.template_engine :haml
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,37 @@
1
+ module Cmor
2
+ module Core
3
+ class Gemspec
4
+ def self.defaults(s)
5
+ s.version = ::Cmor::VERSION
6
+ s.authors = ["Roberto Vasquez Angel"]
7
+ s.email = ["roberto@vasquez-angel.de"]
8
+ s.homepage = "https://github.com/content-management-on-rails"
9
+ s.license = "MIT"
10
+
11
+ s.files = Dir["{app,config,db,lib,spec}/**/*", "MIT-LICENSE", "Rakefile", "README.md"]
12
+
13
+ s.add_dependency "rails", ">= 5.2.0"
14
+ s.add_dependency "cmor_core", "= #{Cmor::VERSION}"
15
+
16
+ s.add_development_dependency "sqlite3", '~> 1.3.6'
17
+
18
+ s.add_development_dependency 'capybara'
19
+ s.add_development_dependency 'coveralls'
20
+ s.add_development_dependency 'factory_bot_rails'
21
+ s.add_development_dependency 'git_log_generator'
22
+ s.add_development_dependency 'guard-bundler'
23
+ s.add_development_dependency 'guard-rails'
24
+ s.add_development_dependency 'guard-rspec'
25
+ s.add_development_dependency 'pry-rails'
26
+ s.add_development_dependency 'rao-shoulda_matchers'
27
+ s.add_development_dependency 'rails-dummy'
28
+ s.add_development_dependency 'rails-i18n'
29
+ s.add_development_dependency 'rspec-rails'
30
+ s.add_development_dependency 'rubocop'
31
+ s.add_development_dependency 'shoulda-matchers'
32
+ s.add_development_dependency 'simplecov'
33
+ s.add_development_dependency 'simplecov-console'
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,30 @@
1
+ module Cmor
2
+ module Core
3
+ module SpecHelpers
4
+ module Feature
5
+ def sign_in(user)
6
+ visit("/#{I18n.locale}/#{I18n.t('routes.cmor_user_area_engine')}/#{I18n.t('routes.user_session')}/new")
7
+ fill_in 'user_session[email]', with: user.email
8
+ fill_in 'user_session[password]', with: user.password
9
+ click_button(I18n.t('helpers.submit.user_session.create'))
10
+ end
11
+
12
+ def select_date_and_time(date, options = {})
13
+ field = options[:from]
14
+ select I18n.l(date, format: '%Y'), from: "#{field}_1i" #year
15
+ select I18n.l(date, format: '%B'), from: "#{field}_2i" #month
16
+ select I18n.l(date, format: '%-d'), from: "#{field}_3i" #day
17
+ select I18n.l(date, format: '%H'), from: "#{field}_4i" #hour
18
+ select I18n.l(date, format: '%M'), from: "#{field}_5i" #minute
19
+ end
20
+
21
+ def select_date(date, options = {})
22
+ field = options[:from]
23
+ select I18n.l(date, format: '%Y'), from: "#{field}_1i" #year
24
+ select I18n.l(date, format: '%B'), from: "#{field}_2i" #month
25
+ select I18n.l(date, format: '%-d'), from: "#{field}_3i" #day
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,7 @@
1
+ require 'cmor/version'
2
+
3
+ module Cmor
4
+ module Core
5
+ VERSION = ::Cmor::VERSION
6
+ end
7
+ end
data/lib/cmor_core.rb ADDED
@@ -0,0 +1,8 @@
1
+ require 'cmor'
2
+ require 'kaminari'
3
+ require 'bootstrap-kaminari-views'
4
+ require "delayed_job_active_record"
5
+ require "request_store_rails"
6
+ require "route_translator"
7
+
8
+ require "cmor/core"
@@ -0,0 +1,30 @@
1
+ module Cmor
2
+ module Core
3
+ module Generators
4
+ class InstallGenerator < Rails::Generators::Base
5
+ desc 'Installs the initializer, routes and itsf_backend integration'
6
+
7
+ source_root File.expand_path('../templates', __FILE__)
8
+
9
+ attr_reader :base_controller_class_name
10
+
11
+ def initialize(*args)
12
+ super
13
+ @base_controller_class_name = ENV.fetch('BASE_CONTROLLER_CLASS_NAME') { '::ApplicationController' }
14
+ end
15
+
16
+ def generate_controller
17
+ copy_file 'frontend_controller.rb', 'app/controllers/frontend_controller.rb'
18
+ end
19
+
20
+ def generate_initializer
21
+ template 'initializer.rb', 'config/initializers/cmor_core.rb'
22
+ end
23
+
24
+ def generate_routes
25
+ route File.read(File.join(File.expand_path('../templates', __FILE__), 'routes.source'))
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,2 @@
1
+ class FrontendController < ApplicationController
2
+ end
@@ -0,0 +1,7 @@
1
+ Cmor::Core.configure do |config|
2
+ # Set the base controller for the contact form
3
+ #
4
+ # Default: config.base_controller = '<%= base_controller_class_name %>'
5
+ #
6
+ config.base_controller = '<%= base_controller_class_name %>'
7
+ end
@@ -0,0 +1,3 @@
1
+
2
+
3
+ mount Cmor::Core::Engine, at: '/'
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :cmor_core do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,2 @@
1
+ class FrontendController < ApplicationController
2
+ end
@@ -0,0 +1,7 @@
1
+ Cmor::Core.configure do |config|
2
+ # Set the base controller for the contact form
3
+ #
4
+ # Default: config.base_controller = '::ApplicationController'
5
+ #
6
+ config.base_controller = '::ApplicationController'
7
+ end
@@ -0,0 +1,25 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Define an application-wide content security policy
4
+ # For further information see the following documentation
5
+ # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
6
+
7
+ # Rails.application.config.content_security_policy do |policy|
8
+ # policy.default_src :self, :https
9
+ # policy.font_src :self, :https, :data
10
+ # policy.img_src :self, :https, :data
11
+ # policy.object_src :none
12
+ # policy.script_src :self, :https
13
+ # policy.style_src :self, :https
14
+
15
+ # # Specify URI for violation reports
16
+ # # policy.report_uri "/csp-violation-report-endpoint"
17
+ # end
18
+
19
+ # If you are using UJS then enable automatic nonce generation
20
+ # Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
21
+
22
+ # Report CSP violations to a specified URI
23
+ # For further information see the following documentation:
24
+ # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
25
+ # Rails.application.config.content_security_policy_report_only = true
@@ -0,0 +1,2 @@
1
+ Rails.application.config.i18n.available_locales = [:en, :de]
2
+ Rails.application.config.i18n.default_locale = :de
@@ -0,0 +1,34 @@
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
+ # credentials: <%= 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
+ # storage_account_name: your_account_name
28
+ # storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
29
+ # container: your_container_name
30
+
31
+ # mirror:
32
+ # service: Mirror
33
+ # primary: local
34
+ # mirrors: [ amazon, google, microsoft ]
File without changes
@@ -0,0 +1,27 @@
1
+ # This migration comes from active_storage (originally 20170806125915)
2
+ class CreateActiveStorageTables < ActiveRecord::Migration[5.2]
3
+ def change
4
+ create_table :active_storage_blobs do |t|
5
+ t.string :key, null: false
6
+ t.string :filename, null: false
7
+ t.string :content_type
8
+ t.text :metadata
9
+ t.bigint :byte_size, null: false
10
+ t.string :checksum, null: false
11
+ t.datetime :created_at, null: false
12
+
13
+ t.index [ :key ], unique: true
14
+ end
15
+
16
+ create_table :active_storage_attachments do |t|
17
+ t.string :name, null: false
18
+ t.references :record, null: false, polymorphic: true, index: false
19
+ t.references :blob, null: false
20
+
21
+ t.datetime :created_at, null: false
22
+
23
+ t.index [ :record_type, :record_id, :name, :blob_id ], name: "index_active_storage_attachments_uniqueness", unique: true
24
+ t.foreign_key :active_storage_blobs, column: :blob_id
25
+ end
26
+ end
27
+ end
File without changes
File without changes
@@ -0,0 +1 @@
1
+ eb7f62ca57a0b2a835d2a356cc2af6622d7f41a9146523037a6be8326faeded8b627f04be6906fa503260096974b88449863515fe6d2182b8a725e11cdc90504
@@ -0,0 +1,62 @@
1
+ # This file is copied to spec/ when you run 'rails generate rspec:install'
2
+ require 'spec_helper'
3
+ ENV['RAILS_ENV'] ||= 'test'
4
+ require File.expand_path('../dummy/config/environment', __FILE__)
5
+ # Prevent database truncation if the environment is production
6
+ abort("The Rails environment is running in production mode!") if Rails.env.production?
7
+ require 'rspec/rails'
8
+ # Add additional requires below this line. Rails is not loaded until this point!
9
+
10
+ # Requires supporting ruby files with custom matchers and macros, etc, in
11
+ # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
12
+ # run as spec files by default. This means that files in spec/support that end
13
+ # in _spec.rb will both be required and run as specs, causing the specs to be
14
+ # run twice. It is recommended that you do not name files matching this glob to
15
+ # end with _spec.rb. You can configure this pattern with the --pattern
16
+ # option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
17
+ #
18
+ # The following line is provided for convenience purposes. It has the downside
19
+ # of increasing the boot-up time by auto-requiring all files in the support
20
+ # directory. Alternatively, in the individual `*_spec.rb` files, manually
21
+ # require only the support files necessary.
22
+ #
23
+ # Dir[Rails.root.join('spec', 'support', '**', '*.rb')].each { |f| require f }
24
+ Dir[Cmor::Contact::Engine.root.join('spec', 'support', '**', '*.rb')].each { |f| require f }
25
+
26
+ # Checks for pending migrations and applies them before tests are run.
27
+ # If you are not using ActiveRecord, you can remove these lines.
28
+ # begin
29
+ # ActiveRecord::Migration.maintain_test_schema!
30
+ # rescue ActiveRecord::PendingMigrationError => e
31
+ # puts e.to_s.strip
32
+ # exit 1
33
+ # end
34
+ RSpec.configure do |config|
35
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
36
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
37
+
38
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
39
+ # examples within a transaction, remove the following line or assign false
40
+ # instead of true.
41
+ config.use_transactional_fixtures = true
42
+
43
+ # RSpec Rails can automatically mix in different behaviours to your tests
44
+ # based on their file location, for example enabling you to call `get` and
45
+ # `post` in specs under `spec/controllers`.
46
+ #
47
+ # You can disable this behaviour by removing the line below, and instead
48
+ # explicitly tag your specs with their type, e.g.:
49
+ #
50
+ # RSpec.describe UsersController, :type => :controller do
51
+ # # ...
52
+ # end
53
+ #
54
+ # The different available types are documented in the features, such as in
55
+ # https://relishapp.com/rspec/rspec-rails/docs
56
+ config.infer_spec_type_from_file_location!
57
+
58
+ # Filter lines from Rails gems in backtraces.
59
+ config.filter_rails_from_backtrace!
60
+ # arbitrary gems may also be filtered via:
61
+ # config.filter_gems_from_backtrace("gem name")
62
+ end