push_type_core 0.1.0.beta3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.md +22 -0
- data/README.md +3 -0
- data/app/controllers/push_type/application_controller.rb +4 -0
- data/app/controllers/push_type/front_end_controller.rb +21 -0
- data/app/fields/push_type/date_field.rb +11 -0
- data/app/fields/push_type/number_field.rb +15 -0
- data/app/fields/push_type/rich_text_field.rb +10 -0
- data/app/fields/push_type/string_field.rb +4 -0
- data/app/fields/push_type/text_field.rb +7 -0
- data/app/helpers/push_type/application_helper.rb +4 -0
- data/app/models/concerns/push_type/field_store.rb +56 -0
- data/app/models/concerns/push_type/nestable.rb +23 -0
- data/app/models/concerns/push_type/templatable.rb +33 -0
- data/app/models/concerns/push_type/trashable.rb +23 -0
- data/app/models/push_type/asset.rb +61 -0
- data/app/models/push_type/node.rb +57 -0
- data/app/models/push_type/user.rb +18 -0
- data/app/views/layouts/push_type/application.html.erb +14 -0
- data/config/initializers/dragonfly.rb +24 -0
- data/config/routes.rb +2 -0
- data/db/migrate/20141117170533_create_push_type_users.rb +12 -0
- data/db/migrate/20141117204630_create_push_type_nodes.rb +24 -0
- data/db/migrate/20141117210644_create_push_type_node_hierarchies.rb +16 -0
- data/db/migrate/20141127151930_create_push_type_assets.rb +18 -0
- data/lib/generators/push_type/dummy/dummy_generator.rb +56 -0
- data/lib/generators/push_type/dummy/templates/application.rb +14 -0
- data/lib/generators/push_type/dummy/templates/boot.rb +4 -0
- data/lib/generators/push_type/dummy/templates/page.rb +6 -0
- data/lib/generators/push_type/install/install_generator.rb +28 -0
- data/lib/generators/push_type/install/templates/push_type.rb +5 -0
- data/lib/generators/push_type/node/USAGE +8 -0
- data/lib/generators/push_type/node/node_generator.rb +12 -0
- data/lib/generators/push_type/node/templates/node.rb +10 -0
- data/lib/generators/push_type/node/templates/template.html.erb +3 -0
- data/lib/push_type/core/engine.rb +24 -0
- data/lib/push_type/core.rb +45 -0
- data/lib/push_type/field_type.rb +40 -0
- data/lib/push_type/rails/routes.rb +19 -0
- data/lib/push_type/testing/common_rake.rb +19 -0
- data/lib/push_type/testing/factories.rb +41 -0
- data/lib/push_type/testing/setup.rb +26 -0
- data/lib/push_type/testing/support/expectations.rb +10 -0
- data/lib/push_type_core.rb +1 -0
- data/lib/tasks/push_type_tasks.rake +4 -0
- data/test/controllers/push_type/front_end_controller_test.rb +31 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +16 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/models/page.rb +10 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/app/views/nodes/page.html.erb +3 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/config/application.rb +14 -0
- data/test/dummy/config/boot.rb +4 -0
- data/test/dummy/config/database.yml +85 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +37 -0
- data/test/dummy/config/environments/production.rb +78 -0
- data/test/dummy/config/environments/test.rb +39 -0
- data/test/dummy/config/initializers/assets.rb +8 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/push_type.rb +5 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +59 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/db/migrate/20141205213452_create_push_type_users.push_type.rb +13 -0
- data/test/dummy/db/migrate/20141205213453_create_push_type_nodes.push_type.rb +25 -0
- data/test/dummy/db/migrate/20141205213454_create_push_type_node_hierarchies.push_type.rb +17 -0
- data/test/dummy/db/migrate/20141205213455_create_push_type_assets.push_type.rb +19 -0
- data/test/dummy/db/schema.rb +67 -0
- data/test/dummy/db/seeds.rb +7 -0
- data/test/dummy/log/test.log +1234 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/public/robots.txt +5 -0
- data/test/files/audio.m3u +1 -0
- data/test/files/document.pdf +0 -0
- data/test/files/image.png +0 -0
- data/test/files/video.mp4 +0 -0
- data/test/models/push_type/asset_test.rb +63 -0
- data/test/models/push_type/node_test.rb +87 -0
- data/test/models/push_type/user_test.rb +24 -0
- data/test/test_helper.rb +19 -0
- metadata +293 -0
@@ -0,0 +1,39 @@
|
|
1
|
+
Rails.application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
+
|
4
|
+
# The test environment is used exclusively to run your application's
|
5
|
+
# test suite. You never need to work with it otherwise. Remember that
|
6
|
+
# your test database is "scratch space" for the test suite and is wiped
|
7
|
+
# and recreated between test runs. Don't rely on the data there!
|
8
|
+
config.cache_classes = true
|
9
|
+
|
10
|
+
# Do not eager load code on boot. This avoids loading your whole application
|
11
|
+
# just for the purpose of running a single test. If you are using a tool that
|
12
|
+
# preloads Rails for running tests, you may have to set it to true.
|
13
|
+
config.eager_load = false
|
14
|
+
|
15
|
+
# Configure static asset server for tests with Cache-Control for performance.
|
16
|
+
config.serve_static_assets = true
|
17
|
+
config.static_cache_control = 'public, max-age=3600'
|
18
|
+
|
19
|
+
# Show full error reports and disable caching.
|
20
|
+
config.consider_all_requests_local = true
|
21
|
+
config.action_controller.perform_caching = false
|
22
|
+
|
23
|
+
# Raise exceptions instead of rendering exception templates.
|
24
|
+
config.action_dispatch.show_exceptions = false
|
25
|
+
|
26
|
+
# Disable request forgery protection in test environment.
|
27
|
+
config.action_controller.allow_forgery_protection = false
|
28
|
+
|
29
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
30
|
+
# The :test delivery method accumulates sent emails in the
|
31
|
+
# ActionMailer::Base.deliveries array.
|
32
|
+
config.action_mailer.delivery_method = :test
|
33
|
+
|
34
|
+
# Print deprecation notices to the stderr.
|
35
|
+
config.active_support.deprecation = :stderr
|
36
|
+
|
37
|
+
# Raises error for missing translations
|
38
|
+
# config.action_view.raise_on_missing_translations = true
|
39
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Version of your assets, change this if you want to expire all your assets.
|
4
|
+
Rails.application.config.assets.version = '1.0'
|
5
|
+
|
6
|
+
# Precompile additional assets.
|
7
|
+
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
8
|
+
# Rails.application.config.assets.precompile += %w( search.js )
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
4
|
+
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
5
|
+
|
6
|
+
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
7
|
+
# Rails.backtrace_cleaner.remove_silencers!
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Add new inflection rules using the following format. Inflections
|
4
|
+
# are locale specific, and you may define rules for as many different
|
5
|
+
# locales as you wish. All of these examples are active by default:
|
6
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
7
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
8
|
+
# inflect.singular /^(ox)en/i, '\1'
|
9
|
+
# inflect.irregular 'person', 'people'
|
10
|
+
# inflect.uncountable %w( fish sheep )
|
11
|
+
# end
|
12
|
+
|
13
|
+
# These inflection rules are supported but not enabled by default:
|
14
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
15
|
+
# inflect.acronym 'RESTful'
|
16
|
+
# end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# This file contains settings for ActionController::ParamsWrapper which
|
4
|
+
# is enabled by default.
|
5
|
+
|
6
|
+
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
|
+
ActiveSupport.on_load(:action_controller) do
|
8
|
+
wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
|
9
|
+
end
|
10
|
+
|
11
|
+
# To enable root element in JSON for ActiveRecord objects.
|
12
|
+
# ActiveSupport.on_load(:active_record) do
|
13
|
+
# self.include_root_in_json = true
|
14
|
+
# end
|
@@ -0,0 +1,23 @@
|
|
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
|
+
hello: "Hello world"
|
@@ -0,0 +1,59 @@
|
|
1
|
+
Rails.application.routes.draw do
|
2
|
+
|
3
|
+
mount_push_type
|
4
|
+
|
5
|
+
# The priority is based upon order of creation: first created -> highest priority.
|
6
|
+
# See how all your routes lay out with "rake routes".
|
7
|
+
|
8
|
+
# You can have the root of your site routed with "root"
|
9
|
+
# root 'welcome#index'
|
10
|
+
|
11
|
+
# Example of regular route:
|
12
|
+
# get 'products/:id' => 'catalog#view'
|
13
|
+
|
14
|
+
# Example of named route that can be invoked with purchase_url(id: product.id)
|
15
|
+
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
|
16
|
+
|
17
|
+
# Example resource route (maps HTTP verbs to controller actions automatically):
|
18
|
+
# resources :products
|
19
|
+
|
20
|
+
# Example resource route with options:
|
21
|
+
# resources :products do
|
22
|
+
# member do
|
23
|
+
# get 'short'
|
24
|
+
# post 'toggle'
|
25
|
+
# end
|
26
|
+
#
|
27
|
+
# collection do
|
28
|
+
# get 'sold'
|
29
|
+
# end
|
30
|
+
# end
|
31
|
+
|
32
|
+
# Example resource route with sub-resources:
|
33
|
+
# resources :products do
|
34
|
+
# resources :comments, :sales
|
35
|
+
# resource :seller
|
36
|
+
# end
|
37
|
+
|
38
|
+
# Example resource route with more complex sub-resources:
|
39
|
+
# resources :products do
|
40
|
+
# resources :comments
|
41
|
+
# resources :sales do
|
42
|
+
# get 'recent', on: :collection
|
43
|
+
# end
|
44
|
+
# end
|
45
|
+
|
46
|
+
# Example resource route with concerns:
|
47
|
+
# concern :toggleable do
|
48
|
+
# post 'toggle'
|
49
|
+
# end
|
50
|
+
# resources :posts, concerns: :toggleable
|
51
|
+
# resources :photos, concerns: :toggleable
|
52
|
+
|
53
|
+
# Example resource route within a namespace:
|
54
|
+
# namespace :admin do
|
55
|
+
# # Directs /admin/products/* to Admin::ProductsController
|
56
|
+
# # (app/controllers/admin/products_controller.rb)
|
57
|
+
# resources :products
|
58
|
+
# end
|
59
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key is used for verifying the integrity of signed cookies.
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
5
|
+
|
6
|
+
# Make sure the secret is at least 30 characters and all random,
|
7
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
8
|
+
# You can use `rake secret` to generate a secure secret key.
|
9
|
+
|
10
|
+
# Make sure the secrets in this file are kept private
|
11
|
+
# if you're sharing your code publicly.
|
12
|
+
|
13
|
+
development:
|
14
|
+
secret_key_base: 3a0290ef14a6709a4ddf47900c48071388eeda0043cfa62d5c91bd7ca43b4c67b6d75e8581c2e8f59c8602bec6c02704f464bb595f03d40c41854c09cf750425
|
15
|
+
|
16
|
+
test:
|
17
|
+
secret_key_base: 67677cecd4f711470d4f4d987ce44bafe748709944949b14510c709115e2110a45ab5afdfd35eddc238bd36f5f181528d6923a1c099ac02d1699c2a808e25f51
|
18
|
+
|
19
|
+
# Do not keep production secrets in the repository,
|
20
|
+
# instead read values from the environment.
|
21
|
+
production:
|
22
|
+
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# This migration comes from push_type (originally 20141117170533)
|
2
|
+
class CreatePushTypeUsers < ActiveRecord::Migration
|
3
|
+
def change
|
4
|
+
enable_extension 'uuid-ossp' unless extension_enabled?('uuid-ossp')
|
5
|
+
create_table :push_type_users, id: :uuid, default: 'uuid_generate_v4()' do |t|
|
6
|
+
t.string :name
|
7
|
+
t.string :email
|
8
|
+
t.json :field_store
|
9
|
+
|
10
|
+
t.timestamps
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# This migration comes from push_type (originally 20141117204630)
|
2
|
+
class CreatePushTypeNodes < ActiveRecord::Migration
|
3
|
+
def change
|
4
|
+
enable_extension 'uuid-ossp' unless extension_enabled?('uuid-ossp')
|
5
|
+
create_table :push_type_nodes, id: :uuid, default: 'uuid_generate_v4()' do |t|
|
6
|
+
t.string :type
|
7
|
+
t.string :title
|
8
|
+
t.string :slug
|
9
|
+
t.json :field_store
|
10
|
+
|
11
|
+
t.uuid :parent_id
|
12
|
+
t.integer :sort_order
|
13
|
+
|
14
|
+
t.integer :status
|
15
|
+
t.datetime :published_at
|
16
|
+
t.datetime :published_to
|
17
|
+
|
18
|
+
t.uuid :creator_id
|
19
|
+
t.uuid :updater_id
|
20
|
+
|
21
|
+
t.timestamps
|
22
|
+
t.datetime :deleted_at
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# This migration comes from push_type (originally 20141117210644)
|
2
|
+
class CreatePushTypeNodeHierarchies < ActiveRecord::Migration
|
3
|
+
def change
|
4
|
+
create_table :push_type_node_hierarchies, id: false do |t|
|
5
|
+
t.uuid :ancestor_id, null: false
|
6
|
+
t.uuid :descendant_id, null: false
|
7
|
+
t.integer :generations, null: false
|
8
|
+
end
|
9
|
+
|
10
|
+
add_index :push_type_node_hierarchies, [:ancestor_id, :descendant_id, :generations],
|
11
|
+
unique: true,
|
12
|
+
name: "anc_desc_idx"
|
13
|
+
|
14
|
+
add_index :push_type_node_hierarchies, [:descendant_id],
|
15
|
+
name: "desc_idx"
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# This migration comes from push_type (originally 20141127151930)
|
2
|
+
class CreatePushTypeAssets < ActiveRecord::Migration
|
3
|
+
def change
|
4
|
+
enable_extension 'uuid-ossp' unless extension_enabled?('uuid-ossp')
|
5
|
+
create_table :push_type_assets, id: :uuid, default: 'uuid_generate_v4()' do |t|
|
6
|
+
t.string :file_uid
|
7
|
+
t.string :file_name
|
8
|
+
t.integer :file_size
|
9
|
+
t.string :file_ext
|
10
|
+
t.string :mime_type
|
11
|
+
t.string :description
|
12
|
+
|
13
|
+
t.uuid :uploader_id
|
14
|
+
|
15
|
+
t.timestamps
|
16
|
+
t.datetime :deleted_at
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# This file is auto-generated from the current state of the database. Instead
|
3
|
+
# of editing this file, please use the migrations feature of Active Record to
|
4
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
5
|
+
#
|
6
|
+
# Note that this schema.rb definition is the authoritative source for your
|
7
|
+
# database schema. If you need to create the application database on another
|
8
|
+
# system, you should be using db:schema:load, not running all the migrations
|
9
|
+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
10
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
11
|
+
#
|
12
|
+
# It's strongly recommended that you check this file into your version control system.
|
13
|
+
|
14
|
+
ActiveRecord::Schema.define(version: 20141205213455) do
|
15
|
+
|
16
|
+
# These are extensions that must be enabled in order to support this database
|
17
|
+
enable_extension "plpgsql"
|
18
|
+
enable_extension "uuid-ossp"
|
19
|
+
|
20
|
+
create_table "push_type_assets", id: :uuid, default: "uuid_generate_v4()", force: true do |t|
|
21
|
+
t.string "file_uid"
|
22
|
+
t.string "file_name"
|
23
|
+
t.integer "file_size"
|
24
|
+
t.string "file_ext"
|
25
|
+
t.string "mime_type"
|
26
|
+
t.string "description"
|
27
|
+
t.uuid "uploader_id"
|
28
|
+
t.datetime "created_at"
|
29
|
+
t.datetime "updated_at"
|
30
|
+
t.datetime "deleted_at"
|
31
|
+
end
|
32
|
+
|
33
|
+
create_table "push_type_node_hierarchies", id: false, force: true do |t|
|
34
|
+
t.uuid "ancestor_id", null: false
|
35
|
+
t.uuid "descendant_id", null: false
|
36
|
+
t.integer "generations", null: false
|
37
|
+
end
|
38
|
+
|
39
|
+
add_index "push_type_node_hierarchies", ["ancestor_id", "descendant_id", "generations"], name: "anc_desc_idx", unique: true, using: :btree
|
40
|
+
add_index "push_type_node_hierarchies", ["descendant_id"], name: "desc_idx", using: :btree
|
41
|
+
|
42
|
+
create_table "push_type_nodes", id: :uuid, default: "uuid_generate_v4()", force: true do |t|
|
43
|
+
t.string "type"
|
44
|
+
t.string "title"
|
45
|
+
t.string "slug"
|
46
|
+
t.json "field_store"
|
47
|
+
t.uuid "parent_id"
|
48
|
+
t.integer "sort_order"
|
49
|
+
t.integer "status"
|
50
|
+
t.datetime "published_at"
|
51
|
+
t.datetime "published_to"
|
52
|
+
t.uuid "creator_id"
|
53
|
+
t.uuid "updater_id"
|
54
|
+
t.datetime "created_at"
|
55
|
+
t.datetime "updated_at"
|
56
|
+
t.datetime "deleted_at"
|
57
|
+
end
|
58
|
+
|
59
|
+
create_table "push_type_users", id: :uuid, default: "uuid_generate_v4()", force: true do |t|
|
60
|
+
t.string "name"
|
61
|
+
t.string "email"
|
62
|
+
t.json "field_store"
|
63
|
+
t.datetime "created_at"
|
64
|
+
t.datetime "updated_at"
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# This file should contain all the record creation needed to seed the database with its default values.
|
2
|
+
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
|
3
|
+
#
|
4
|
+
# Examples:
|
5
|
+
#
|
6
|
+
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
|
7
|
+
# Mayor.create(name: 'Emanuel', city: cities.first)
|