push_type_api 0.11.2 → 0.12.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/test/controllers/push_type/api/assets_controller_test.rb +6 -6
  3. data/test/controllers/push_type/api/nodes_controller_test.rb +8 -8
  4. data/test/controllers/push_type/api/users_controller_test.rb +3 -3
  5. data/test/dummy/app/assets/javascripts/application.js +1 -0
  6. data/test/dummy/app/controllers/application_controller.rb +0 -1
  7. data/test/dummy/app/views/layouts/application.html.erb +1 -0
  8. data/test/dummy/bin/bundle +1 -1
  9. data/test/dummy/bin/setup +1 -3
  10. data/test/dummy/bin/update +4 -2
  11. data/test/dummy/bin/yarn +3 -3
  12. data/test/dummy/config/cable.yml +1 -1
  13. data/test/dummy/config/credentials.yml.enc +1 -0
  14. data/test/dummy/config/environments/development.rb +9 -2
  15. data/test/dummy/config/environments/production.rb +7 -4
  16. data/test/dummy/config/environments/test.rb +5 -1
  17. data/test/dummy/config/initializers/content_security_policy.rb +25 -0
  18. data/test/dummy/config/initializers/push_type.rb +1 -1
  19. data/test/dummy/config/master.key +1 -0
  20. data/test/dummy/config/puma.rb +1 -23
  21. data/test/dummy/config/spring.rb +2 -2
  22. data/test/dummy/config/storage.yml +34 -0
  23. data/test/dummy/db/migrate/20180416190627_create_active_storage_tables.active_storage.rb +26 -0
  24. data/test/dummy/db/migrate/{20170922151312_create_push_type_users.push_type.rb → 20180416190628_create_push_type_users.push_type.rb} +0 -0
  25. data/test/dummy/db/migrate/{20170922151313_create_push_type_nodes.push_type.rb → 20180416190629_create_push_type_nodes.push_type.rb} +0 -0
  26. data/test/dummy/db/migrate/{20170922151314_create_push_type_node_hierarchies.push_type.rb → 20180416190630_create_push_type_node_hierarchies.push_type.rb} +0 -0
  27. data/test/dummy/db/migrate/{20170922151315_create_push_type_assets.push_type.rb → 20180416190631_create_push_type_assets.push_type.rb} +0 -0
  28. data/test/dummy/db/migrate/{20170922151316_add_field_store_default_values.push_type.rb → 20180416190632_add_field_store_default_values.push_type.rb} +0 -0
  29. data/test/dummy/db/migrate/{20170922151317_drop_legacy_push_type_taxonomies.push_type.rb → 20180416190633_drop_legacy_push_type_taxonomies.push_type.rb} +0 -0
  30. data/test/dummy/db/schema.rb +22 -1
  31. data/test/dummy/log/test.log +3964 -3956
  32. metadata +30 -22
  33. data/test/dummy/config/secrets.yml +0 -32
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c7e77e344001a5753815be0d1146d5fc5e55b492
4
- data.tar.gz: c44507269b7e72fdfcc3db7151a946e0906617b1
3
+ metadata.gz: e28be470267d77019b8b0b0ad3d5fb407c76c0f0
4
+ data.tar.gz: b1adeb447c391cb2b064091ab5f2e614df68d50b
5
5
  SHA512:
6
- metadata.gz: af45497851434e2fde756c3473c3130866fb9be54bd91bf9c668328f70cbfe755ad0cd8989278fb20c38237d9b0916892d7546fc43de659896a6e362b05251e2
7
- data.tar.gz: 92ed7f59d08a9a0070c3dfee1f6dbf55e1a953a3607c412e503d73246bc6649b05f859094cb041901be15a20229894e6cfe928ca670facea8aeadee977fc237f
6
+ metadata.gz: ddcf8f18961462a28c30983cdc794f8d07a2f14c480a65b281bacd13ee1d8474656ca3312b1cdce77e4a438a48cdcdc18d1087f047317338753daded53a7acb3
7
+ data.tar.gz: 24f3ea3eeb5c25a09dfd5f853eef21077540b46b0c99d949b4357d3c817472e110e8a3191815b4b378e106b04ea3992432e232548d30ac44c054fa9235976997
@@ -3,12 +3,12 @@ require 'test_helper'
3
3
  module PushType
