push_type_api 0.10.0.beta.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.md +20 -0
  3. data/README.md +28 -0
  4. data/app/controllers/push_type/api/assets_controller.rb +72 -0
  5. data/app/controllers/push_type/api/nodes_controller.rb +108 -0
  6. data/app/controllers/push_type/api/users_controller.rb +67 -0
  7. data/app/controllers/push_type/api_controller.rb +13 -0
  8. data/app/helpers/push_type/api_helper.rb +4 -0
  9. data/app/views/push_type/api/assets/_asset.json.jbuilder +9 -0
  10. data/app/views/push_type/api/assets/index.json.jbuilder +12 -0
  11. data/app/views/push_type/api/assets/show.json.jbuilder +3 -0
  12. data/app/views/push_type/api/nodes/_node.json.jbuilder +13 -0
  13. data/app/views/push_type/api/nodes/index.json.jbuilder +11 -0
  14. data/app/views/push_type/api/nodes/show.json.jbuilder +17 -0
  15. data/app/views/push_type/api/shared/_pagination.json.jbuilder +5 -0
  16. data/app/views/push_type/api/users/_user.json.jbuilder +5 -0
  17. data/app/views/push_type/api/users/index.json.jbuilder +7 -0
  18. data/app/views/push_type/api/users/show.json.jbuilder +16 -0
  19. data/config/routes.rb +31 -0
  20. data/lib/push_type/api/engine.rb +15 -0
  21. data/lib/push_type/api.rb +12 -0
  22. data/lib/push_type_api.rb +1 -0
  23. data/lib/tasks/api_tasks.rake +4 -0
  24. data/test/controllers/push_type/api/assets_controller_test.rb +104 -0
  25. data/test/controllers/push_type/api/nodes_controller_test.rb +168 -0
  26. data/test/controllers/push_type/api/users_controller_test.rb +67 -0
  27. data/test/dummy/README.md +24 -0
  28. data/test/dummy/Rakefile +6 -0
  29. data/test/dummy/app/assets/config/manifest.js +3 -0
  30. data/test/dummy/app/assets/javascripts/application.js +16 -0
  31. data/test/dummy/app/assets/javascripts/cable.js +13 -0
  32. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  33. data/test/dummy/app/channels/application_cable/channel.rb +4 -0
  34. data/test/dummy/app/channels/application_cable/connection.rb +4 -0
  35. data/test/dummy/app/controllers/application_controller.rb +3 -0
  36. data/test/dummy/app/helpers/application_helper.rb +2 -0
  37. data/test/dummy/app/jobs/application_job.rb +2 -0
  38. data/test/dummy/app/mailers/application_mailer.rb +4 -0
  39. data/test/dummy/app/models/application_record.rb +3 -0
  40. data/test/dummy/app/models/location.rb +6 -0
  41. data/test/dummy/app/models/page.rb +11 -0
  42. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  43. data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
  44. data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
  45. data/test/dummy/app/views/nodes/page.html.erb +5 -0
  46. data/test/dummy/bin/bundle +3 -0
  47. data/test/dummy/bin/rails +4 -0
  48. data/test/dummy/bin/rake +4 -0
  49. data/test/dummy/bin/setup +34 -0
  50. data/test/dummy/bin/update +29 -0
  51. data/test/dummy/config/application.rb +14 -0
  52. data/test/dummy/config/boot.rb +4 -0
  53. data/test/dummy/config/cable.yml +9 -0
  54. data/test/dummy/config/database.yml +85 -0
  55. data/test/dummy/config/environment.rb +5 -0
  56. data/test/dummy/config/environments/development.rb +54 -0
  57. data/test/dummy/config/environments/production.rb +86 -0
  58. data/test/dummy/config/environments/test.rb +42 -0
  59. data/test/dummy/config/initializers/application_controller_renderer.rb +6 -0
  60. data/test/dummy/config/initializers/assets.rb +11 -0
  61. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  62. data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
  63. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  64. data/test/dummy/config/initializers/inflections.rb +16 -0
  65. data/test/dummy/config/initializers/mime_types.rb +4 -0
  66. data/test/dummy/config/initializers/new_framework_defaults.rb +24 -0
  67. data/test/dummy/config/initializers/push_type.rb +50 -0
  68. data/test/dummy/config/initializers/session_store.rb +3 -0
  69. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  70. data/test/dummy/config/locales/en.yml +23 -0
  71. data/test/dummy/config/puma.rb +47 -0
  72. data/test/dummy/config/routes.rb +15 -0
  73. data/test/dummy/config/secrets.yml +22 -0
  74. data/test/dummy/config/spring.rb +6 -0
  75. data/test/dummy/config.ru +5 -0
  76. data/test/dummy/db/migrate/20161116222825_create_push_type_users.push_type.rb +13 -0
  77. data/test/dummy/db/migrate/20161116222826_create_push_type_nodes.push_type.rb +25 -0
  78. data/test/dummy/db/migrate/20161116222827_create_push_type_node_hierarchies.push_type.rb +17 -0
  79. data/test/dummy/db/migrate/20161116222828_create_push_type_assets.push_type.rb +19 -0
  80. data/test/dummy/db/migrate/20161116222829_add_field_store_default_values.push_type.rb +7 -0
  81. data/test/dummy/db/migrate/20161116222830_drop_legacy_push_type_taxonomies.push_type.rb +14 -0
  82. data/test/dummy/db/schema.rb +65 -0
  83. data/test/dummy/db/seeds.rb +7 -0
  84. data/test/dummy/log/test.log +5968 -0
  85. data/test/dummy/public/404.html +67 -0
  86. data/test/dummy/public/422.html +67 -0
  87. data/test/dummy/public/500.html +66 -0
  88. data/test/dummy/public/apple-touch-icon-precomposed.png +0 -0
  89. data/test/dummy/public/apple-touch-icon.png +0 -0
  90. data/test/dummy/public/favicon.ico +0 -0
  91. data/test/dummy/public/robots.txt +5 -0
  92. data/test/lib/push_type/api_test.rb +11 -0
  93. data/test/test_helper.rb +23 -0
  94. metadata +249 -0