4
4
  class Api::AssetsControllerTest < ActionController::TestCase
5
5
 
6
- let(:asset_attrs) { FactoryGirl.attributes_for(:asset) }
7
- let(:asset) { FactoryGirl.create :asset }
6
+ let(:asset_attrs) { FactoryBot.attributes_for(:asset) }
7
+ let(:asset) { FactoryBot.create :asset }
8
8
 
9
9
  describe 'GET #index' do
10
10
  before do
11
- 5.times { FactoryGirl.create :asset }
11
+ 5.times { FactoryBot.create :asset }
12
12
  get :index
13
13
  end
14
14
  it { response.must_respond_with :success }
@@ -19,8 +19,8 @@ module PushType
19
19
 
20
20
  describe 'GET #trash' do
21
21
  before do
22
- 2.times { FactoryGirl.create :asset }
23
- 3.times { FactoryGirl.create :asset, deleted_at: Time.zone.now }
22
+ 2.times { FactoryBot.create :asset }
23
+ 3.times { FactoryBot.create :asset, deleted_at: Time.zone.now }
24
24
  get :trash
25
25
  end
26
26
  it { response.must_respond_with :success }
@@ -92,7 +92,7 @@ module PushType
92
92
 
93
93
  describe 'DELETE #empty' do
94
94
  before do
95
- 3.times { FactoryGirl.create :asset, deleted_at: Time.zone.now }
95
+ 3.times { FactoryBot.create :asset, deleted_at: Time.zone.now }
96
96
  delete :empty
97
97
  end
98
98
  it { response.must_respond_with :no_content }
@@ -4,7 +4,7 @@ module PushType
4
4
  class Api::NodesControllerTest < ActionController::TestCase
5
5
 
6
6
  def node_attrs
7
- FactoryGirl.attributes_for :node, type: 'Page'
7
+ FactoryBot.attributes_for :node, type: 'Page'
8
8
  end
9
9
 
10
10
  let(:node) { Page.create node_attrs }
@@ -32,8 +32,8 @@ module PushType
32
32
 
33
33
  describe 'GET #trash' do
34
34
  before do
35
- 2.times { FactoryGirl.create :node }
36
- 3.times { FactoryGirl.create :node, deleted_at: Time.zone.now }
35
+ 2.times { FactoryBot.create :node }
36
+ 3.times { FactoryBot.create :node, deleted_at: Time.zone.now }
37
37
  get :trash
38
38
  end
39
39
  it { response.must_respond_with :success }
@@ -54,7 +54,7 @@ module PushType
54
54
 
55
55
  describe 'POST #create' do
56
56
  before do
57
- @parent = FactoryGirl.create :node
57
+ @parent = FactoryBot.create :node
58
58
  @count = Page.count
59
59
  end
60
60
  describe 'with in-valid node' do
@@ -111,9 +111,9 @@ module PushType
111
111
 
112
112
  describe 'POST #position' do
113
113
  before do
114
- @first_node = FactoryGirl.create :node
115
- 3.times { FactoryGirl.create :node }
116
- @last_node = FactoryGirl.create :node
114
+ @first_node = FactoryBot.create :node
115
+ 3.times { FactoryBot.create :node }
116
+ @last_node = FactoryBot.create :node
117
117
  end
118
118
  describe 'reordering' do
119
119
  before { post :position, params: { id: @last_node.id, prev: @first_node.id } }
@@ -156,7 +156,7 @@ module PushType
156
156
 
157
157
  describe 'DELETE #empty' do
158
158
  before do
159
- 3.times { FactoryGirl.create :node, deleted_at: Time.zone.now }
159
+ 3.times { FactoryBot.create :node, deleted_at: Time.zone.now }
160
160
  delete :empty
161
161
  end
162
162
  it { response.must_respond_with :no_content }
@@ -3,12 +3,12 @@ require 'test_helper'
3
3
  module PushType
4
4
  class Api::UsersControllerTest < ActionController::TestCase
5
5
 
6
- let(:user_attrs) { FactoryGirl.attributes_for(:user) }
7
- let(:user) { FactoryGirl.create :user }
6
+ let(:user_attrs) { FactoryBot.attributes_for(:user) }
7
+ let(:user) { FactoryBot.create :user }
8
8
 
9
9
  describe 'GET #index' do
10
10
  before do
11
- 5.times { FactoryGirl.create :user }
11
+ 5.times { FactoryBot.create :user }
12
12
  get :index
13
13
  end
14
14
  it { response.must_respond_with :success }
@@ -11,5 +11,6 @@
11
11
  // about supported directives.
12
12
  //
13
13
  //= require rails-ujs
14
+ //= require activestorage
14
15
  //= require turbolinks
15
16
  //= require_tree .
@@ -1,3 +1,2 @@
1
1
  class ApplicationController < ActionController::Base
2
- protect_from_forgery with: :exception
3
2
  end
@@ -3,6 +3,7 @@
3
3
  <head>
4
4
  <title>Dummy</title>
5
5
  <%= csrf_meta_tags %>
6
+ <%= csp_meta_tag %>
6
7
 
7
8
  <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
8
9
  <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env ruby
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
3
3
  load Gem.bin_path('bundler', 'bundle')
data/test/dummy/bin/setup CHANGED
@@ -1,10 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
- require 'pathname'
3
2
  require 'fileutils'
4
3
  include FileUtils
5
4
 
6
5
  # path to your application root.
7
- APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
6
+ APP_ROOT = File.expand_path('..', __dir__)
8
7
 
9
8
  def system!(*args)
10
9
  system(*args) || abort("\n== Command #{args} failed ==")
@@ -21,7 +20,6 @@ chdir APP_ROOT do
21
20
  # Install JavaScript dependencies if using Yarn
22
21
  # system('bin/yarn')
23
22
 
24
-
25
23
  # puts "\n== Copying sample files =="
26
24
  # unless File.exist?('config/database.yml')
27
25
  # cp 'config/database.yml.sample', 'config/database.yml'
@@ -1,10 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
- require 'pathname'
3
2
  require 'fileutils'
4
3
  include FileUtils
5
4
 
6
5
  # path to your application root.
7
- APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
6
+ APP_ROOT = File.expand_path('..', __dir__)
8
7
 
9
8
  def system!(*args)
10
9
  system(*args) || abort("\n== Command #{args} failed ==")
@@ -18,6 +17,9 @@ chdir APP_ROOT do
18
17
  system! 'gem install bundler --conservative'
19
18
  system('bundle check') || system!('bundle install')
20
19
 
20
+ # Install JavaScript dependencies if using Yarn
21
+ # system('bin/yarn')
22
+
21
23
  puts "\n== Updating database =="
22
24
  system! 'bin/rails db:migrate'
23
25
 
data/test/dummy/bin/yarn CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
- VENDOR_PATH = File.expand_path('..', __dir__)
3
- Dir.chdir(VENDOR_PATH) do
2
+ APP_ROOT = File.expand_path('..', __dir__)
3
+ Dir.chdir(APP_ROOT) do
4
4
  begin
5
- exec "yarnpkg #{ARGV.join(" ")}"
5
+ exec "yarnpkg", *ARGV
6
6
  rescue Errno::ENOENT
7
7
  $stderr.puts "Yarn executable was not detected in the system."
8
8
  $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
@@ -6,5 +6,5 @@ test:
6
6
 
7
7
  production:
8
8
  adapter: redis
9
- url: redis://localhost:6379/1
9
+ url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
10
10
  channel_prefix: dummy_production