@@ -0,0 +1,168 @@
1
+ require 'test_helper'
2
+
3
+ module PushType
4
+ class Api::NodesControllerTest < ActionController::TestCase
5
+
6
+ def node_attrs
7
+ FactoryGirl.attributes_for :node, type: 'Page'
8
+ end
9
+
10
+ let(:node) { Page.create node_attrs }
11
+
12
+ describe 'GET #index' do
13
+ before :all do
14
+ @parent = Page.create node_attrs
15
+ 5.times { Page.create node_attrs.merge(parent_id: @parent.id) }
16
+ end
17
+ describe 'with no scope' do
18
+ before { get :index }
19
+ it { response.must_respond_with :success }
20
+ it { json_response['nodes'].size.must_equal 1 }
21
+ it { json_response['meta'].must_be :present? }
22
+ it { json_response['meta']['current_page'].must_equal 1 }
23
+ it { json_response['meta']['child_nodes'].must_be_instance_of Array }
24
+ it { json_response['meta']['child_nodes'].must_include 'page' }
25
+ end
26
+ describe 'with parent scope' do
27
+ before { get :index, params: { node_id: @parent.id } }
28
+ it { response.must_respond_with :success }
29
+ it { json_response['nodes'].size.must_equal 5 }
30
+ end
31
+ end
32
+
33
+ describe 'GET #trash' do
34
+ before do
35
+ 2.times { FactoryGirl.create :node }
36
+ 3.times { FactoryGirl.create :node, deleted_at: Time.zone.now }
37
+ get :trash
38
+ end
39
+ it { response.must_respond_with :success }
40
+ it { json_response['nodes'].size.must_equal 3 }
41
+ it { json_response['meta'].must_be :present? }
42
+ end
43
+
44
+ describe 'GET #show' do
45
+ before { get :show, params: { id: node.id } }
46
+ it { response.must_respond_with :success }
47
+ it { json_response['node'].must_be :present? }
48
+ it { json_response['node']['id'].must_equal node.id }
49
+ it { json_response['meta'].must_be :present? }
50
+ it { json_response['meta']['fields'].must_be_instance_of Array }
51
+ it { json_response['meta']['child_nodes'].must_be_instance_of Array }
52
+ it { json_response['meta']['child_nodes'].must_include 'page' }
53
+ end
54
+
55
+ describe 'POST #create' do
56
+ before do
57
+ @parent = FactoryGirl.create :node
58
+ @count = Page.count
59
+ end
60
+ describe 'with in-valid node' do
61
+ before { post :create, params: { node: {} } }
62
+ it { response.must_respond_with :unprocessable_entity }
63
+ it { json_response['errors'].must_be :present? }
64
+ end
65
+ describe 'with valid node' do
66
+ before { post :create, params: { node: node_attrs } }
67
+ it { response.must_respond_with :created }
68
+ it { json_response['node'].must_be :present? }
69
+ it { json_response['node']['parent_id'].must_be :blank? }
70
+ it { Page.count.must_equal @count + 1 }
71
+ end
72
+ describe 'with parent_scope' do
73
+ before { post :create, params: { node: node_attrs.merge(parent_id: @parent.id) } }
74
+ it { json_response['node']['parent_id'].must_equal @parent.id }
75
+ end
76
+ end
77
+
78
+ describe 'PUT #update' do
79
+ before { put :update, params: { id: node.id, node: { title: new_title } } }
80
+ describe 'with in-valid node' do
81
+ let(:new_title) { '' }
82
+ it { response.must_respond_with :unprocessable_entity }
83
+ it { json_response['errors']['title'].must_be :present? }
84
+ end
85
+ describe 'with valid node' do
86
+ let(:new_title) { 'Foo bar baz' }
87
+ it { response.must_respond_with :ok }
88
+ it { json_response['node'].must_be :present? }
89
+ it { json_response['node']['title'].must_equal new_title }
90
+ end
91
+ end
92
+
93
+ describe 'DELETE #destroy' do
94
+ describe 'with untrashed node' do
95
+ before { delete :destroy, params: { id: node.id } }
96
+ it { response.must_respond_with :ok }
97
+ it { json_response['node'].must_be :present? }
98
+ it { json_response['node']['is_trashed'].must_equal true }
99
+ it { node.reload.must_be :trashed? }
100
+ end
101
+ describe 'with trashed node' do
102
+ before do
103
+ node.trash!
104
+ delete :destroy, params: { id: node.id }
105
+ end
106
+ it { response.must_respond_with :no_content }
107
+ it { response.body.must_be :blank? }
108
+ it { proc { node.reload }.must_raise ActiveRecord::RecordNotFound }
109
+ end
110
+ end
111
+
112
+ describe 'POST #position' do
113
+ before do
114
+ @first_node = FactoryGirl.create :node
115
+ 3.times { FactoryGirl.create :node }
116
+ @last_node = FactoryGirl.create :node
117
+ end
118
+ describe 'reordering' do
119
+ before { post :position, params: { id: @last_node.id, prev: @first_node.id } }
120
+ it { response.must_respond_with :no_content }
121
+ it { response.body.must_be :blank? }
122
+ end
123
+ describe 'without reponsitioning' do
124
+ before { get :index }
125
+ it { json_response['nodes'][0]['id'].must_equal @first_node.id }
126
+ it { json_response['nodes'][-1]['id'].must_equal @last_node.id }
127
+ end
128
+ describe 'append node' do
129
+ before do
130
+ post :position, params: { id: @last_node.id, prev: @first_node.id }
131
+ get :index
132
+ end
133
+ it { json_response['nodes'][0]['id'].must_equal @first_node.id }
134
+ it { json_response['nodes'][1]['id'].must_equal @last_node.id }
135
+ end
136
+ describe 'prepend node' do
137
+ before do
138
+ post :position, params: { id: @last_node.id, next: @first_node.id }
139
+ get :index
140
+ end
141
+ it { json_response['nodes'][1]['id'].must_equal @first_node.id }
142
+ it { json_response['nodes'][0]['id'].must_equal @last_node.id }
143
+ end
144
+ end
145
+
146
+ describe 'PUT #restore' do
147
+ before do
148
+ node.trash!
149
+ put :restore, params: { id: node.id }
150
+ end
151
+ it { response.must_respond_with :ok }
152
+ it { json_response['node'].must_be :present? }
153
+ it { json_response['node']['is_trashed'].must_equal false }
154
+ it { node.reload.wont_be :trashed? }
155
+ end
156
+
157
+ describe 'DELETE #empty' do
158
+ before do
159
+ 3.times { FactoryGirl.create :node, deleted_at: Time.zone.now }
160
+ delete :empty
161
+ end
162
+ it { response.must_respond_with :no_content }
163
+ it { response.body.must_be :blank? }
164
+ it { PushType::Node.trashed.must_be :empty? }
165
+ end
166
+
167
+ end
168
+ end
@@ -0,0 +1,67 @@
1
+ require 'test_helper'
2
+
3
+ module PushType
4
+ class Api::UsersControllerTest < ActionController::TestCase
5
+
6
+ let(:user_attrs) { FactoryGirl.attributes_for(:user) }
7
+ let(:user) { FactoryGirl.create :user }
8
+
9
+ describe 'GET #index' do
10
+ before do
11
+ 5.times { FactoryGirl.create :user }
12
+ get :index
13
+ end
14
+ it { response.must_respond_with :success }
15
+ it { json_response['users'].size.must_equal 5 }
16
+ it { json_response['meta'].must_be :present? }
17
+ it { json_response['meta']['current_page'].must_equal 1 }
18
+ end
19
+
20
+ describe 'GET #show' do
21
+ before { get :show, params: { id: user.id } }
22
+ it { response.must_respond_with :success }
23
+ it { json_response['user'].must_be :present? }
24
+ it { json_response['user']['id'].must_equal user.id }
25
+ it { json_response['meta'].must_be :present? }
26
+ it { json_response['meta']['fields'].must_be_instance_of Array }
27
+ end
28
+
29
+ describe 'POST #create' do
30
+ before { @count = Asset.count }
31
+ describe 'with in-valid user' do
32
+ before { post :create, params: { user: {} } }
33
+ it { response.must_respond_with :unprocessable_entity }
34
+ it { json_response['errors'].must_be :present? }
35
+ end
36
+ describe 'with valid user' do
37
+ before { post :create, params: { user: user_attrs } }
38
+ it { response.must_respond_with :created }
39
+ it { json_response['user'].must_be :present? }
40
+ it { User.count.must_equal @count + 1 }
41
+ end
42
+ end
43
+
44
+ describe 'PUT #update' do
45
+ before { put :update, params: { id: user.id, user: { name: new_name } } }
46
+ describe 'with in-valid user' do
47
+ let(:new_name) { '' }
48
+ it { response.must_respond_with :unprocessable_entity }
49
+ it { json_response['errors']['name'].must_be :present? }
50
+ end
51
+ describe 'with valid user' do
52
+ let(:new_name) { 'Foo bar baz' }
53
+ it { response.must_respond_with :ok }
54
+ it { json_response['user'].must_be :present? }
55
+ it { json_response['user']['name'].must_equal new_name }
56
+ end
57
+ end
58
+
59
+ describe 'DELETE #destroy' do
60
+ before { delete :destroy, params: { id: user.id } }
61
+ it { response.must_respond_with :no_content }
62
+ it { response.body.must_be :blank? }
63
+ it { proc { user.reload }.must_raise ActiveRecord::RecordNotFound }
64
+ end
65
+
66
+ end
67
+ end
@@ -0,0 +1,24 @@
1
+ # README
2
+
3
+ This README would normally document whatever steps are necessary to get the
4
+ application up and running.
5
+
6
+ Things you may want to cover:
7
+
8
+ * Ruby version
9
+
10
+ * System dependencies
11
+
12
+ * Configuration
13
+
14
+ * Database creation
15
+
16
+ * Database initialization
17
+
18
+ * How to run the test suite
19
+
20
+ * Services (job queues, cache servers, search engines, etc.)
21
+
22
+ * Deployment instructions
23
+
24
+ * ...
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require_relative 'config/application'
5
+
6
+ Rails.application.load_tasks
@@ -0,0 +1,3 @@
1
+ //= link_tree ../images
2
+ //= link_directory ../javascripts .js
3
+ //= link_directory ../stylesheets .css
@@ -0,0 +1,16 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file. JavaScript code in this file should be added after the last require_* statement.
9
+ //
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require turbolinks
16
+ //= require_tree .
@@ -0,0 +1,13 @@
1
+ // Action Cable provides the framework to deal with WebSockets in Rails.
2
+ // You can generate new channels where WebSocket features live using the rails generate channel command.
3
+ //
4
+ //= require action_cable
5
+ //= require_self
6
+ //= require_tree ./channels
7
+
8
+ (function() {
9
+ this.App || (this.App = {});
10
+
11
+ App.cable = ActionCable.createConsumer();
12
+
13
+ }).call(this);
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
+ * files in this directory. Styles in this file should be added after the last require_* statement.
11
+ * It is generally better to create a new file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,4 @@
1
+ module ApplicationCable
2
+ class Channel < ActionCable::Channel::Base
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module ApplicationCable
2
+ class Connection < ActionCable::Connection::Base
3
+ end
4
+ end
@@ -0,0 +1,3 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery with: :exception
3
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ class ApplicationJob < ActiveJob::Base
2
+ end
@@ -0,0 +1,4 @@
1
+ class ApplicationMailer < ActionMailer::Base
2
+ default from: 'from@example.com'
3
+ layout 'mailer'
4
+ end
@@ -0,0 +1,3 @@
1
+ class ApplicationRecord < ActiveRecord::Base
2
+ self.abstract_class = true
3
+ end
@@ -0,0 +1,6 @@
1
+ class Location < PushType::Structure
2
+
3
+ # Model the content by adding custom fields to the structure.
4
+ # field :body, :text, validates: { presence: true }
5
+
6
+ end
@@ -0,0 +1,11 @@
1
+ class Page < PushType::Node
2
+
3
+ # By default a node can have children of any other node type.
4
+ # Optionally pass a list of acceptable node types or prevent
5
+ # any descendents by passing false.
6
+ has_child_nodes :all
7
+
8
+ # Model the content by adding custom fields to the node.
9
+ # field :body, :text, validates: { presence: true }
10
+
11
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= csrf_meta_tags %>
6
+
7
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
8
+ <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
9
+ </head>
10
+
11
+ <body>
12
+ <%= yield %>
13
+ </body>
14
+ </html>
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
+ <style>
6
+ /* Email styles need to be inline */
7
+ </style>
8
+ </head>
9
+
10
+ <body>
11
+ <%= yield %>
12
+ </body>
13
+ </html>
@@ -0,0 +1 @@
1
+ <%= yield %>
@@ -0,0 +1,5 @@
1
+ <h1><%= @node.title %></h1>
2
+ <p>This is a generated Page template.</p>
3
+ <p>Find me at: app/views/nodes/page.html.erb</p>
4
+
5
+
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+ load Gem.bin_path('bundler', 'bundle')
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path('../config/application', __dir__)
3
+ require_relative '../config/boot'
4
+ require 'rails/commands'
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../config/boot'
3
+ require 'rake'
4
+ Rake.application.run
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env ruby
2
+ require 'pathname'
3
+ require 'fileutils'
4
+ include FileUtils
5
+
6
+ # path to your application root.
7
+ APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
8
+
9
+ def system!(*args)
10
+ system(*args) || abort("\n== Command #{args} failed ==")
11
+ end
12
+
13
+ chdir APP_ROOT do
14
+ # This script is a starting point to setup your application.
15
+ # Add necessary setup steps to this file.
16
+
17
+ puts '== Installing dependencies =='
18
+ system! 'gem install bundler --conservative'
19
+ system('bundle check') || system!('bundle install')
20
+
21
+ # puts "\n== Copying sample files =="
22
+ # unless File.exist?('config/database.yml')
23
+ # cp 'config/database.yml.sample', 'config/database.yml'
24
+ # end
25
+
26
+ puts "\n== Preparing database =="
27
+ system! 'bin/rails db:setup'
28
+
29
+ puts "\n== Removing old logs and tempfiles =="
30
+ system! 'bin/rails log:clear tmp:clear'
31
+
32
+ puts "\n== Restarting application server =="
33
+ system! 'bin/rails restart'
34
+ end
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ require 'pathname'
3
+ require 'fileutils'
4
+ include FileUtils
5
+
6
+ # path to your application root.
7
+ APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
8
+
9
+ def system!(*args)
10
+ system(*args) || abort("\n== Command #{args} failed ==")
11
+ end
12
+
13
+ chdir APP_ROOT do
14
+ # This script is a way to update your development environment automatically.
15
+ # Add necessary update steps to this file.
16
+
17
+ puts '== Installing dependencies =='
18
+ system! 'gem install bundler --conservative'
19
+ system('bundle check') || system!('bundle install')
20
+
21
+ puts "\n== Updating database =="
22
+ system! 'bin/rails db:migrate'
23
+
24
+ puts "\n== Removing old logs and tempfiles =="
25
+ system! 'bin/rails log:clear tmp:clear'
26
+
27
+ puts "\n== Restarting application server =="
28
+ system! 'bin/rails restart'
29
+ end
@@ -0,0 +1,14 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ Bundler.require(*Rails.groups)
6
+
7
+ require 'push_type_api'
8
+
9
+ module Dummy
10
+ class Application < Rails::Application
11
+ config.action_mailer.default_url_options = { host: 'localhost:3000' }
12
+ end
13
+ end
14
+
@@ -0,0 +1,4 @@
1
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
2
+
3
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
4
+ $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
@@ -0,0 +1,9 @@
1
+ development:
2
+ adapter: async
3
+
4
+ test:
5
+ adapter: async
6
+
7
+ production:
8
+ adapter: redis
9
+ url: redis://localhost:6379/1
@@ -0,0 +1,85 @@
1
+ # PostgreSQL. Versions 9.1 and up are supported.
2
+ #
3
+ # Install the pg driver:
4
+ # gem install pg
5
+ # On OS X with Homebrew:
6
+ # gem install pg -- --with-pg-config=/usr/local/bin/pg_config
7
+ # On OS X with MacPorts:
8
+ # gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
9
+ # On Windows:
10
+ # gem install pg
11
+ # Choose the win32 build.
12
+ # Install PostgreSQL and put its /bin directory on your path.
13
+ #
14
+ # Configure Using Gemfile
15
+ # gem 'pg'
16
+ #
17
+ default: &default
18
+ adapter: postgresql
19
+ encoding: unicode
20
+ # For details on connection pooling, see rails configuration guide
21
+ # http://guides.rubyonrails.org/configuring.html#database-pooling
22
+ pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
23
+
24
+ development:
25
+ <<: *default
26
+ database: dummy_development
27
+
28
+ # The specified database role being used to connect to postgres.
29
+ # To create additional roles in postgres see `$ createuser --help`.
30
+ # When left blank, postgres will use the default role. This is
31
+ # the same name as the operating system user that initialized the database.
32
+ #username: dummy
33
+
34
+ # The password associated with the postgres role (username).
35
+ #password:
36
+
37
+ # Connect on a TCP socket. Omitted by default since the client uses a
38
+ # domain socket that doesn't need configuration. Windows does not have
39
+ # domain sockets, so uncomment these lines.
40
+ #host: localhost
41
+
42
+ # The TCP port the server listens on. Defaults to 5432.
43
+ # If your server runs on a different port number, change accordingly.
44
+ #port: 5432
45
+
46
+ # Schema search path. The server defaults to $user,public
47
+ #schema_search_path: myapp,sharedapp,public
48
+
49
+ # Minimum log levels, in increasing order:
50
+ # debug5, debug4, debug3, debug2, debug1,
51
+ # log, notice, warning, error, fatal, and panic
52
+ # Defaults to warning.
53
+ #min_messages: notice
54
+
55
+ # Warning: The database defined as "test" will be erased and
56
+ # re-generated from your development database when you run "rake".
57
+ # Do not set this db to the same as development or production.
58
+ test:
59
+ <<: *default
60
+ database: dummy_test
61
+
62
+ # As with config/secrets.yml, you never want to store sensitive information,
63
+ # like your database password, in your source code. If your source code is
64
+ # ever seen by anyone, they now have access to your database.
65
+ #
66
+ # Instead, provide the password as a unix environment variable when you boot
67
+ # the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database
68
+ # for a full rundown on how to provide these environment variables in a
69
+ # production deployment.
70
+ #
71
+ # On Heroku and other platform providers, you may have a full connection URL
72
+ # available as an environment variable. For example:
73
+ #
74
+ # DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase"
75
+ #
76
+ # You can use this database configuration with:
77
+ #
78
+ # production:
79
+ # url: <%= ENV['DATABASE_URL'] %>
80
+ #
81
+ production:
82
+ <<: *default
83
+ database: dummy_production
84
+ username: dummy
85
+ password: <%= ENV['DUMMY_DATABASE_PASSWORD'] %>
@@ -0,0 +1,5 @@
1
+ # Load the Rails application.
2
+ require_relative 'application'
3
+
4
+ # Initialize the Rails application.
5
+ Rails.application.initialize!