@@ -0,0 +1 @@
1
+ dFsC3HiVYvwBIe9PWpwiLV9q0SFxdtF6G6sN6p/++3l82AW6lNd/AS7e2zfDuH/wEhpddQ+WvowMpretByjYEGo285c/kFwPyhDQL6uxJJYa2RgAjLXSg0Fj30fyzpkc0qi8o5H1B0n861V1E3EscqvblYZ4kNTtdEm8N+sX5Mg5iY7trlHwYMrwx3o1HpvVkKdprGiNnl4jjlTO5j4t2W4DJpfUOulo1w3G4p/UUtQSnI0nQyZQeBr6FmYEsgV7uD/zoCiXhZas/S9RiHJeUcg+9FKmJHtQWtE6ZnRmdc5i3quDkiSvly9LfyQ22k7Yh2Ct6EG0QapxJiFNYw0H/X2QlPh97vSMeWYU/fxmyjOD5fHj3dDCaqT+EzqrQWTk+JNm0OtkrDUikTE+hzfBgxggShQAZBbNQkDZ--LaFCaDXQKp5Cs1AI--Gj4T+qVTarRPNDkVxvGtBQ==
@@ -13,12 +13,13 @@ Rails.application.configure do
13
13
  config.consider_all_requests_local = true
14
14
 
15
15
  # Enable/disable caching. By default caching is disabled.
16
- if Rails.root.join('tmp/caching-dev.txt').exist?
16
+ # Run rails dev:cache to toggle caching.
17
+ if Rails.root.join('tmp', 'caching-dev.txt').exist?
17
18
  config.action_controller.perform_caching = true
18
19
 
19
20
  config.cache_store = :memory_store
20
21
  config.public_file_server.headers = {
21
- 'Cache-Control' => "public, max-age=#{2.days.seconds.to_i}"
22
+ 'Cache-Control' => "public, max-age=#{2.days.to_i}"
22
23
  }
23
24
  else
24
25
  config.action_controller.perform_caching = false
@@ -26,6 +27,9 @@ Rails.application.configure do
26
27
  config.cache_store = :null_store
27
28
  end
28
29
 
30
+ # Store uploaded files on the local file system (see config/storage.yml for options)
31
+ config.active_storage.service = :local
32
+
29
33
  # Don't care if the mailer can't send.
30
34
  config.action_mailer.raise_delivery_errors = false
31
35
 
@@ -37,6 +41,9 @@ Rails.application.configure do
37
41
  # Raise an error on page load if there are pending migrations.
38
42
  config.active_record.migration_error = :page_load
39
43
 
44
+ # Highlight code that triggered database queries in logs.
45
+ config.active_record.verbose_query_logs = true
46
+
40
47
  # Debug mode disables concatenation and preprocessing of assets.
41
48
  # This option may cause significant delays in view rendering with a large
42
49
  # number of complex assets.
@@ -14,10 +14,9 @@ Rails.application.configure do
14
14
  config.consider_all_requests_local = false
15
15
  config.action_controller.perform_caching = true
16
16
 
17
- # Attempt to read encrypted secrets from `config/secrets.yml.enc`.
18
- # Requires an encryption key in `ENV["RAILS_MASTER_KEY"]` or
19
- # `config/secrets.yml.key`.
20
- config.read_encrypted_secrets = true
17
+ # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
18
+ # or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
19
+ # config.require_master_key = true
21
20
 
22
21
  # Disable serving static files from the `/public` folder by default since
23
22
  # Apache or NGINX already handles this.
@@ -39,6 +38,9 @@ Rails.application.configure do
39
38
  # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
40
39
  # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
41
40
 
41
+ # Store uploaded files on the local file system (see config/storage.yml for options)
42
+ config.active_storage.service = :local
43
+
42
44
  # Mount Action Cable outside main process or domain
43
45
  # config.action_cable.mount_path = nil
44
46
  # config.action_cable.url = 'wss://example.com/cable'
@@ -60,6 +62,7 @@ Rails.application.configure do
60
62
  # Use a real queuing backend for Active Job (and separate queues per environment)
61
63
  # config.active_job.queue_adapter = :resque
62
64
  # config.active_job.queue_name_prefix = "dummy_#{Rails.env}"
65
+
63
66
  config.action_mailer.perform_caching = false
64
67
 
65
68
  # Ignore bad email addresses and do not raise email delivery errors.
@@ -15,7 +15,7 @@ Rails.application.configure do
15
15
  # Configure public file server for tests with Cache-Control for performance.
16
16
  config.public_file_server.enabled = true
17
17
  config.public_file_server.headers = {
18
- 'Cache-Control' => "public, max-age=#{1.hour.seconds.to_i}"
18
+ 'Cache-Control' => "public, max-age=#{1.hour.to_i}"
19
19
  }
20
20
 
21
21
  # Show full error reports and disable caching.
@@ -27,6 +27,10 @@ Rails.application.configure do
27
27
 
28
28
  # Disable request forgery protection in test environment.
29
29
  config.action_controller.allow_forgery_protection = false
30
+
31
+ # Store uploaded files on the local file system in a temporary directory
32
+ config.active_storage.service = :test
33
+
30
34
  config.action_mailer.perform_caching = false
31
35
 
32
36
  # Tell Action Mailer not to deliver emails to the real world.
@@ -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
@@ -45,6 +45,6 @@ PushType.setup do |config|
45
45
  # secret_access_key: ENV['SECRET_ACCESS_KEY_ID']
46
46
  # }
47
47
 
48
- # config.dragonfly_secret = 'f3bec840c74fc35ab9319439cec043e58e833d242bf9c9e0031dc95265141f7a'
48
+ # config.dragonfly_secret = 'efae1a0e8b20519fcb4e35beca398a6cedcc20ccf79efbcdbec9f920ec4ef97d'
49
49
 
50
50
  end
@@ -0,0 +1 @@
1
+ 8dff6462f92fec7a99b54cb5d71dd5be
@@ -26,31 +26,9 @@ environment ENV.fetch("RAILS_ENV") { "development" }
26
26
  # Use the `preload_app!` method when specifying a `workers` number.
27
27
  # This directive tells Puma to first boot the application and load code
28
28
  # before forking the application. This takes advantage of Copy On Write
29
- # process behavior so workers use less memory. If you use this option
30
- # you need to make sure to reconnect any threads in the `on_worker_boot`
31
- # block.
29
+ # process behavior so workers use less memory.
32
30
  #
33
31
  # preload_app!
34
32
 
35
- # If you are preloading your application and using Active Record, it's
36
- # recommended that you close any connections to the database before workers
37
- # are forked to prevent connection leakage.
38
- #
39
- # before_fork do
40
- # ActiveRecord::Base.connection_pool.disconnect! if defined?(ActiveRecord)
41
- # end
42
-
43
- # The code in the `on_worker_boot` will be called if you are using
44
- # clustered mode by specifying a number of `workers`. After each worker
45
- # process is booted, this block will be run. If you are using the `preload_app!`
46
- # option, you will want to use this block to reconnect to any threads
47
- # or connections that may have been created at application boot, as Ruby
48
- # cannot share connections between processes.
49
- #
50
- # on_worker_boot do
51
- # ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
52
- # end
53
- #
54
-
55
33
  # Allow puma to be restarted by `rails restart` command.
56
34
  plugin :tmp_restart
@@ -1,6 +1,6 @@
1
- %w(
1
+ %w[
2
2
  .ruby-version
3
3
  .rbenv-vars
4
4
  tmp/restart.txt
5
5
  tmp/caching-dev.txt
6
- ).each { |path| Spring.watch(path) }
6
+ ].each { |path| Spring.watch(path) }
@@ -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 ]
@@ -0,0 +1,26 @@
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
+ end
25
+ end
26
+ end