├── .babelrc
├── .gitignore
├── .ruby-gemset
├── .ruby-version
├── Gemfile
├── Gemfile.lock
├── MIT-LICENSE.md
├── Procfile
├── README.md
├── Rakefile
├── app
├── assets
│ ├── config
│ │ └── manifest.js
│ ├── images
│ │ └── .keep
│ ├── javascripts
│ │ ├── JODY.coffee
│ │ ├── app_initializer.coffee
│ │ ├── application.js
│ │ ├── cable.js
│ │ ├── channels
│ │ │ ├── .keep
│ │ │ └── notes.coffee
│ │ ├── notes.coffee
│ │ └── search.coffee
│ └── stylesheets
│ │ ├── application.css
│ │ ├── layout.css.sass
│ │ └── notes.css.sass
├── channels
│ ├── application_cable
│ │ ├── channel.rb
│ │ └── connection.rb
│ └── notes_channel.rb
├── controllers
│ ├── application_controller.rb
│ ├── concerns
│ │ └── .keep
│ ├── notes_controller.rb
│ └── search_controller.rb
├── helpers
│ ├── application_helper.rb
│ ├── channel_helper.rb
│ └── notes_helper.rb
├── indices
│ ├── .keep
│ └── note_index.rb
├── javascript
│ └── packs
│ │ ├── application.js
│ │ └── hello_react.jsx
├── jobs
│ └── application_job.rb
├── mailers
│ └── application_mailer.rb
├── models
│ ├── application_record.rb
│ ├── concerns
│ │ └── .keep
│ ├── note.rb
│ └── user.rb
├── views
│ ├── devise
│ │ ├── confirmations
│ │ │ └── new.html.erb
│ │ ├── mailer
│ │ │ ├── confirmation_instructions.html.erb
│ │ │ ├── password_change.html.erb
│ │ │ ├── reset_password_instructions.html.erb
│ │ │ └── unlock_instructions.html.erb
│ │ ├── passwords
│ │ │ ├── edit.html.erb
│ │ │ └── new.html.erb
│ │ ├── registrations
│ │ │ ├── edit.html.erb
│ │ │ └── new.html.erb
│ │ ├── sessions
│ │ │ └── new.html.erb
│ │ ├── shared
│ │ │ └── _links.html.erb
│ │ └── unlocks
│ │ │ └── new.html.erb
│ ├── layouts
│ │ ├── application.html.slim
│ │ ├── mailer.html.erb
│ │ └── mailer.text.erb
│ ├── notes
│ │ ├── _form.html.slim
│ │ ├── _note.json.jbuilder
│ │ ├── edit.html.slim
│ │ ├── index.html.slim
│ │ ├── list.html.slim
│ │ ├── new.html.slim
│ │ ├── random.html.slim
│ │ ├── show.html.slim
│ │ ├── show.json.jbuilder
│ │ └── ws_random.json.jbuilder
│ └── search
│ │ ├── _form.html.slim
│ │ └── search.html.slim
└── workers
│ └── notes_random_worker.rb
├── bin
├── bundle
├── bundler
├── byebug
├── coderay
├── erubis
├── foreman
├── listen
├── nokogiri
├── oauth
├── pry
├── puma
├── pumactl
├── rackup
├── rails
├── rake
├── sass
├── sass-convert
├── scss
├── setup
├── sidekiq
├── sidekiqctl
├── slimrb
├── sprockets
├── thor
├── tilt
├── update
├── webpack
├── webpack-dev-server
├── webpack-watcher
├── whenever
├── wheneverize
└── yarn
├── config.ru
├── config
├── ENV
│ └── production.example
│ │ ├── services
│ │ ├── .keep
│ │ ├── puma.rb
│ │ ├── redis.config
│ │ ├── schedule.rb
│ │ ├── sidekiq.yml
│ │ └── thinking_sphinx.yml
│ │ └── settings
│ │ ├── .keep
│ │ ├── app.yml
│ │ ├── app_mailer.yml
│ │ └── oauth.yml
├── application.rb
├── boot.rb
├── configs.rb
├── database.yml.example
├── environment.rb
├── environments
│ ├── development.rb
│ ├── production.rb
│ └── test.rb
├── initializers
│ ├── _ACTION_CABLE.rb
│ ├── _APP_MAILER.rb
│ ├── _DEVISE.rb
│ ├── _RAILS_APP.rb
│ ├── _REDIS.rb
│ ├── _SIDEKIQ.rb
│ ├── _THINKING_SPHINX.rb
│ ├── application_controller_renderer.rb
│ ├── assets.rb
│ ├── backtrace_silencers.rb
│ ├── config.rb
│ ├── cookies_serializer.rb
│ ├── filter_parameter_logging.rb
│ ├── inflections.rb
│ ├── kaminari_config.rb
│ ├── mime_types.rb
│ ├── new_framework_defaults.rb
│ └── wrap_parameters.rb
├── locales
│ ├── devise.en.yml
│ └── en.yml
├── routes.rb
└── webpack
│ ├── development.js
│ ├── production.js
│ └── shared.js
├── db
├── REDIS
│ └── .keep
├── SPHINX
│ └── .keep
├── migrate
│ ├── 20160918152255_devise_create_users.rb
│ └── 20160921090347_create_notes.rb
├── schema.rb
└── seeds.rb
├── lib
├── assets
│ └── .keep
└── tasks
│ ├── .keep
│ └── app_init.rake
├── log
└── .keep
├── package.json
├── public
├── 404.html
├── 422.html
├── 500.html
├── apple-touch-icon-precomposed.png
├── apple-touch-icon.png
├── favicon.ico
└── robots.txt
├── test
├── application_system_test_case.rb
├── controllers
│ └── .keep
├── fixtures
│ ├── .keep
│ └── files
│ │ └── .keep
├── helpers
│ └── .keep
├── integration
│ └── .keep
├── mailers
│ └── .keep
├── models
│ └── .keep
├── system
│ └── .keep
├── test_helper.rb
└── workers
│ └── notes_random_worker_test.rb
├── tmp
├── .keep
├── cache
│ └── assets
│ │ └── .keep
├── pids
│ └── .keep
├── sessions
│ └── .keep
└── sockets
│ └── .keep
├── vendor
└── .keep
└── yarn.lock
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": ["env", "react"]
3 | }
4 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files for more about ignoring files.
2 | #
3 | # If you find yourself ignoring temporary files generated by your text editor
4 | # or operating system, you probably want to add a global ignore instead:
5 | # git config --global core.excludesfile '~/.gitignore_global'
6 |
7 | # Ignore bundler config.
8 | /.bundle
9 |
10 | # Ignore the default SQLite database.
11 | /db/*.sqlite3
12 | /db/*.sqlite3-journal
13 |
14 | # Ignore database config
15 | /config/database.yml
16 |
17 | # Ignore all logfiles and tempfiles.
18 | /log/*
19 | /tmp/*
20 | !/log/.keep
21 | !/tmp/.keep
22 |
23 | /node_modules
24 | /yarn-error.log
25 |
26 | .byebug_history
27 |
28 | config/ENV/*
29 | !config/ENV/production.example
30 |
31 | db/REDIS/*
32 | db/SPHINX/*
33 | /public/packs
34 | /node_modules
35 |
--------------------------------------------------------------------------------
/.ruby-gemset:
--------------------------------------------------------------------------------
1 | deployrb_rails5app
2 |
--------------------------------------------------------------------------------
/.ruby-version:
--------------------------------------------------------------------------------
1 | ruby-2.3.3
2 |
--------------------------------------------------------------------------------
/Gemfile:
--------------------------------------------------------------------------------
1 | source 'https://rubygems.org'
2 |
3 | git_source(:github) do |repo_name|
4 | repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
5 | "https://github.com/#{repo_name}.git"
6 | end
7 |
8 | gem 'webpacker', github: 'rails/webpacker'
9 |
10 | gem 'jquery-rails',
11 | github: 'rails/jquery-rails',
12 | branch: '89d60928'
13 |
14 | gem 'jquery-ui-rails',
15 | github: 'jquery-ui-rails/jquery-ui-rails',
16 | branch: '0b22d466'
17 |
18 | gem 'config', '1.3.0'
19 | gem 'colorize'
20 |
21 | # LOGIN
22 | gem 'devise', '4.1.1'
23 |
24 | gem 'omniauth', '1.3.1'
25 | gem 'omniauth-oauth', '1.1.0'
26 | gem 'omniauth-oauth2', '1.4.0'
27 |
28 | gem 'omniauth-facebook', '4.0.0'
29 | gem 'omniauth-vkontakte', '1.3.7'
30 | gem 'omniauth-google-oauth2', '0.4.1'
31 | gem 'omniauth-odnoklassniki', '0.0.5'
32 | gem 'omniauth-twitter', '1.2.1'
33 |
34 | # DELAYED JOBS
35 | gem 'sidekiq', '4.2.1'
36 | gem 'sidekiq-limit_fetch', '3.3.0'
37 |
38 | gem 'redis-namespace', '1.5.2'
39 | gem 'sinatra', '1.0', require: nil
40 |
41 | gem 'whenever', '0.9.7', require: false
42 |
43 | # CONTENT
44 | gem 'protozaur', github: 'the-teacher/protozaur', branch: 'v2.0.pre'
45 | gem 'slim-rails', github: 'slim-template/slim-rails', branch: '8dbc1fbf8'
46 | gem 'slim', '3.0.7'
47 | gem 'ffaker'
48 |
49 | gem 'kaminari', github: 'amatsuda/kaminari', branch: '1c9ec3603'
50 |
51 | # DATABASES & SEARCH
52 | gem 'pg', '0.18.4'
53 | gem 'mysql2', '0.4.4'
54 | gem 'thinking-sphinx', '3.2.0'
55 |
56 | # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
57 | gem 'rails', '~> 5.1.0.beta1'
58 | # Use Puma as the app server
59 | gem 'puma', '~> 3.7'
60 | # Use SCSS for stylesheets
61 | gem 'sass-rails', github: "rails/sass-rails"
62 |
63 | # Use Uglifier as compressor for JavaScript assets
64 | gem 'uglifier', '>= 1.3.0'
65 | # See https://github.com/rails/execjs#readme for more supported runtimes
66 | # gem 'therubyracer', platforms: :ruby
67 |
68 | # Use CoffeeScript for .coffee assets and views
69 | gem 'coffee-rails', '~> 4.2'
70 | # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
71 | gem 'turbolinks', '~> 5'
72 | # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
73 | gem 'jbuilder', '~> 2.5'
74 | # Use Redis adapter to run Action Cable in production
75 | # gem 'redis', '~> 3.0'
76 | # Use ActiveModel has_secure_password
77 | # gem 'bcrypt', '~> 3.1.7'
78 |
79 | # Use Capistrano for deployment
80 | # gem 'capistrano-rails', group: :development
81 |
82 | group :development, :test do
83 | # Call 'byebug' anywhere in the code to stop execution and get a debugger console
84 | gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
85 | # Adds support for Capybara system testing and selenium driver
86 | gem 'capybara', '~> 2.7.0'
87 | gem 'selenium-webdriver'
88 | end
89 |
90 | group :development do
91 | # Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
92 | gem 'web-console', '>= 3.3.0'
93 | gem 'listen', '>= 3.0.5', '< 3.2'
94 |
95 | gem 'foreman'
96 | gem 'pry-rails'
97 |
98 | # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
99 | # gem 'spring'
100 | # gem 'spring-watcher-listen', '~> 2.0.0'
101 | end
102 |
103 | # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
104 | gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
105 |
--------------------------------------------------------------------------------
/Gemfile.lock:
--------------------------------------------------------------------------------
1 | GIT
2 | remote: https://github.com/amatsuda/kaminari.git
3 | revision: 1c9ec3603d4c45f424e9a3367644931d19070505
4 | branch: 1c9ec3603
5 | specs:
6 | kaminari (1.0.1)
7 | activesupport (>= 4.1.0)
8 | kaminari-actionview (= 1.0.1)
9 | kaminari-activerecord (= 1.0.1)
10 | kaminari-core (= 1.0.1)
11 | kaminari-actionview (1.0.1)
12 | actionview
13 | kaminari-core (= 1.0.1)
14 | kaminari-activerecord (1.0.1)
15 | activerecord
16 | kaminari-core (= 1.0.1)
17 | kaminari-core (1.0.1)
18 |
19 | GIT
20 | remote: https://github.com/jquery-ui-rails/jquery-ui-rails.git
21 | revision: 0b22d46622c6615334cdfcd86d0d3ea22d9841ca
22 | branch: 0b22d466
23 | specs:
24 | jquery-ui-rails (6.0.1)
25 | railties (>= 3.2.16)
26 |
27 | GIT
28 | remote: https://github.com/rails/jquery-rails.git
29 | revision: 89d609282348b56751b8d5068c43863b80b899ef
30 | branch: 89d60928
31 | specs:
32 | jquery-rails (4.2.2)
33 | rails-dom-testing (>= 1, < 3)
34 | railties (>= 4.2.0)
35 | thor (>= 0.14, < 2.0)
36 |
37 | GIT
38 | remote: https://github.com/rails/sass-rails.git
39 | revision: dfbcc6a53653d8908007e26324a0f299f026ec4f
40 | specs:
41 | sass-rails (6.0.0.beta1)
42 | railties (>= 4.0.0, < 5.1)
43 | sass (~> 3.4)
44 | sprockets (~> 4.x)
45 | sprockets-rails (< 4.0)
46 |
47 | GIT
48 | remote: https://github.com/rails/webpacker.git
49 | revision: a85a3ab0eac6626af9da0efbda9320404114d675
50 | specs:
51 | webpacker (1.0)
52 | activesupport (>= 4.2)
53 | multi_json (~> 1.2)
54 | railties (>= 4.2)
55 |
56 | GIT
57 | remote: https://github.com/slim-template/slim-rails.git
58 | revision: 8dbc1fbf859ebfa95b0884a0196a6ad9f0ca9cd5
59 | branch: 8dbc1fbf8
60 | specs:
61 | slim-rails (3.1.2)
62 | actionpack (>= 3.1)
63 | railties (>= 3.1)
64 | slim (~> 3.0)
65 |
66 | GIT
67 | remote: https://github.com/the-teacher/protozaur.git
68 | revision: a39e67a7b0cf185b7446d084137330cd90114c7c
69 | branch: v2.0.pre
70 | specs:
71 | protozaur (1.1.0)
72 |
73 | GEM
74 | remote: https://rubygems.org/
75 | specs:
76 | actioncable (5.1.0.beta1)
77 | actionpack (= 5.1.0.beta1)
78 | nio4r (~> 2.0)
79 | websocket-driver (~> 0.6.1)
80 | actionmailer (5.1.0.beta1)
81 | actionpack (= 5.1.0.beta1)
82 | actionview (= 5.1.0.beta1)
83 | activejob (= 5.1.0.beta1)
84 | mail (~> 2.5, >= 2.5.4)
85 | rails-dom-testing (~> 2.0)
86 | actionpack (5.1.0.beta1)
87 | actionview (= 5.1.0.beta1)
88 | activesupport (= 5.1.0.beta1)
89 | rack (~> 2.0)
90 | rack-test (~> 0.6.3)
91 | rails-dom-testing (~> 2.0)
92 | rails-html-sanitizer (~> 1.0, >= 1.0.2)
93 | actionview (5.1.0.beta1)
94 | activesupport (= 5.1.0.beta1)
95 | builder (~> 3.1)
96 | erubi (~> 1.4)
97 | rails-dom-testing (~> 2.0)
98 | rails-html-sanitizer (~> 1.0, >= 1.0.3)
99 | activejob (5.1.0.beta1)
100 | activesupport (= 5.1.0.beta1)
101 | globalid (>= 0.3.6)
102 | activemodel (5.1.0.beta1)
103 | activesupport (= 5.1.0.beta1)
104 | activerecord (5.1.0.beta1)
105 | activemodel (= 5.1.0.beta1)
106 | activesupport (= 5.1.0.beta1)
107 | arel (~> 8.0)
108 | activesupport (5.1.0.beta1)
109 | concurrent-ruby (~> 1.0, >= 1.0.2)
110 | i18n (~> 0.7)
111 | minitest (~> 5.1)
112 | tzinfo (~> 1.1)
113 | addressable (2.5.0)
114 | public_suffix (~> 2.0, >= 2.0.2)
115 | arel (8.0.0)
116 | bcrypt (3.1.11)
117 | builder (3.2.3)
118 | byebug (9.0.6)
119 | capybara (2.7.1)
120 | addressable
121 | mime-types (>= 1.16)
122 | nokogiri (>= 1.3.3)
123 | rack (>= 1.0.0)
124 | rack-test (>= 0.5.4)
125 | xpath (~> 2.0)
126 | childprocess (0.6.2)
127 | ffi (~> 1.0, >= 1.0.11)
128 | chronic (0.10.2)
129 | coderay (1.1.1)
130 | coffee-rails (4.2.1)
131 | coffee-script (>= 2.2.0)
132 | railties (>= 4.0.0, < 5.2.x)
133 | coffee-script (2.4.1)
134 | coffee-script-source
135 | execjs
136 | coffee-script-source (1.12.2)
137 | colorize (0.8.1)
138 | concurrent-ruby (1.0.5)
139 | config (1.3.0)
140 | activesupport (>= 3.0)
141 | deep_merge (~> 1.1.1)
142 | connection_pool (2.2.1)
143 | debug_inspector (0.0.2)
144 | deep_merge (1.1.1)
145 | devise (4.1.1)
146 | bcrypt (~> 3.0)
147 | orm_adapter (~> 0.1)
148 | railties (>= 4.1.0, < 5.1)
149 | responders
150 | warden (~> 1.2.3)
151 | erubi (1.6.0)
152 | execjs (2.7.0)
153 | faraday (0.11.0)
154 | multipart-post (>= 1.2, < 3)
155 | ffaker (2.5.0)
156 | ffi (1.9.18)
157 | foreman (0.83.0)
158 | thor (~> 0.19.1)
159 | globalid (0.3.7)
160 | activesupport (>= 4.1.0)
161 | hashie (3.5.5)
162 | i18n (0.8.1)
163 | innertube (1.1.0)
164 | jbuilder (2.6.3)
165 | activesupport (>= 3.0.0, < 5.2)
166 | multi_json (~> 1.2)
167 | joiner (0.3.4)
168 | activerecord (>= 4.1.0)
169 | json (1.8.6)
170 | jwt (1.5.6)
171 | listen (3.1.5)
172 | rb-fsevent (~> 0.9, >= 0.9.4)
173 | rb-inotify (~> 0.9, >= 0.9.7)
174 | ruby_dep (~> 1.2)
175 | loofah (2.0.3)
176 | nokogiri (>= 1.5.9)
177 | mail (2.6.4)
178 | mime-types (>= 1.16, < 4)
179 | method_source (0.8.2)
180 | middleware (0.1.0)
181 | mime-types (3.1)
182 | mime-types-data (~> 3.2015)
183 | mime-types-data (3.2016.0521)
184 | mini_portile2 (2.1.0)
185 | minitest (5.10.1)
186 | multi_json (1.12.1)
187 | multi_xml (0.6.0)
188 | multipart-post (2.0.0)
189 | mysql2 (0.4.4)
190 | nio4r (2.0.0)
191 | nokogiri (1.7.0.1)
192 | mini_portile2 (~> 2.1.0)
193 | oauth (0.5.1)
194 | oauth2 (1.3.1)
195 | faraday (>= 0.8, < 0.12)
196 | jwt (~> 1.0)
197 | multi_json (~> 1.3)
198 | multi_xml (~> 0.5)
199 | rack (>= 1.2, < 3)
200 | omniauth (1.3.1)
201 | hashie (>= 1.2, < 4)
202 | rack (>= 1.0, < 3)
203 | omniauth-facebook (4.0.0)
204 | omniauth-oauth2 (~> 1.2)
205 | omniauth-google-oauth2 (0.4.1)
206 | jwt (~> 1.5.2)
207 | multi_json (~> 1.3)
208 | omniauth (>= 1.1.1)
209 | omniauth-oauth2 (>= 1.3.1)
210 | omniauth-oauth (1.1.0)
211 | oauth
212 | omniauth (~> 1.0)
213 | omniauth-oauth2 (1.4.0)
214 | oauth2 (~> 1.0)
215 | omniauth (~> 1.2)
216 | omniauth-odnoklassniki (0.0.5)
217 | omniauth (~> 1.0)
218 | omniauth-oauth2 (~> 1.0)
219 | omniauth-twitter (1.2.1)
220 | json (~> 1.3)
221 | omniauth-oauth (~> 1.1)
222 | omniauth-vkontakte (1.3.7)
223 | omniauth-oauth2 (~> 1.1)
224 | orm_adapter (0.5.0)
225 | pg (0.18.4)
226 | pry (0.10.4)
227 | coderay (~> 1.1.0)
228 | method_source (~> 0.8.1)
229 | slop (~> 3.4)
230 | pry-rails (0.3.5)
231 | pry (>= 0.9.10)
232 | public_suffix (2.0.5)
233 | puma (3.8.1)
234 | rack (2.0.1)
235 | rack-protection (1.5.3)
236 | rack
237 | rack-test (0.6.3)
238 | rack (>= 1.0)
239 | rails (5.1.0.beta1)
240 | actioncable (= 5.1.0.beta1)
241 | actionmailer (= 5.1.0.beta1)
242 | actionpack (= 5.1.0.beta1)
243 | actionview (= 5.1.0.beta1)
244 | activejob (= 5.1.0.beta1)
245 | activemodel (= 5.1.0.beta1)
246 | activerecord (= 5.1.0.beta1)
247 | activesupport (= 5.1.0.beta1)
248 | bundler (>= 1.3.0, < 2.0)
249 | railties (= 5.1.0.beta1)
250 | sprockets-rails (>= 2.0.0)
251 | rails-dom-testing (2.0.2)
252 | activesupport (>= 4.2.0, < 6.0)
253 | nokogiri (~> 1.6)
254 | rails-html-sanitizer (1.0.3)
255 | loofah (~> 2.0)
256 | railties (5.1.0.beta1)
257 | actionpack (= 5.1.0.beta1)
258 | activesupport (= 5.1.0.beta1)
259 | method_source
260 | rake (>= 0.8.7)
261 | thor (>= 0.18.1, < 2.0)
262 | rake (12.0.0)
263 | rb-fsevent (0.9.8)
264 | rb-inotify (0.9.8)
265 | ffi (>= 0.5.0)
266 | redis (3.3.3)
267 | redis-namespace (1.5.2)
268 | redis (~> 3.0, >= 3.0.4)
269 | responders (2.3.0)
270 | railties (>= 4.2.0, < 5.1)
271 | riddle (2.1.0)
272 | ruby_dep (1.5.0)
273 | rubyzip (1.2.1)
274 | sass (3.4.23)
275 | selenium-webdriver (3.3.0)
276 | childprocess (~> 0.5)
277 | rubyzip (~> 1.0)
278 | websocket (~> 1.0)
279 | sidekiq (4.2.1)
280 | concurrent-ruby (~> 1.0)
281 | connection_pool (~> 2.2, >= 2.2.0)
282 | rack-protection (~> 1.5)
283 | redis (~> 3.2, >= 3.2.1)
284 | sidekiq-limit_fetch (3.3.0)
285 | sidekiq (>= 4)
286 | sinatra (1.0)
287 | rack (>= 1.0)
288 | slim (3.0.7)
289 | temple (~> 0.7.6)
290 | tilt (>= 1.3.3, < 2.1)
291 | slop (3.6.0)
292 | sprockets (4.0.0.beta4)
293 | concurrent-ruby (~> 1.0)
294 | rack (> 1, < 3)
295 | sprockets-rails (3.2.0)
296 | actionpack (>= 4.0)
297 | activesupport (>= 4.0)
298 | sprockets (>= 3.0.0)
299 | temple (0.7.7)
300 | thinking-sphinx (3.2.0)
301 | activerecord (>= 3.1.0)
302 | builder (>= 2.1.2)
303 | innertube (>= 1.0.2)
304 | joiner (>= 0.2.0)
305 | middleware (>= 0.1.0)
306 | riddle (>= 1.5.11)
307 | thor (0.19.4)
308 | thread_safe (0.3.6)
309 | tilt (2.0.6)
310 | turbolinks (5.0.1)
311 | turbolinks-source (~> 5)
312 | turbolinks-source (5.0.0)
313 | tzinfo (1.2.2)
314 | thread_safe (~> 0.1)
315 | uglifier (3.1.6)
316 | execjs (>= 0.3.0, < 3)
317 | warden (1.2.7)
318 | rack (>= 1.0)
319 | web-console (3.4.0)
320 | actionview (>= 5.0)
321 | activemodel (>= 5.0)
322 | debug_inspector
323 | railties (>= 5.0)
324 | websocket (1.2.4)
325 | websocket-driver (0.6.5)
326 | websocket-extensions (>= 0.1.0)
327 | websocket-extensions (0.1.2)
328 | whenever (0.9.7)
329 | chronic (>= 0.6.3)
330 | xpath (2.0.0)
331 | nokogiri (~> 1.3)
332 |
333 | PLATFORMS
334 | ruby
335 |
336 | DEPENDENCIES
337 | byebug
338 | capybara (~> 2.7.0)
339 | coffee-rails (~> 4.2)
340 | colorize
341 | config (= 1.3.0)
342 | devise (= 4.1.1)
343 | ffaker
344 | foreman
345 | jbuilder (~> 2.5)
346 | jquery-rails!
347 | jquery-ui-rails!
348 | kaminari!
349 | listen (>= 3.0.5, < 3.2)
350 | mysql2 (= 0.4.4)
351 | omniauth (= 1.3.1)
352 | omniauth-facebook (= 4.0.0)
353 | omniauth-google-oauth2 (= 0.4.1)
354 | omniauth-oauth (= 1.1.0)
355 | omniauth-oauth2 (= 1.4.0)
356 | omniauth-odnoklassniki (= 0.0.5)
357 | omniauth-twitter (= 1.2.1)
358 | omniauth-vkontakte (= 1.3.7)
359 | pg (= 0.18.4)
360 | protozaur!
361 | pry-rails
362 | puma (~> 3.7)
363 | rails (~> 5.1.0.beta1)
364 | redis-namespace (= 1.5.2)
365 | sass-rails!
366 | selenium-webdriver
367 | sidekiq (= 4.2.1)
368 | sidekiq-limit_fetch (= 3.3.0)
369 | sinatra (= 1.0)
370 | slim (= 3.0.7)
371 | slim-rails!
372 | thinking-sphinx (= 3.2.0)
373 | turbolinks (~> 5)
374 | tzinfo-data
375 | uglifier (>= 1.3.0)
376 | web-console (>= 3.3.0)
377 | webpacker!
378 | whenever (= 0.9.7)
379 |
380 | BUNDLED WITH
381 | 1.14.6
382 |
--------------------------------------------------------------------------------
/MIT-LICENSE.md:
--------------------------------------------------------------------------------
1 | ### The MIT License (MIT)
2 |
3 | Copyright (c) 2016 Ilya N. Zykin (https://github.com/the-teacher)
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6 |
7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8 |
9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
10 |
--------------------------------------------------------------------------------
/Procfile:
--------------------------------------------------------------------------------
1 | redis: redis-server ./config/ENV/development/services/redis.config
2 | sidekiq: RAILS_ENV=development bundle exec bin/sidekiq -e development -C ./config/ENV/development/services/sidekiq.yml
3 | ts_sphinx: RAILS_ENV=development bundle exec rake ts:start NODETACH=true
4 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## Deploy.RB / Rails 5 App
2 |
3 | This is a part of the [Deploy.RB](https://deployrb.github.io/) project.
4 |
5 | Deploy.RB consists of:
6 |
7 | 1. [Rails 5 App](https://github.com/DeployRB/Rails5App) (**You are here**)
8 | 2. [Server Installation Script & Manual](https://github.com/DeployRB/SetupServer)
9 | 3. [Deployment Tool](https://github.com/DeployRB/DeployTool)
10 |
11 | Please, visit [Deploy.RB](https://deployrb.github.io/) page to get more information.
12 |
13 | ```
14 | ```
15 |
16 | # Rails 5 App
17 |
18 | Simple Rails 5 App for `deploy.rb` project
19 |
20 | With this App we demonstrate how basic Rails 5 can be configurated for deployment process
21 |
22 | The app uses the following tools:
23 |
24 | * PostgreSQL (as main DB Storage)
25 | * Devise (Authentication)
26 | * Redis (Cache store and store for SideKiq)
27 | * SideKiq (Delayed jobs)
28 | * Thinking Sphinx (Full-text search)
29 | * `mysql2` adapter to work with `Thinking Sphinx`
30 | * `foreman` to start/stop services
31 | * WebSockets (ActionCable)
32 | * Whenever (Cron tasks)
33 | * `kaminari` for pagination
34 |
35 | ## How to run on local machine
36 |
37 | ### System requirements
38 |
39 | - Unix like OS
40 | - NodeJS (https://nodejs.org)
41 | - Redis (http://redis.io)
42 | - Sphinx (http://sphinxsearch.com)
43 | - PostgreSQL (http://postgresql.org)
44 | - MySQL (http://mysql.com)
45 |
46 |
47 | [open ▾] How to check required software?
48 |
49 | ```
50 | $ which rvm
51 | /Users/$HOME/.rvm/bin/rvm
52 |
53 | $ which node
54 | /usr/local/bin/node
55 |
56 | $ which redis-server
57 | /usr/local/bin/redis-server
58 |
59 | $ which searchd
60 | /usr/local/bin/searchd
61 |
62 | $ which psql
63 | /usr/local/bin/psql
64 |
65 | $ which mysql
66 | /usr/local/bin/mysql
67 | ```
68 |
69 |
70 |
71 | ### 1. Clone & install
72 |
73 | ```sh
74 | git clone https://github.com/DeployRB/Rails5App.git
75 | cd Rails5App
76 |
77 | gem install bundler
78 | bundle install
79 | ```
80 |
81 | ### 2. Create a folder for config files for your environment
82 |
83 | ```
84 | cp -av config/ENV/production.example config/ENV/development
85 | ```
86 |
87 | ### 3. Edit files in folders were copied
88 |
89 | 0. Edit files were copied and replace `/ABS/PATH/TO` with real absolute path to your `Rails5App` app path
90 |
91 | For example, `/ABS/PATH/TO/Rails5App` => `/Users/the-teacher/rails/Rails5App`
92 |
93 | 0. Edit files were copied and replace `production.example` with a name of your environment
94 |
95 | For example:
96 |
97 | ```sh
98 | sed -i '' 's/production.example/development/g' config/ENV/development/services/*
99 | ```
100 |
101 | ### 4. Setup `database.yml`
102 |
103 | ```sh
104 | cp config/database.yml.example config/database.yml
105 | ```
106 |
107 | Edit file and set required parameters.
108 |
109 |
110 | [open ▾] How to create PQSL user?
111 |
112 | ```ruby
113 | createuser rails5app -sW
114 | > qwerty
115 | ```
116 |
117 | ```sql
118 | psql -U postgres
119 |
120 | CREATE USER "rails5app" WITH PASSWORD 'qwerty';
121 | ALTER ROLE "rails5app" SUPERUSER CREATEDB;
122 |
123 | \q
124 | ```
125 |
126 |
127 |
128 | ### 5. Initialize your App
129 |
130 | ```
131 | bundle exec rake app:init
132 | ```
133 |
134 | ### 6. Build Search index
135 |
136 | ```
137 | bundle exec rake ts:configure ts:index
138 | ```
139 |
140 | ### 7. Start services
141 |
142 | Start cron tasks
143 |
144 |
145 | [open ▾] CRON. Notes
146 |
147 | * tasks list `crontab -l`
148 | * remove all tasks `crontab -r`
149 |
150 | ```sh
151 | bundle exec whenever --clear-crontab Rails5App
152 | ```
153 |
154 |
155 | ```sh
156 | bundle exec whenever --update-crontab \
157 | -i Rails5App \
158 | --load-file config/ENV/development/services/schedule.rb \
159 | --set 'environment=development'
160 | ```
161 |
162 | Start services with `foreman`
163 |
164 | ```
165 | bundle exec foreman start
166 | ```
167 |
168 | ### 8. Start Rails server
169 |
170 | ```
171 | bundle exec puma -b tcp://localhost -p 3000
172 | ```
173 |
174 | or just
175 |
176 | ```
177 | bundle exec rails s
178 | ```
179 |
180 | ### Finally App is ready to use
181 |
182 | ```
183 | http://localhost:3000
184 | ```
185 |
186 | ### Async tasks
187 |
188 | ```
189 | http://localhost:3000/async/tasks
190 | ```
191 |
192 | ```
193 | login: admin
194 | password: qwerty
195 | ```
196 |
--------------------------------------------------------------------------------
/Rakefile:
--------------------------------------------------------------------------------
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
7 |
--------------------------------------------------------------------------------
/app/assets/config/manifest.js:
--------------------------------------------------------------------------------
1 | //= link_tree ../images
2 | //= link_directory ../javascripts .js
3 | //= link_directory ../stylesheets .css
4 |
--------------------------------------------------------------------------------
/app/assets/images/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DeployRB/Rails5App/04efd4f6d812e34d7969c667c149b6f9b46d801a/app/assets/images/.keep
--------------------------------------------------------------------------------
/app/assets/javascripts/JODY.coffee:
--------------------------------------------------------------------------------
1 | # JsOn for DYnamic sites
2 | #
3 | # JS middleware which does boring routine work
4 | # Based on `conventions over configurations`
5 | # Just give to JODY suitable JSON data object and JODY will do what you want
6 | #
7 | @JODY = do ->
8 | process: (data) ->
9 | # SET HTML
10 | if idsToSet = data?.html_content?.html
11 | for id, html of idsToSet
12 | $(id).html(html)
13 |
14 | # REPLACE HTML
15 | if idsToReplace = data?.html_content?.replaceWith
16 | for id, html of idsToReplace
17 | $(id).replaceWith(html)
18 |
--------------------------------------------------------------------------------
/app/assets/javascripts/app_initializer.coffee:
--------------------------------------------------------------------------------
1 | $ ->
2 | Search.init()
3 | Notes.init()
4 |
--------------------------------------------------------------------------------
/app/assets/javascripts/application.js:
--------------------------------------------------------------------------------
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, or any plugin's
5 | // 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 jquery3
14 | //= require rails-ujs
15 | //= require turbolinks
16 |
17 | //= require cable
18 | //= require JODY
19 | //= require search
20 | //= require notes
21 | //= require app_initializer
22 |
--------------------------------------------------------------------------------
/app/assets/javascripts/cable.js:
--------------------------------------------------------------------------------
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);
14 |
--------------------------------------------------------------------------------
/app/assets/javascripts/channels/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DeployRB/Rails5App/04efd4f6d812e34d7969c667c149b6f9b46d801a/app/assets/javascripts/channels/.keep
--------------------------------------------------------------------------------
/app/assets/javascripts/channels/notes.coffee:
--------------------------------------------------------------------------------
1 | App.notes = App.cable.subscriptions.create "NotesChannel",
2 | connected: ->
3 | console.log 'NotesChannel connected'
4 | # Called when the subscription is ready for use on the server
5 |
6 | disconnected: ->
7 | console.log 'NotesChannel disconnected'
8 | # Called when the subscription has been terminated by the server
9 |
10 | received: (data) ->
11 | console.log data
12 | console.log 'NotesChannel received'
13 | # Called when there's incoming data on the websocket for this channel
14 |
15 | JODY.process(data)
16 |
17 | random: ->
18 | @perform 'random'
19 |
--------------------------------------------------------------------------------
/app/assets/javascripts/notes.coffee:
--------------------------------------------------------------------------------
1 | @Notes = do ->
2 | init: ->
3 | @inited ||= do ->
4 | doc = $ document
5 |
6 | doc.on 'click', '.js-notes-random_note', (e) ->
7 | App.notes.random()
8 |
--------------------------------------------------------------------------------
/app/assets/javascripts/search.coffee:
--------------------------------------------------------------------------------
1 | @Search = do ->
2 | init: ->
3 | @inited ||= do ->
4 | doc = $ document
5 |
6 | doc.on 'click', '.js-search-submit_btn', (e) ->
7 | btn = $ e.currentTarget
8 | form = btn.parents('form')
9 |
10 | q_input = form.find('[name=q]')
11 | q = q_input.val().trim()
12 | q_input.val(q)
13 |
14 | return false if q.length == 0
15 |
16 | btn.prop('disabled', 'disabled')
17 | form.submit()
18 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/application.css:
--------------------------------------------------------------------------------
1 | /*
2 | *= require ptz/reset
3 | *= require ptz/base
4 | *= require ptz/framework
5 |
6 | #= require ptz/inputs_buttons/all
7 |
8 | *= require layout
9 | *= require notes
10 | */
11 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/layout.css.sass:
--------------------------------------------------------------------------------
1 | .search
2 | &-form
3 | border: 1px solid blue
4 | background: lightyellow
5 | border-radius: 5px
6 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/notes.css.sass:
--------------------------------------------------------------------------------
1 | .notes
2 | &-random
3 | border: 1px solid red
4 | background: #eee
5 | border-radius: 5px
6 | cursor: pointer
7 |
8 | &:hover
9 | background: #eef
10 |
--------------------------------------------------------------------------------
/app/channels/application_cable/channel.rb:
--------------------------------------------------------------------------------
1 | module ApplicationCable
2 | class Channel < ActionCable::Channel::Base
3 | end
4 | end
5 |
--------------------------------------------------------------------------------
/app/channels/application_cable/connection.rb:
--------------------------------------------------------------------------------
1 | module ApplicationCable
2 | class Connection < ActionCable::Connection::Base
3 | end
4 | end
5 |
--------------------------------------------------------------------------------
/app/channels/notes_channel.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file. Action Cable runs in a loop that does not support auto reloading.
2 | class NotesChannel < ApplicationCable::Channel
3 | include ChannelHelper
4 |
5 | def subscribed
6 | puts ">>> NotesChannel subscribed"
7 | stream_from "notes_channel"
8 | end
9 |
10 | def unsubscribed
11 | puts ">>> NotesChannel unsubscribed"
12 | # Any cleanup needed when channel is unsubscribed
13 | end
14 |
15 | def random
16 | puts ">>> NotesChannel random"
17 |
18 | broadcast 'notes_channel', render_json(
19 | template: 'notes/ws_random',
20 | locals: { note: Note.random.first }
21 | )
22 | end
23 | end
24 |
--------------------------------------------------------------------------------
/app/controllers/application_controller.rb:
--------------------------------------------------------------------------------
1 | class ApplicationController < ActionController::Base
2 | protect_from_forgery with: :exception
3 | end
4 |
--------------------------------------------------------------------------------
/app/controllers/concerns/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DeployRB/Rails5App/04efd4f6d812e34d7969c667c149b6f9b46d801a/app/controllers/concerns/.keep
--------------------------------------------------------------------------------
/app/controllers/notes_controller.rb:
--------------------------------------------------------------------------------
1 | class NotesController < ApplicationController
2 | before_action :set_note, only: [:show, :edit, :update, :destroy]
3 |
4 | # GET /notes
5 | # GET /notes.json
6 | def index
7 | @notes = Note
8 | .order('created_at DESC')
9 | .page(params[:page])
10 | .per(params[:per_page])
11 | end
12 |
13 | # GET /notes/1
14 | # GET /notes/1.json
15 | def show
16 | end
17 |
18 | # GET /notes/new
19 | def new
20 | @note = Note.new
21 | end
22 |
23 | # GET /notes/1/edit
24 | def edit
25 | end
26 |
27 | # POST /notes
28 | # POST /notes.json
29 | def create
30 | @note = Note.new(note_params)
31 |
32 | respond_to do |format|
33 | if @note.save
34 | format.html { redirect_to @note, notice: 'Note was successfully created.' }
35 | format.json { render :show, status: :created, location: @note }
36 | else
37 | format.html { render :new }
38 | format.json { render json: @note.errors, status: :unprocessable_entity }
39 | end
40 | end
41 | end
42 |
43 | # PATCH/PUT /notes/1
44 | # PATCH/PUT /notes/1.json
45 | def update
46 | respond_to do |format|
47 | if @note.update(note_params)
48 | format.html { redirect_to @note, notice: 'Note was successfully updated.' }
49 | format.json { render :show, status: :ok, location: @note }
50 | else
51 | format.html { render :edit }
52 | format.json { render json: @note.errors, status: :unprocessable_entity }
53 | end
54 | end
55 | end
56 |
57 | # DELETE /notes/1
58 | # DELETE /notes/1.json
59 | def destroy
60 | @note.destroy
61 | respond_to do |format|
62 | format.html { redirect_to notes_url, notice: 'Note was successfully destroyed.' }
63 | format.json { head :no_content }
64 | end
65 | end
66 |
67 | private
68 | # Use callbacks to share common setup or constraints between actions.
69 | def set_note
70 | @note = Note.find(params[:id])
71 | end
72 |
73 | # Never trust parameters from the scary internet, only allow the white list through.
74 | def note_params
75 | params.require(:note).permit(:title, :content)
76 | end
77 | end
78 |
--------------------------------------------------------------------------------
/app/controllers/search_controller.rb:
--------------------------------------------------------------------------------
1 | class SearchController < ApplicationController
2 | def search
3 | @q = params[:q].to_s.strip
4 | to_search = ::Riddle::Query.escape @q
5 |
6 | @notes = ::ThinkingSphinx.search(
7 | to_search,
8 | star: true,
9 | classes: [ Note ],
10 | field_weights: {
11 | title: 5,
12 | content: 3
13 | },
14 | per_page: 24
15 | )
16 | .page(params[:page])
17 | .per(params[:per_page])
18 | end
19 | end
20 |
--------------------------------------------------------------------------------
/app/helpers/application_helper.rb:
--------------------------------------------------------------------------------
1 | module ApplicationHelper
2 | end
3 |
--------------------------------------------------------------------------------
/app/helpers/channel_helper.rb:
--------------------------------------------------------------------------------
1 | # http://stackoverflow.com/questions/39103685/can-you-invoke-jbuilder-to-create-a-native-rails-object-instead-of-a-rendered-st
2 | module ChannelHelper
3 | def broadcast(channel, message)
4 | ActionCable.server.broadcast(channel, message)
5 | end
6 |
7 | def render_view(args)
8 | ApplicationController.render(args)
9 | end
10 |
11 | def render_json(args)
12 | JSON.parse render_view(args)
13 | end
14 | end
15 |
--------------------------------------------------------------------------------
/app/helpers/notes_helper.rb:
--------------------------------------------------------------------------------
1 | module NotesHelper
2 | end
3 |
--------------------------------------------------------------------------------
/app/indices/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DeployRB/Rails5App/04efd4f6d812e34d7969c667c149b6f9b46d801a/app/indices/.keep
--------------------------------------------------------------------------------
/app/indices/note_index.rb:
--------------------------------------------------------------------------------
1 | ThinkingSphinx::Index.define :note, :with => :active_record do
2 | indexes title
3 | indexes content
4 |
5 | has user_id, created_at, updated_at
6 | end
7 |
--------------------------------------------------------------------------------
/app/javascript/packs/application.js:
--------------------------------------------------------------------------------
1 | /* eslint no-console:0 */
2 | // This file is automatically compiled by Webpack, along with any other files
3 | // present in this directory. You're encouraged to place your actual application logic in
4 | // a relevant structure within app/javascript and only use these pack files to reference
5 | // that code so it'll be compiled.
6 | //
7 | // To reference this file, add <%= javascript_pack_tag 'application' %> to the appropriate
8 | // layout file, like app/views/layouts/application.html.erb
9 |
10 | console.log('Hello World from Webpacker')
11 |
--------------------------------------------------------------------------------
/app/javascript/packs/hello_react.jsx:
--------------------------------------------------------------------------------
1 | // Run this example by adding <%= javascript_pack_tag 'hello_react' %> to the head of your layout file,
2 | // like app/views/layouts/application.html.erb. All it does is render
Hello React
at the bottom
3 | // of the page.
4 |
5 | import React from 'react'
6 | import ReactDOM from 'react-dom'
7 |
8 | const Hello = props => (
9 | Hello {props.name}!
10 | )
11 |
12 | Hello.defaultProps = {
13 | name: 'David'
14 | }
15 |
16 | Hello.propTypes = {
17 | name: React.PropTypes.string
18 | }
19 |
20 | document.addEventListener('DOMContentLoaded', () => {
21 | ReactDOM.render(
22 | ,
23 | document.body.appendChild(document.createElement('div')),
24 | )
25 | })
26 |
--------------------------------------------------------------------------------
/app/jobs/application_job.rb:
--------------------------------------------------------------------------------
1 | class ApplicationJob < ActiveJob::Base
2 | end
3 |
--------------------------------------------------------------------------------
/app/mailers/application_mailer.rb:
--------------------------------------------------------------------------------
1 | class ApplicationMailer < ActionMailer::Base
2 | default from: 'from@example.com'
3 | layout 'mailer'
4 | end
5 |
--------------------------------------------------------------------------------
/app/models/application_record.rb:
--------------------------------------------------------------------------------
1 | class ApplicationRecord < ActiveRecord::Base
2 | self.abstract_class = true
3 | end
4 |
--------------------------------------------------------------------------------
/app/models/concerns/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DeployRB/Rails5App/04efd4f6d812e34d7969c667c149b6f9b46d801a/app/models/concerns/.keep
--------------------------------------------------------------------------------
/app/models/note.rb:
--------------------------------------------------------------------------------
1 | class Note < ApplicationRecord
2 | belongs_to :user
3 |
4 | validates :title, presence: true
5 | validates :content, presence: true
6 |
7 | scope :random, ->{ order('RANDOM()') }
8 | end
9 |
--------------------------------------------------------------------------------
/app/models/user.rb:
--------------------------------------------------------------------------------
1 | class User < ApplicationRecord
2 | # Include default devise modules. Others available are:
3 | # :confirmable, :lockable, :timeoutable and :omniauthable
4 | devise :database_authenticatable, :registerable,
5 | :recoverable, :rememberable, :trackable, :validatable
6 |
7 | has_many :notes
8 | end
9 |
--------------------------------------------------------------------------------
/app/views/devise/confirmations/new.html.erb:
--------------------------------------------------------------------------------
1 | Resend confirmation instructions
2 |
3 | <%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %>
4 | <%= devise_error_messages! %>
5 |
6 |
7 | <%= f.label :email %>
8 | <%= f.email_field :email, autofocus: true, value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %>
9 |
10 |
11 |
12 | <%= f.submit "Resend confirmation instructions" %>
13 |
14 | <% end %>
15 |
16 | <%= render "devise/shared/links" %>
17 |
--------------------------------------------------------------------------------
/app/views/devise/mailer/confirmation_instructions.html.erb:
--------------------------------------------------------------------------------
1 | Welcome <%= @email %>!
2 |
3 | You can confirm your account email through the link below:
4 |
5 | <%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %>
6 |
--------------------------------------------------------------------------------
/app/views/devise/mailer/password_change.html.erb:
--------------------------------------------------------------------------------
1 | Hello <%= @resource.email %>!
2 |
3 | We're contacting you to notify you that your password has been changed.
4 |
--------------------------------------------------------------------------------
/app/views/devise/mailer/reset_password_instructions.html.erb:
--------------------------------------------------------------------------------
1 | Hello <%= @resource.email %>!
2 |
3 | Someone has requested a link to change your password. You can do this through the link below.
4 |
5 | <%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %>
6 |
7 | If you didn't request this, please ignore this email.
8 | Your password won't change until you access the link above and create a new one.
9 |
--------------------------------------------------------------------------------
/app/views/devise/mailer/unlock_instructions.html.erb:
--------------------------------------------------------------------------------
1 | Hello <%= @resource.email %>!
2 |
3 | Your account has been locked due to an excessive number of unsuccessful sign in attempts.
4 |
5 | Click the link below to unlock your account:
6 |
7 | <%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %>
8 |
--------------------------------------------------------------------------------
/app/views/devise/passwords/edit.html.erb:
--------------------------------------------------------------------------------
1 | Change your password
2 |
3 | <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
4 | <%= devise_error_messages! %>
5 | <%= f.hidden_field :reset_password_token %>
6 |
7 |
8 | <%= f.label :password, "New password" %>
9 | <% if @minimum_password_length %>
10 | (<%= @minimum_password_length %> characters minimum)
11 | <% end %>
12 | <%= f.password_field :password, autofocus: true, autocomplete: "off" %>
13 |
14 |
15 |
16 | <%= f.label :password_confirmation, "Confirm new password" %>
17 | <%= f.password_field :password_confirmation, autocomplete: "off" %>
18 |
19 |
20 |
21 | <%= f.submit "Change my password" %>
22 |
23 | <% end %>
24 |
25 | <%= render "devise/shared/links" %>
26 |
--------------------------------------------------------------------------------
/app/views/devise/passwords/new.html.erb:
--------------------------------------------------------------------------------
1 | Forgot your password?
2 |
3 | <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
4 | <%= devise_error_messages! %>
5 |
6 |
7 | <%= f.label :email %>
8 | <%= f.email_field :email, autofocus: true %>
9 |
10 |
11 |
12 | <%= f.submit "Send me reset password instructions" %>
13 |
14 | <% end %>
15 |
16 | <%= render "devise/shared/links" %>
17 |
--------------------------------------------------------------------------------
/app/views/devise/registrations/edit.html.erb:
--------------------------------------------------------------------------------
1 | Edit <%= resource_name.to_s.humanize %>
2 |
3 | <%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
4 | <%= devise_error_messages! %>
5 |
6 |
7 | <%= f.label :email %>
8 | <%= f.email_field :email, autofocus: true %>
9 |
10 |
11 | <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
12 | Currently waiting confirmation for: <%= resource.unconfirmed_email %>
13 | <% end %>
14 |
15 |
16 | <%= f.label :password %> (leave blank if you don't want to change it)
17 | <%= f.password_field :password, autocomplete: "off" %>
18 |
19 |
20 |
21 | <%= f.label :password_confirmation %>
22 | <%= f.password_field :password_confirmation, autocomplete: "off" %>
23 |
24 |
25 |
26 | <%= f.label :current_password %> (we need your current password to confirm your changes)
27 | <%= f.password_field :current_password, autocomplete: "off" %>
28 |
29 |
30 |
31 | <%= f.submit "Update" %>
32 |
33 | <% end %>
34 |
35 | Cancel my account
36 |
37 | Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %>
38 |
39 | <%= link_to "Back", :back %>
40 |
--------------------------------------------------------------------------------
/app/views/devise/registrations/new.html.erb:
--------------------------------------------------------------------------------
1 | Sign up
2 |
3 | <%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
4 | <%= devise_error_messages! %>
5 |
6 |
7 | <%= f.label :email %>
8 | <%= f.email_field :email, autofocus: true %>
9 |
10 |
11 |
12 | <%= f.label :password %>
13 | <% if @minimum_password_length %>
14 | (<%= @minimum_password_length %> characters minimum)
15 | <% end %>
16 | <%= f.password_field :password, autocomplete: "off" %>
17 |
18 |
19 |
20 | <%= f.label :password_confirmation %>
21 | <%= f.password_field :password_confirmation, autocomplete: "off" %>
22 |
23 |
24 |
25 | <%= f.submit "Sign up" %>
26 |
27 | <% end %>
28 |
29 | <%= render "devise/shared/links" %>
30 |
--------------------------------------------------------------------------------
/app/views/devise/sessions/new.html.erb:
--------------------------------------------------------------------------------
1 | Log in
2 |
3 | <%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
4 |
5 | <%= f.label :email %>
6 | <%= f.email_field :email, autofocus: true %>
7 |
8 |
9 |
10 | <%= f.label :password %>
11 | <%= f.password_field :password, autocomplete: "off" %>
12 |
13 |
14 | <% if devise_mapping.rememberable? -%>
15 |
16 | <%= f.check_box :remember_me %>
17 | <%= f.label :remember_me %>
18 |
19 | <% end -%>
20 |
21 |
22 | <%= f.submit "Log in" %>
23 |
24 | <% end %>
25 |
26 | <%= render "devise/shared/links" %>
27 |
--------------------------------------------------------------------------------
/app/views/devise/shared/_links.html.erb:
--------------------------------------------------------------------------------
1 | <%- if controller_name != 'sessions' %>
2 | <%= link_to "Log in", new_session_path(resource_name) %>
3 | <% end -%>
4 |
5 | <%- if devise_mapping.registerable? && controller_name != 'registrations' %>
6 | <%= link_to "Sign up", new_registration_path(resource_name) %>
7 | <% end -%>
8 |
9 | <%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
10 | <%= link_to "Forgot your password?", new_password_path(resource_name) %>
11 | <% end -%>
12 |
13 | <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
14 | <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %>
15 | <% end -%>
16 |
17 | <%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
18 | <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %>
19 | <% end -%>
20 |
21 | <%- if devise_mapping.omniauthable? %>
22 | <%- resource_class.omniauth_providers.each do |provider| %>
23 | <%= link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider) %>
24 | <% end -%>
25 | <% end -%>
26 |
--------------------------------------------------------------------------------
/app/views/devise/unlocks/new.html.erb:
--------------------------------------------------------------------------------
1 | Resend unlock instructions
2 |
3 | <%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %>
4 | <%= devise_error_messages! %>
5 |
6 |
7 | <%= f.label :email %>
8 | <%= f.email_field :email, autofocus: true %>
9 |
10 |
11 |
12 | <%= f.submit "Resend unlock instructions" %>
13 |
14 | <% end %>
15 |
16 | <%= render "devise/shared/links" %>
17 |
--------------------------------------------------------------------------------
/app/views/layouts/application.html.slim:
--------------------------------------------------------------------------------
1 | doctype html
2 |
3 | html.w100p.h100p
4 | head
5 | meta charset='utf-8'
6 | title Rails5App
7 |
8 | = action_cable_meta_tag
9 | = csrf_meta_tags
10 |
11 | = stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload'
12 | = javascript_include_tag 'application', 'data-turbolinks-track': 'reload'
13 |
14 | body.w100p.h100p.ffa
15 | .w80p.ma
16 | .mt20.mb20
17 | = yield
18 |
--------------------------------------------------------------------------------
/app/views/layouts/mailer.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
8 |
9 |
10 |
11 | <%= yield %>
12 |
13 |
14 |
--------------------------------------------------------------------------------
/app/views/layouts/mailer.text.erb:
--------------------------------------------------------------------------------
1 | <%= yield %>
2 |
--------------------------------------------------------------------------------
/app/views/notes/_form.html.slim:
--------------------------------------------------------------------------------
1 | - if @note.errors.any?
2 | #error_explanation.mb40
3 | .fs22.mb20 = "#{pluralize(@note.errors.count, "error")} prohibited this note from being saved:"
4 | ul.ul
5 | - @note.errors.full_messages.each do |message|
6 | li.li.fs18.lh130 = message
7 |
8 | = form_for @note do |f|
9 | .field.mb20
10 | = f.label :title, class: 'block mb10 fs16'
11 | = f.text_field :title, class: 'ptz_input ptz_size-16 w400'
12 | .field.mb20
13 | = f.label :content, class: 'block mb10 fs16'
14 | = f.text_area :content, class: 'ptz_textarea ptz_size-16 w400', rows: 7
15 | .actions
16 | = f.submit 'Save Note', class: 'ptz_btn ptz_size-18'
17 |
--------------------------------------------------------------------------------
/app/views/notes/_note.json.jbuilder:
--------------------------------------------------------------------------------
1 | json.extract! note, :id, :title, :content, :created_at, :updated_at
2 | json.url note_url(note, format: :json)
--------------------------------------------------------------------------------
/app/views/notes/edit.html.slim:
--------------------------------------------------------------------------------
1 | .fs24.mb50 Editing note
2 |
3 | .mb50== render 'form'
4 |
5 | = link_to 'Show', @note, class: 'ptz_btn ptz_size-14 mr30'
6 | = link_to 'Back to Index page', notes_path, class: 'ptz_btn ptz_size-14'
7 |
8 |
--------------------------------------------------------------------------------
/app/views/notes/index.html.slim:
--------------------------------------------------------------------------------
1 | .ptz_table.fs24.mb50
2 | .ptz_td.vam
3 | | Notes Index
4 | .ptz_td.vam.pl30
5 | = link_to 'Create New Note', new_note_path, class: 'ptz_btn ptz_size-18'
6 |
7 | - if @notes.blank?
8 | .fs20.mb20 There is no any note yet
9 | - else
10 | .pull-right.w300.ml20.mb20
11 | .mb30= render partial: 'search/form'
12 | .mb10= render(template: 'notes/random', locals: { note: Note.random.first })
13 | .mb20.fs14.i.js-current-time= Time.now.to_s(:db)
14 |
15 | = render template: 'notes/list', locals: { notes: @notes }
16 | .fs18.lh120
17 | = paginate @notes
18 |
--------------------------------------------------------------------------------
/app/views/notes/list.html.slim:
--------------------------------------------------------------------------------
1 | - notes.each do |note|
2 | .mb30
3 | .fs18.lh130.mb10.b= link_to note.title, note
4 | .fs16.lh130.mb10= note.content
5 | .fs16
6 | span.mr30
7 | | by:
8 | - if note.user
9 | span.i<= note.user.email
10 | - else
11 | span.i Guest
12 |
13 | span.mr30
14 | | created at:
15 | span.i<= note.created_at.to_s(:db)
16 |
--------------------------------------------------------------------------------
/app/views/notes/new.html.slim:
--------------------------------------------------------------------------------
1 | .fs24.mb50 New note
2 |
3 | .mb50== render 'form'
4 |
5 | = link_to 'Back to Index page', notes_path, class: 'ptz_btn ptz_size-14'
6 |
--------------------------------------------------------------------------------
/app/views/notes/random.html.slim:
--------------------------------------------------------------------------------
1 | .p20.notes-random.js-notes-random_note
2 | .fs18.b.mb10.lh130= note.title
3 | .fs15.lh130= note.content
4 |
--------------------------------------------------------------------------------
/app/views/notes/show.html.slim:
--------------------------------------------------------------------------------
1 | - if notice.present?
2 | .fs18.mb30#notice
3 | = notice
4 |
5 | .fs24.lh130.mb40= @note.title
6 | .fs18.lh130.mb40= @note.content
7 |
8 | = link_to 'Edit', edit_note_path(@note), class: 'ptz_btn ptz_size-14 mr30'
9 | = link_to 'Back to Index page', notes_path, class: 'ptz_btn ptz_size-14'
10 |
--------------------------------------------------------------------------------
/app/views/notes/show.json.jbuilder:
--------------------------------------------------------------------------------
1 | json.partial! "notes/note", note: @note
--------------------------------------------------------------------------------
/app/views/notes/ws_random.json.jbuilder:
--------------------------------------------------------------------------------
1 | json.set! :html_content, {
2 | html: {
3 | '.js-current-time': Time.now.to_s(:db)
4 | },
5 |
6 | replaceWith: {
7 | '.js-notes-random_note' => render_view(
8 | layout: false,
9 | template: 'notes/random',
10 | locals: { note: Note.random.first}
11 | )
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/app/views/search/_form.html.slim:
--------------------------------------------------------------------------------
1 | = form_tag search_path, method: :get, enforce_utf8: false, class: 'search-form p20' do
2 | .mb20= text_field_tag :q, params[:q], placeholder: 'Search query', class: 'ptz_input ptz_size-18 w100p'
3 | = submit_tag 'Search', class: 'js-search-submit_btn ptz_btn ptz_size-18', autocomplete: false
4 |
--------------------------------------------------------------------------------
/app/views/search/search.html.slim:
--------------------------------------------------------------------------------
1 | .mb30= link_to 'Back to Index page', notes_path, class: 'ptz_btn ptz_size-14'
2 |
3 | .fs24.mb25
4 | | Search by:
5 | =< @q
6 |
7 | - if @notes.count > 0
8 | .mb50.fs15.i
9 | | Results:
10 | =<> @notes.size
11 | | of
12 | =< @notes.count
13 |
14 | .mb25= render partial: 'search/form'
15 |
16 | - if @notes.blank?
17 | .fs20.mb20 Nothing to show
18 | - else
19 | = render template: 'notes/list', locals: { notes: @notes }
20 | .fs18.lh120
21 | = paginate @notes
22 |
--------------------------------------------------------------------------------
/app/workers/notes_random_worker.rb:
--------------------------------------------------------------------------------
1 | class NotesRandomWorker
2 | include Sidekiq::Worker
3 | include ChannelHelper
4 |
5 | def perform(*args)
6 | broadcast 'notes_channel', render_json(
7 | layout: false,
8 | template: 'notes/ws_random.json.jbuilder',
9 | locals: { note: Note.random.first }
10 | )
11 | end
12 | end
13 |
--------------------------------------------------------------------------------
/bin/bundle:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3 | load Gem.bin_path('bundler', 'bundle')
4 |
--------------------------------------------------------------------------------
/bin/bundler:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 | #
4 | # This file was generated by Bundler.
5 | #
6 | # The application 'bundler' is installed as part of a gem, and
7 | # this file is here to facilitate running it.
8 | #
9 |
10 | require "pathname"
11 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12 | Pathname.new(__FILE__).realpath)
13 |
14 | require "rubygems"
15 | require "bundler/setup"
16 |
17 | load Gem.bin_path("bundler", "bundler")
18 |
--------------------------------------------------------------------------------
/bin/byebug:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 | #
4 | # This file was generated by Bundler.
5 | #
6 | # The application 'byebug' is installed as part of a gem, and
7 | # this file is here to facilitate running it.
8 | #
9 |
10 | require "pathname"
11 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12 | Pathname.new(__FILE__).realpath)
13 |
14 | require "rubygems"
15 | require "bundler/setup"
16 |
17 | load Gem.bin_path("byebug", "byebug")
18 |
--------------------------------------------------------------------------------
/bin/coderay:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 | #
4 | # This file was generated by Bundler.
5 | #
6 | # The application 'coderay' is installed as part of a gem, and
7 | # this file is here to facilitate running it.
8 | #
9 |
10 | require "pathname"
11 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12 | Pathname.new(__FILE__).realpath)
13 |
14 | require "rubygems"
15 | require "bundler/setup"
16 |
17 | load Gem.bin_path("coderay", "coderay")
18 |
--------------------------------------------------------------------------------
/bin/erubis:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 | #
4 | # This file was generated by Bundler.
5 | #
6 | # The application 'erubis' is installed as part of a gem, and
7 | # this file is here to facilitate running it.
8 | #
9 |
10 | require "pathname"
11 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12 | Pathname.new(__FILE__).realpath)
13 |
14 | require "rubygems"
15 | require "bundler/setup"
16 |
17 | load Gem.bin_path("erubis", "erubis")
18 |
--------------------------------------------------------------------------------
/bin/foreman:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 | #
4 | # This file was generated by Bundler.
5 | #
6 | # The application 'foreman' is installed as part of a gem, and
7 | # this file is here to facilitate running it.
8 | #
9 |
10 | require "pathname"
11 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12 | Pathname.new(__FILE__).realpath)
13 |
14 | require "rubygems"
15 | require "bundler/setup"
16 |
17 | load Gem.bin_path("foreman", "foreman")
18 |
--------------------------------------------------------------------------------
/bin/listen:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 | #
4 | # This file was generated by Bundler.
5 | #
6 | # The application 'listen' is installed as part of a gem, and
7 | # this file is here to facilitate running it.
8 | #
9 |
10 | require "pathname"
11 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12 | Pathname.new(__FILE__).realpath)
13 |
14 | require "rubygems"
15 | require "bundler/setup"
16 |
17 | load Gem.bin_path("listen", "listen")
18 |
--------------------------------------------------------------------------------
/bin/nokogiri:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 | #
4 | # This file was generated by Bundler.
5 | #
6 | # The application 'nokogiri' is installed as part of a gem, and
7 | # this file is here to facilitate running it.
8 | #
9 |
10 | require "pathname"
11 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12 | Pathname.new(__FILE__).realpath)
13 |
14 | require "rubygems"
15 | require "bundler/setup"
16 |
17 | load Gem.bin_path("nokogiri", "nokogiri")
18 |
--------------------------------------------------------------------------------
/bin/oauth:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 | #
4 | # This file was generated by Bundler.
5 | #
6 | # The application 'oauth' is installed as part of a gem, and
7 | # this file is here to facilitate running it.
8 | #
9 |
10 | require "pathname"
11 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12 | Pathname.new(__FILE__).realpath)
13 |
14 | require "rubygems"
15 | require "bundler/setup"
16 |
17 | load Gem.bin_path("oauth", "oauth")
18 |
--------------------------------------------------------------------------------
/bin/pry:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 | #
4 | # This file was generated by Bundler.
5 | #
6 | # The application 'pry' is installed as part of a gem, and
7 | # this file is here to facilitate running it.
8 | #
9 |
10 | require "pathname"
11 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12 | Pathname.new(__FILE__).realpath)
13 |
14 | require "rubygems"
15 | require "bundler/setup"
16 |
17 | load Gem.bin_path("pry", "pry")
18 |
--------------------------------------------------------------------------------
/bin/puma:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 | #
4 | # This file was generated by Bundler.
5 | #
6 | # The application 'puma' is installed as part of a gem, and
7 | # this file is here to facilitate running it.
8 | #
9 |
10 | require "pathname"
11 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12 | Pathname.new(__FILE__).realpath)
13 |
14 | require "rubygems"
15 | require "bundler/setup"
16 |
17 | load Gem.bin_path("puma", "puma")
18 |
--------------------------------------------------------------------------------
/bin/pumactl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 | #
4 | # This file was generated by Bundler.
5 | #
6 | # The application 'pumactl' is installed as part of a gem, and
7 | # this file is here to facilitate running it.
8 | #
9 |
10 | require "pathname"
11 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12 | Pathname.new(__FILE__).realpath)
13 |
14 | require "rubygems"
15 | require "bundler/setup"
16 |
17 | load Gem.bin_path("puma", "pumactl")
18 |
--------------------------------------------------------------------------------
/bin/rackup:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 | #
4 | # This file was generated by Bundler.
5 | #
6 | # The application 'rackup' is installed as part of a gem, and
7 | # this file is here to facilitate running it.
8 | #
9 |
10 | require "pathname"
11 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12 | Pathname.new(__FILE__).realpath)
13 |
14 | require "rubygems"
15 | require "bundler/setup"
16 |
17 | load Gem.bin_path("rack", "rackup")
18 |
--------------------------------------------------------------------------------
/bin/rails:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | APP_PATH = File.expand_path('../config/application', __dir__)
3 | require_relative '../config/boot'
4 | require 'rails/commands'
5 |
--------------------------------------------------------------------------------
/bin/rake:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | require_relative '../config/boot'
3 | require 'rake'
4 | Rake.application.run
5 |
--------------------------------------------------------------------------------
/bin/sass:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 | #
4 | # This file was generated by Bundler.
5 | #
6 | # The application 'sass' is installed as part of a gem, and
7 | # this file is here to facilitate running it.
8 | #
9 |
10 | require "pathname"
11 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12 | Pathname.new(__FILE__).realpath)
13 |
14 | require "rubygems"
15 | require "bundler/setup"
16 |
17 | load Gem.bin_path("sass", "sass")
18 |
--------------------------------------------------------------------------------
/bin/sass-convert:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 | #
4 | # This file was generated by Bundler.
5 | #
6 | # The application 'sass-convert' is installed as part of a gem, and
7 | # this file is here to facilitate running it.
8 | #
9 |
10 | require "pathname"
11 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12 | Pathname.new(__FILE__).realpath)
13 |
14 | require "rubygems"
15 | require "bundler/setup"
16 |
17 | load Gem.bin_path("sass", "sass-convert")
18 |
--------------------------------------------------------------------------------
/bin/scss:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 | #
4 | # This file was generated by Bundler.
5 | #
6 | # The application 'scss' is installed as part of a gem, and
7 | # this file is here to facilitate running it.
8 | #
9 |
10 | require "pathname"
11 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12 | Pathname.new(__FILE__).realpath)
13 |
14 | require "rubygems"
15 | require "bundler/setup"
16 |
17 | load Gem.bin_path("sass", "scss")
18 |
--------------------------------------------------------------------------------
/bin/setup:
--------------------------------------------------------------------------------
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 | # Install JavaScript dependencies if using Yarn
22 | # system('bin/yarn')
23 |
24 |
25 | # puts "\n== Copying sample files =="
26 | # unless File.exist?('config/database.yml')
27 | # cp 'config/database.yml.sample', 'config/database.yml'
28 | # end
29 |
30 | puts "\n== Preparing database =="
31 | system! 'bin/rails db:setup'
32 |
33 | puts "\n== Removing old logs and tempfiles =="
34 | system! 'bin/rails log:clear tmp:clear'
35 |
36 | puts "\n== Restarting application server =="
37 | system! 'bin/rails restart'
38 | end
39 |
--------------------------------------------------------------------------------
/bin/sidekiq:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 | #
4 | # This file was generated by Bundler.
5 | #
6 | # The application 'sidekiq' is installed as part of a gem, and
7 | # this file is here to facilitate running it.
8 | #
9 |
10 | require "pathname"
11 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12 | Pathname.new(__FILE__).realpath)
13 |
14 | require "rubygems"
15 | require "bundler/setup"
16 |
17 | load Gem.bin_path("sidekiq", "sidekiq")
18 |
--------------------------------------------------------------------------------
/bin/sidekiqctl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 | #
4 | # This file was generated by Bundler.
5 | #
6 | # The application 'sidekiqctl' is installed as part of a gem, and
7 | # this file is here to facilitate running it.
8 | #
9 |
10 | require "pathname"
11 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12 | Pathname.new(__FILE__).realpath)
13 |
14 | require "rubygems"
15 | require "bundler/setup"
16 |
17 | load Gem.bin_path("sidekiq", "sidekiqctl")
18 |
--------------------------------------------------------------------------------
/bin/slimrb:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 | #
4 | # This file was generated by Bundler.
5 | #
6 | # The application 'slimrb' is installed as part of a gem, and
7 | # this file is here to facilitate running it.
8 | #
9 |
10 | require "pathname"
11 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12 | Pathname.new(__FILE__).realpath)
13 |
14 | require "rubygems"
15 | require "bundler/setup"
16 |
17 | load Gem.bin_path("slim", "slimrb")
18 |
--------------------------------------------------------------------------------
/bin/sprockets:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 | #
4 | # This file was generated by Bundler.
5 | #
6 | # The application 'sprockets' is installed as part of a gem, and
7 | # this file is here to facilitate running it.
8 | #
9 |
10 | require "pathname"
11 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12 | Pathname.new(__FILE__).realpath)
13 |
14 | require "rubygems"
15 | require "bundler/setup"
16 |
17 | load Gem.bin_path("sprockets", "sprockets")
18 |
--------------------------------------------------------------------------------
/bin/thor:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 | #
4 | # This file was generated by Bundler.
5 | #
6 | # The application 'thor' is installed as part of a gem, and
7 | # this file is here to facilitate running it.
8 | #
9 |
10 | require "pathname"
11 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12 | Pathname.new(__FILE__).realpath)
13 |
14 | require "rubygems"
15 | require "bundler/setup"
16 |
17 | load Gem.bin_path("thor", "thor")
18 |
--------------------------------------------------------------------------------
/bin/tilt:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 | #
4 | # This file was generated by Bundler.
5 | #
6 | # The application 'tilt' is installed as part of a gem, and
7 | # this file is here to facilitate running it.
8 | #
9 |
10 | require "pathname"
11 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12 | Pathname.new(__FILE__).realpath)
13 |
14 | require "rubygems"
15 | require "bundler/setup"
16 |
17 | load Gem.bin_path("tilt", "tilt")
18 |
--------------------------------------------------------------------------------
/bin/update:
--------------------------------------------------------------------------------
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 | puts "\n== Updating database =="
21 | system! 'bin/rails db:migrate'
22 |
23 | puts "\n== Removing old logs and tempfiles =="
24 | system! 'bin/rails log:clear tmp:clear'
25 |
26 | puts "\n== Restarting application server =="
27 | system! 'bin/rails restart'
28 | end
29 |
--------------------------------------------------------------------------------
/bin/webpack:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | require 'shellwords'
3 |
4 | ENV['RAILS_ENV'] ||= 'development'
5 | RAILS_ENV = ENV['RAILS_ENV']
6 |
7 | ENV['NODE_ENV'] ||= RAILS_ENV
8 | NODE_ENV = ENV['NODE_ENV']
9 |
10 | APP_PATH = File.expand_path('../', __dir__)
11 | ESCAPED_APP_PATH = APP_PATH.shellescape
12 |
13 | SET_NODE_PATH = "NODE_PATH=#{ESCAPED_APP_PATH}/node_modules"
14 | WEBPACK_BIN = "./node_modules/webpack/bin/webpack.js"
15 | WEBPACK_CONFIG = "#{ESCAPED_APP_PATH}/config/webpack/#{NODE_ENV}.js"
16 |
17 | Dir.chdir(APP_PATH) do
18 | exec "#{SET_NODE_PATH} #{WEBPACK_BIN} --config #{WEBPACK_CONFIG} #{ARGV.join(" ")}"
19 | end
20 |
--------------------------------------------------------------------------------
/bin/webpack-dev-server:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | require 'shellwords'
3 |
4 | ENV['RAILS_ENV'] ||= 'development'
5 | RAILS_ENV = ENV['RAILS_ENV']
6 |
7 | ENV['NODE_ENV'] ||= RAILS_ENV
8 | NODE_ENV = ENV['NODE_ENV']
9 |
10 | APP_PATH = File.expand_path('../', __dir__)
11 | ESCAPED_APP_PATH = APP_PATH.shellescape
12 |
13 | SET_NODE_PATH = "NODE_PATH=#{ESCAPED_APP_PATH}/node_modules"
14 | WEBPACKER_BIN = "./node_modules/.bin/webpack-dev-server"
15 | WEBPACK_CONFIG = "#{ESCAPED_APP_PATH}/config/webpack/#{NODE_ENV}.js"
16 |
17 | # Warn the user if the configuration is not set
18 | RAILS_ENV_CONFIG = File.join("config", "environments", "#{RAILS_ENV}.rb")
19 |
20 | # Look into the environment file for a non-commented variable declaration
21 | unless File.foreach(File.join(APP_PATH, RAILS_ENV_CONFIG)).detect { |line| line.match(/^\s*[^#]*config\.x\.webpacker\[\:dev_server_host\].*=/) }
22 | puts "Warning: if you want to use webpack-dev-server, you need to tell Webpacker to serve asset packs from it. Please set config.x.webpacker[:dev_server_host] in #{RAILS_ENV_CONFIG}.\n\n"
23 | end
24 |
25 | Dir.chdir(APP_PATH) do
26 | exec "#{SET_NODE_PATH} #{WEBPACKER_BIN} --config #{WEBPACK_CONFIG} --content-base #{ESCAPED_APP_PATH}/public/packs #{ARGV.join(" ")}"
27 | end
28 |
--------------------------------------------------------------------------------
/bin/webpack-watcher:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | ENV['RAILS_ENV'] ||= 'development'
4 | ENV['NODE_ENV'] ||= ENV['RAILS_ENV']
5 |
6 | BIN_PATH = File.expand_path('.', __dir__)
7 |
8 | Dir.chdir(BIN_PATH) do
9 | exec "./webpack --watch --progress --color #{ARGV.join(" ")}"
10 | end
11 |
--------------------------------------------------------------------------------
/bin/whenever:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 | #
4 | # This file was generated by Bundler.
5 | #
6 | # The application 'whenever' is installed as part of a gem, and
7 | # this file is here to facilitate running it.
8 | #
9 |
10 | require "pathname"
11 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12 | Pathname.new(__FILE__).realpath)
13 |
14 | require "rubygems"
15 | require "bundler/setup"
16 |
17 | load Gem.bin_path("whenever", "whenever")
18 |
--------------------------------------------------------------------------------
/bin/wheneverize:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 | #
4 | # This file was generated by Bundler.
5 | #
6 | # The application 'wheneverize' is installed as part of a gem, and
7 | # this file is here to facilitate running it.
8 | #
9 |
10 | require "pathname"
11 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12 | Pathname.new(__FILE__).realpath)
13 |
14 | require "rubygems"
15 | require "bundler/setup"
16 |
17 | load Gem.bin_path("whenever", "wheneverize")
18 |
--------------------------------------------------------------------------------
/bin/yarn:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | VENDOR_PATH = File.expand_path('..', __dir__)
3 | Dir.chdir(VENDOR_PATH) do
4 | begin
5 | exec "yarnpkg #{ARGV.join(" ")}"
6 | rescue Errno::ENOENT
7 | puts "Yarn executable was not detected in the system."
8 | puts "Download Yarn at https://yarnpkg.com/en/docs/install"
9 | end
10 | end
11 |
--------------------------------------------------------------------------------
/config.ru:
--------------------------------------------------------------------------------
1 | # This file is used by Rack-based servers to start the application.
2 |
3 | require_relative 'config/environment'
4 |
5 | run Rails.application
6 |
--------------------------------------------------------------------------------
/config/ENV/production.example/services/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DeployRB/Rails5App/04efd4f6d812e34d7969c667c149b6f9b46d801a/config/ENV/production.example/services/.keep
--------------------------------------------------------------------------------
/config/ENV/production.example/services/puma.rb:
--------------------------------------------------------------------------------
1 | # THIS FILE SHOULDN'T BE USED ON A PRODUCTION SERVER
2 | # SEE `config/ENV/production/services` directory
3 |
4 | # https://github.com/puma/puma/blob/master/examples/config.rb
5 | # https://www.digitalocean.com/community/tutorials/how-to-deploy-a-rails-app-with-puma-and-nginx-on-ubuntu-14-04
6 |
7 | # Puma can serve each request in a thread from an internal thread pool.
8 | # The `threads` method setting takes two numbers: a minimum and maximum.
9 | # Any libraries that use thread pools should be configured to match
10 | # the maximum value specified for Puma. Default is set to 5 threads for minimum
11 | # and maximum; this matches the default thread size of Active Record.
12 | #
13 | environment_name = ENV.fetch("RAILS_ENV") { "development" }
14 | threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
15 | workers_count = ENV.fetch("WEB_CONCURRENCY") { 2 }
16 | port_number = ENV.fetch("PORT") { 3000 }
17 |
18 | app_dir = File.expand_path("../../../../", __FILE__)
19 |
20 | sockets_dir = "#{ app_dir }/tmp/sockets"
21 | pids_dir = "#{ app_dir }/tmp/pids"
22 | logs_dir = "#{ app_dir }/log"
23 |
24 | # Specifies the number of `workers` to boot in clustered mode.
25 | # Workers are forked webserver processes. If using threads and workers together
26 | # the concurrency of the application would be max `threads` * `workers`.
27 | # Workers do not work on JRuby or Windows (both of which do not support
28 | # processes).
29 | #
30 | # Puma can serve each request in a thread from an internal thread pool.
31 | # The `threads` method setting takes two numbers a minimum and maximum.
32 | # Any libraries that use thread pools should be configured to match
33 | # the maximum value specified for Puma. Default is set to 5 threads for minimum
34 | # and maximum, this matches the default thread size of Active Record.
35 | #
36 | environment environment_name
37 | workers workers_count
38 | threads threads_count, threads_count
39 | port port_number
40 |
41 | daemonize true
42 |
43 | bind "unix://#{ sockets_dir }/puma.sock"
44 |
45 | pidfile "#{ pids_dir }/puma.pid"
46 | state_path "#{ pids_dir }/puma.state"
47 |
48 | stdout_redirect \
49 | "#{ logs_dir }/puma.stdout.log",
50 | "#{ logs_dir }/puma.stderr.log",
51 | true
52 |
53 | activate_control_app
54 |
55 | # If you are preloading your application and using Active Record, it's
56 | # recommended that you close any connections to the database before workers
57 | # are forked to prevent connection leakage.
58 | #
59 | # before_fork do
60 | # ActiveRecord::Base.connection_pool.disconnect! if defined?(ActiveRecord)
61 | # end
62 |
63 | # The code in the `on_worker_boot` will be called if you are using
64 | # clustered mode by specifying a number of `workers`. After each worker
65 | # process is booted, this block will be run. If you are using the `preload_app!`
66 | # option, you will want to use this block to reconnect to any threads
67 | # or connections that may have been created at application boot, as Ruby
68 | # cannot share connections between processes.
69 | #
70 |
71 | on_worker_boot do
72 | require "active_record"
73 | ActiveRecord::Base.connection.disconnect! rescue ActiveRecord::ConnectionNotEstablished
74 | ActiveRecord::Base.establish_connection(YAML.load_file("#{app_dir}/config/database.yml")[environment_name])
75 | end
76 |
77 | # Use the `preload_app!` method when specifying a `workers` number.
78 | # This directive tells Puma to first boot the application and load code
79 | # before forking the application. This takes advantage of Copy On Write
80 | # process behavior so workers use less memory. If you use this option
81 | # you need to make sure to reconnect any threads in the `on_worker_boot`
82 | # block.
83 | #
84 | # preload_app!
85 |
--------------------------------------------------------------------------------
/config/ENV/production.example/services/redis.config:
--------------------------------------------------------------------------------
1 | # THIS FILE HAS TO BE OVERWRITTEN BY DEPLOY TOOL
2 |
3 | # don't demonize in dev mode for Foreman
4 | # daemonize yes
5 |
6 | port 6010
7 |
8 | dir /ABS/PATH/TO/Rails5App/db/REDIS
9 | dbfilename redis_6010.rdb
10 |
11 | loglevel debug
12 | logfile /ABS/PATH/TO/Rails5App/log/redis.log
13 | pidfile /ABS/PATH/TO/Rails5App/tmp/pids/redis.pid
14 |
15 | save 60 1
16 |
--------------------------------------------------------------------------------
/config/ENV/production.example/services/schedule.rb:
--------------------------------------------------------------------------------
1 | # http://en.wikipedia.org/wiki/Cron
2 | # Learn more: http://github.com/javan/whenever
3 |
4 | # START: whenever --update-crontab --load-file config/ENV/services/schedule.rb --set 'environment=development'
5 | # SHOW: crontab -l
6 | # STOP: whenever --clear-crontab --load-file config/ENV/services/schedule.rb --set 'environment=development'
7 |
8 | set :rails_root, path
9 |
10 | set :output, {
11 | standard: "#{ rails_root }/log/cron.log",
12 | error: "#{ rails_root }/log/cron.errors.log"
13 | }
14 |
15 | job_type :rake, "cd :rails_root && RAILS_ENV=:environment bin/rake :task :output"
16 | job_type :runner, "cd :rails_root && bin/rails runner -e :environment ':task' :output"
17 |
18 | every 1.minute do
19 | rake 'ts:index'
20 | end
21 |
22 | every 1.minute do
23 | runner 'NotesRandomWorker.perform_in(2.minutes)'
24 | end
25 |
--------------------------------------------------------------------------------
/config/ENV/production.example/services/sidekiq.yml:
--------------------------------------------------------------------------------
1 | # THIS FILE HAS TO BE OVERWRITTEN BY DEPLOY TOOL
2 | ---
3 | :verbose: true
4 | :concurrency: 10
5 | :logfile: /ABS/PATH/TO/Rails5App/log/sidekiq.log
6 | :pidfile: /ABS/PATH/TO/Rails5App/tmp/pids/sidekiq.pid
7 |
8 | :queues:
9 | - [critical, 5]
10 | - [default, 2]
11 | - [mailers, 2]
12 | - [low, 1]
13 |
14 | # gem 'sidekiq-limit_fetch'
15 | #
16 | # :limits:
17 | # critical: 5
18 | # default: 2
19 | # mailers: 1
20 | # low: 1
21 |
--------------------------------------------------------------------------------
/config/ENV/production.example/services/thinking_sphinx.yml:
--------------------------------------------------------------------------------
1 | production.example:
2 | mysql41: 9191
3 | address: localhost
4 | morphology: 'stem_en, stem_ru'
5 |
6 | indices_location: /ABS/PATH/TO/Rails5App/db/SPHINX
7 | configuration_file: /ABS/PATH/TO/Rails5App/config/ENV/production.example/services/SPHINX.config
8 |
9 | log: /ABS/PATH/TO/Rails5App/log/searchd.log
10 | query_log: /ABS/PATH/TO/Rails5App/log/searchd.query.log
11 | pid_file: /ABS/PATH/TO/Rails5App/tmp/pids/searchd.production.example.pid
12 | binlog_path: /ABS/PATH/TO/Rails5App/tmp/binlog/searchd.production.example
13 |
--------------------------------------------------------------------------------
/config/ENV/production.example/settings/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DeployRB/Rails5App/04efd4f6d812e34d7969c667c149b6f9b46d801a/config/ENV/production.example/settings/.keep
--------------------------------------------------------------------------------
/config/ENV/production.example/settings/app.yml:
--------------------------------------------------------------------------------
1 | app:
2 | default_locale: <%= ENV['DEFAULT_LOCALE'] || 'en' %>
3 | time_zone: 'St. Petersburg'
4 |
5 | secret_key_base: 'a000000000000000000000000000000000000000000000000001'
6 | secret_token: 'a000000000000000000000000000000000000000000000000002'
7 |
8 | redis:
9 | port: 6010
10 | url: "redis://localhost:6010/1"
11 |
12 | sidekiq:
13 | namespace: 'example.com'
14 | ui:
15 | password: qwerty
16 |
17 | action_cable:
18 | adapter_params:
19 | # adapter: async
20 | adapter: redis
21 | url: redis://localhost:6010/1
22 | channel_prefix: rails5app
23 |
24 | worker_pool_size: 4
25 | mount_path: 'ws://localhost:3000/app-cable'
26 | disable_request_forgery_protection: false
27 | allowed_request_origins: http://localhost:3000
28 |
--------------------------------------------------------------------------------
/config/ENV/production.example/settings/app_mailer.yml:
--------------------------------------------------------------------------------
1 | app:
2 | mailer:
3 | # smtp, sandmail, test, file, mailcatcher, letter_opener
4 | service: smtp
5 |
6 | host: 'http://example.com'
7 | admin_email: 'admin@example.com'
8 |
9 | smtp:
10 | default:
11 | user_name: admin@example.com
12 | password: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
13 |
14 | authentication: plain
15 | enable_starttls_auto: true
16 |
17 | address: 'smtp.yandex.ru'
18 | domain: 'yandex.ru'
19 | port: 25
20 |
21 | sandmail:
22 | location: '/usr/sbin/sendmail'
23 | arguments: '-i -t'
24 |
25 | mailcatcher:
26 | address: 'localhost'
27 | port: 1025
28 |
--------------------------------------------------------------------------------
/config/ENV/production.example/settings/oauth.yml:
--------------------------------------------------------------------------------
1 | oauth:
2 | vkontakte:
3 | tokens:
4 | - VKABC123
5 | - VKXXXXXXXXXX
6 | options:
7 | display: popup
8 |
9 | facebook:
10 | tokens:
11 | - FBABC123
12 | - FBXXXXXXXXXX
13 | options:
14 | scope: 'public_profile,user_friends,email'
15 | display: popup
16 |
17 | twitter:
18 | tokens:
19 | - TWABC123
20 | - TWXXXXXXXXXX
21 |
22 | google_oauth2:
23 | tokens:
24 | - GPABC123
25 | - GPXXXXXXXXXX
26 | options:
27 | scope: 'email, profile, plus.me'
28 | prompt: select_account
29 | image_aspect_ratio: square
30 | image_size: 50
31 | display: popup
32 | skip_jwt: true
33 |
34 | odnoklassniki:
35 | tokens:
36 | - OKABC123
37 | - OKXXXXXXXXXX
38 | options:
39 | app_public: OKXXXXXXXXXX
40 | scope: 'VALUABLE_ACCESS'
41 |
--------------------------------------------------------------------------------
/config/application.rb:
--------------------------------------------------------------------------------
1 | require_relative 'boot'
2 |
3 | require 'rails/all'
4 |
5 | # Require the gems listed in Gemfile, including any gems
6 | # you've limited to :test, :development, or :production.
7 | Bundler.require(*Rails.groups)
8 |
9 | module Rails51
10 | class Application < Rails::Application
11 | # Settings in config/environments/* take precedence over those specified here.
12 | # Application configuration should go into files in config/initializers
13 | # -- all .rb files in that directory are automatically loaded.
14 |
15 | require_relative 'configs'
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/config/boot.rb:
--------------------------------------------------------------------------------
1 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
2 |
3 | require 'bundler/setup' # Set up gems listed in the Gemfile.
4 |
--------------------------------------------------------------------------------
/config/configs.rb:
--------------------------------------------------------------------------------
1 | app = Rails.application
2 |
3 | Dir["#{ app.config.root }/config/ENV/#{ Rails.env }/settings/*.yml"].each do |settings_file|
4 | Settings.add_source!(settings_file)
5 | puts "Settings: #{settings_file}".yellow
6 | end
7 |
8 | Settings.reload!
9 |
--------------------------------------------------------------------------------
/config/database.yml.example:
--------------------------------------------------------------------------------
1 | development:
2 | adapter: postgresql
3 | encoding: unicode
4 | database: Rails5App_dev
5 | pool: 5
6 | username: rails5app
7 | password: qwerty
8 |
--------------------------------------------------------------------------------
/config/environment.rb:
--------------------------------------------------------------------------------
1 | # Load the Rails application.
2 | require_relative 'application'
3 |
4 | # Initialize the Rails application.
5 | Rails.application.initialize!
6 |
--------------------------------------------------------------------------------
/config/environments/development.rb:
--------------------------------------------------------------------------------
1 | Rails.application.configure do
2 | # Make javascript_pack_tag load assets from webpack-dev-server.
3 | # config.x.webpacker[:dev_server_host] = "http://localhost:8080"
4 |
5 | # Settings specified here will take precedence over those in config/application.rb.
6 |
7 | # In the development environment your application's code is reloaded on
8 | # every request. This slows down response time but is perfect for development
9 | # since you don't have to restart the web server when you make code changes.
10 | config.cache_classes = false
11 |
12 | # Do not eager load code on boot.
13 | config.eager_load = false
14 |
15 | # Show full error reports.
16 | config.consider_all_requests_local = true
17 |
18 | # Enable/disable caching. By default caching is disabled.
19 | if Rails.root.join('tmp/caching-dev.txt').exist?
20 | config.action_controller.perform_caching = true
21 |
22 | config.cache_store = :memory_store
23 | config.public_file_server.headers = {
24 | 'Cache-Control' => "public, max-age=#{2.days.seconds.to_i}"
25 | }
26 | else
27 | config.action_controller.perform_caching = false
28 |
29 | config.cache_store = :null_store
30 | end
31 |
32 | # Don't care if the mailer can't send.
33 | config.action_mailer.raise_delivery_errors = false
34 |
35 | config.action_mailer.perform_caching = false
36 |
37 | # Print deprecation notices to the Rails logger.
38 | config.active_support.deprecation = :log
39 |
40 | # Raise an error on page load if there are pending migrations.
41 | config.active_record.migration_error = :page_load
42 |
43 | # Debug mode disables concatenation and preprocessing of assets.
44 | # This option may cause significant delays in view rendering with a large
45 | # number of complex assets.
46 | config.assets.debug = true
47 |
48 | # Suppress logger output for asset requests.
49 | config.assets.quiet = true
50 |
51 | # Raises error for missing translations
52 | # config.action_view.raise_on_missing_translations = true
53 |
54 | # Use an evented file watcher to asynchronously detect changes in source code,
55 | # routes, locales, etc. This feature depends on the listen gem.
56 | config.file_watcher = ActiveSupport::EventedFileUpdateChecker
57 | end
58 |
--------------------------------------------------------------------------------
/config/environments/production.rb:
--------------------------------------------------------------------------------
1 | Rails.application.configure do
2 | # Make javascript_pack_tag lookup digest hash to enable long-term caching
3 | config.x.webpacker[:digesting] = true
4 |
5 | # Settings specified here will take precedence over those in config/application.rb.
6 |
7 | # Code is not reloaded between requests.
8 | config.cache_classes = true
9 |
10 | # Eager load code on boot. This eager loads most of Rails and
11 | # your application in memory, allowing both threaded web servers
12 | # and those relying on copy on write to perform better.
13 | # Rake tasks automatically ignore this option for performance.
14 | config.eager_load = true
15 |
16 | # Full error reports are disabled and caching is turned on.
17 | config.consider_all_requests_local = false
18 | config.action_controller.perform_caching = true
19 |
20 | # Attempt to read encrypted secrets from `config/secrets.yml.enc`.
21 | # Requires an encryption key in `ENV["RAILS_MASTER_KEY"]` or
22 | # `config/secrets.yml.key`.
23 | config.read_encrypted_secrets = true
24 |
25 | # Disable serving static files from the `/public` folder by default since
26 | # Apache or NGINX already handles this.
27 | config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
28 |
29 | # Compress JavaScripts and CSS.
30 | config.assets.js_compressor = :uglifier
31 | # config.assets.css_compressor = :sass
32 |
33 | # Do not fallback to assets pipeline if a precompiled asset is missed.
34 | config.assets.compile = false
35 |
36 | # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
37 |
38 | # Enable serving of images, stylesheets, and JavaScripts from an asset server.
39 | # config.action_controller.asset_host = 'http://assets.example.com'
40 |
41 | # Specifies the header that your server uses for sending files.
42 | # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
43 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
44 |
45 | # Mount Action Cable outside main process or domain
46 | # config.action_cable.mount_path = nil
47 | # config.action_cable.url = 'wss://example.com/cable'
48 | # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
49 |
50 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
51 | # config.force_ssl = true
52 |
53 | # Use the lowest log level to ensure availability of diagnostic information
54 | # when problems arise.
55 | config.log_level = :debug
56 |
57 | # Prepend all log lines with the following tags.
58 | config.log_tags = [ :request_id ]
59 |
60 | # Use a different cache store in production.
61 | # config.cache_store = :mem_cache_store
62 |
63 | # Use a real queuing backend for Active Job (and separate queues per environment)
64 | # config.active_job.queue_adapter = :resque
65 | # config.active_job.queue_name_prefix = "rails51_#{Rails.env}"
66 | config.action_mailer.perform_caching = false
67 |
68 | # Ignore bad email addresses and do not raise email delivery errors.
69 | # Set this to true and configure the email server for immediate delivery to raise delivery errors.
70 | # config.action_mailer.raise_delivery_errors = false
71 |
72 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
73 | # the I18n.default_locale when a translation cannot be found).
74 | config.i18n.fallbacks = true
75 |
76 | # Send deprecation notices to registered listeners.
77 | config.active_support.deprecation = :notify
78 |
79 | # Use default logging formatter so that PID and timestamp are not suppressed.
80 | config.log_formatter = ::Logger::Formatter.new
81 |
82 | # Use a different logger for distributed setups.
83 | # require 'syslog/logger'
84 | # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
85 |
86 | if ENV["RAILS_LOG_TO_STDOUT"].present?
87 | logger = ActiveSupport::Logger.new(STDOUT)
88 | logger.formatter = config.log_formatter
89 | config.logger = ActiveSupport::TaggedLogging.new(logger)
90 | end
91 |
92 | # Do not dump schema after migrations.
93 | config.active_record.dump_schema_after_migration = false
94 | end
95 |
--------------------------------------------------------------------------------
/config/environments/test.rb:
--------------------------------------------------------------------------------
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 public file server for tests with Cache-Control for performance.
16 | config.public_file_server.enabled = true
17 | config.public_file_server.headers = {
18 | 'Cache-Control' => "public, max-age=#{1.hour.seconds.to_i}"
19 | }
20 |
21 | # Show full error reports and disable caching.
22 | config.consider_all_requests_local = true
23 | config.action_controller.perform_caching = false
24 |
25 | # Raise exceptions instead of rendering exception templates.
26 | config.action_dispatch.show_exceptions = false
27 |
28 | # Disable request forgery protection in test environment.
29 | config.action_controller.allow_forgery_protection = false
30 | config.action_mailer.perform_caching = false
31 |
32 | # Tell Action Mailer not to deliver emails to the real world.
33 | # The :test delivery method accumulates sent emails in the
34 | # ActionMailer::Base.deliveries array.
35 | config.action_mailer.delivery_method = :test
36 |
37 | # Print deprecation notices to the stderr.
38 | config.active_support.deprecation = :stderr
39 |
40 | # Raises error for missing translations
41 | # config.action_view.raise_on_missing_translations = true
42 | end
43 |
--------------------------------------------------------------------------------
/config/initializers/_ACTION_CABLE.rb:
--------------------------------------------------------------------------------
1 | ac_params = ::Settings.action_cable
2 |
3 | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 | # APP CONFIG
5 | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6 | ac_config = Rails.application.config.action_cable
7 |
8 | # ActionCable.server.config.mount_path
9 | ac_config.mount_path = ac_params.mount_path
10 |
11 | # ActionCable.server.allowed_request_origins
12 | ac_config.allowed_request_origins = ac_params.allowed_request_origins
13 |
14 | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 | # CABLE CONFIG
16 | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
17 | cable_config = ActionCable.server.config
18 | cable_config.cable = ac_params.adapter_params.to_h
19 |
20 | cable_config.disable_request_forgery_protection = ac_params.disable_request_forgery_protection
21 | cable_config.worker_pool_size = ac_params.worker_pool_size
22 |
--------------------------------------------------------------------------------
/config/initializers/_APP_MAILER.rb:
--------------------------------------------------------------------------------
1 | app = Rails.application
2 |
3 | config = app.config
4 | mailer_config = ::Settings.app.mailer
5 |
6 | # localhost:300/rails/mailers
7 | if Rails.env.development?
8 | config.action_mailer.preview_path = "#{ Rails.root }/app/mailers"
9 | end
10 |
11 | # ======================================================
12 | # Mailer settings
13 | # ======================================================
14 |
15 | config.action_mailer.default_url_options = { host: mailer_config.host }
16 |
17 | case mailer_config.service
18 | when 'smtp'
19 | config.action_mailer.delivery_method = :smtp
20 | config.action_mailer.raise_delivery_errors = true
21 | config.action_mailer.smtp_settings = mailer_config.smtp.default.to_h
22 |
23 | when 'sandmail'
24 | config.action_mailer.raise_delivery_errors = true
25 | config.action_mailer.sendmail_settings = mailer_config.sandmail.to_h
26 |
27 | when 'mailcatcher'
28 | config.action_mailer.delivery_method = :smtp
29 | config.action_mailer.smtp_settings = mailer_config.mailcatcher.to_h
30 |
31 | when 'letter_opener'
32 | config.action_mailer.delivery_method = :letter_opener
33 |
34 | else
35 | config.action_mailer.delivery_method = :test
36 | config.action_mailer.raise_delivery_errors = false
37 | end
38 |
--------------------------------------------------------------------------------
/config/initializers/_DEVISE.rb:
--------------------------------------------------------------------------------
1 | # Use this hook to configure devise mailer, warden hooks and so forth.
2 | # Many of these configuration options can be set straight in your model.
3 | Devise.setup do |config|
4 | # The secret key used by Devise. Devise uses this key to generate
5 | # random tokens. Changing this key will render invalid all existing
6 | # confirmation, reset password and unlock tokens in the database.
7 | # Devise will use the `secret_key_base` as its `secret_key`
8 | # by default. You can change it below and use your own secret key.
9 | # config.secret_key = 'efcddce3b113e5fb261b90735215b2936423733a683f834b8252d4a4ba42c3ea4d90ddb4b13bb51c36b9c6cda3b9d931350e6eb375ffdb70dffa6ebde0cf009b'
10 |
11 | # ==> Mailer Configuration
12 | # Configure the e-mail address which will be shown in Devise::Mailer,
13 | # note that it will be overwritten if you use your own mailer class
14 | # with default "from" parameter.
15 | config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
16 |
17 | # Configure the class responsible to send e-mails.
18 | # config.mailer = 'Devise::Mailer'
19 |
20 | # Configure the parent class responsible to send e-mails.
21 | # config.parent_mailer = 'ActionMailer::Base'
22 |
23 | # ==> ORM configuration
24 | # Load and configure the ORM. Supports :active_record (default) and
25 | # :mongoid (bson_ext recommended) by default. Other ORMs may be
26 | # available as additional gems.
27 | require 'devise/orm/active_record'
28 |
29 | # ==> Configuration for any authentication mechanism
30 | # Configure which keys are used when authenticating a user. The default is
31 | # just :email. You can configure it to use [:username, :subdomain], so for
32 | # authenticating a user, both parameters are required. Remember that those
33 | # parameters are used only when authenticating and not when retrieving from
34 | # session. If you need permissions, you should implement that in a before filter.
35 | # You can also supply a hash where the value is a boolean determining whether
36 | # or not authentication should be aborted when the value is not present.
37 | # config.authentication_keys = [:email]
38 |
39 | # Configure parameters from the request object used for authentication. Each entry
40 | # given should be a request method and it will automatically be passed to the
41 | # find_for_authentication method and considered in your model lookup. For instance,
42 | # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
43 | # The same considerations mentioned for authentication_keys also apply to request_keys.
44 | # config.request_keys = []
45 |
46 | # Configure which authentication keys should be case-insensitive.
47 | # These keys will be downcased upon creating or modifying a user and when used
48 | # to authenticate or find a user. Default is :email.
49 | config.case_insensitive_keys = [:email]
50 |
51 | # Configure which authentication keys should have whitespace stripped.
52 | # These keys will have whitespace before and after removed upon creating or
53 | # modifying a user and when used to authenticate or find a user. Default is :email.
54 | config.strip_whitespace_keys = [:email]
55 |
56 | # Tell if authentication through request.params is enabled. True by default.
57 | # It can be set to an array that will enable params authentication only for the
58 | # given strategies, for example, `config.params_authenticatable = [:database]` will
59 | # enable it only for database (email + password) authentication.
60 | # config.params_authenticatable = true
61 |
62 | # Tell if authentication through HTTP Auth is enabled. False by default.
63 | # It can be set to an array that will enable http authentication only for the
64 | # given strategies, for example, `config.http_authenticatable = [:database]` will
65 | # enable it only for database authentication. The supported strategies are:
66 | # :database = Support basic authentication with authentication key + password
67 | # config.http_authenticatable = false
68 |
69 | # If 401 status code should be returned for AJAX requests. True by default.
70 | # config.http_authenticatable_on_xhr = true
71 |
72 | # The realm used in Http Basic Authentication. 'Application' by default.
73 | # config.http_authentication_realm = 'Application'
74 |
75 | # It will change confirmation, password recovery and other workflows
76 | # to behave the same regardless if the e-mail provided was right or wrong.
77 | # Does not affect registerable.
78 | # config.paranoid = true
79 |
80 | # By default Devise will store the user in session. You can skip storage for
81 | # particular strategies by setting this option.
82 | # Notice that if you are skipping storage for all authentication paths, you
83 | # may want to disable generating routes to Devise's sessions controller by
84 | # passing skip: :sessions to `devise_for` in your config/routes.rb
85 | config.skip_session_storage = [:http_auth]
86 |
87 | # By default, Devise cleans up the CSRF token on authentication to
88 | # avoid CSRF token fixation attacks. This means that, when using AJAX
89 | # requests for sign in and sign up, you need to get a new CSRF token
90 | # from the server. You can disable this option at your own risk.
91 | # config.clean_up_csrf_token_on_authentication = true
92 |
93 | # ==> Configuration for :database_authenticatable
94 | # For bcrypt, this is the cost for hashing the password and defaults to 11. If
95 | # using other algorithms, it sets how many times you want the password to be hashed.
96 | #
97 | # Limiting the stretches to just one in testing will increase the performance of
98 | # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
99 | # a value less than 10 in other environments. Note that, for bcrypt (the default
100 | # algorithm), the cost increases exponentially with the number of stretches (e.g.
101 | # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
102 | config.stretches = Rails.env.test? ? 1 : 11
103 |
104 | # Set up a pepper to generate the hashed password.
105 | # config.pepper = 'e56a4d8ac216fc49b81b8ef6cd7491f5e8ef05c02d0f7e895874c77ec85d91243a359fd01302d4187a9e3ad3990e93bb71927fdc2a54a7c004947688a42c9b54'
106 |
107 | # Send a notification email when the user's password is changed
108 | # config.send_password_change_notification = false
109 |
110 | # ==> Configuration for :confirmable
111 | # A period that the user is allowed to access the website even without
112 | # confirming their account. For instance, if set to 2.days, the user will be
113 | # able to access the website for two days without confirming their account,
114 | # access will be blocked just in the third day. Default is 0.days, meaning
115 | # the user cannot access the website without confirming their account.
116 | # config.allow_unconfirmed_access_for = 2.days
117 |
118 | # A period that the user is allowed to confirm their account before their
119 | # token becomes invalid. For example, if set to 3.days, the user can confirm
120 | # their account within 3 days after the mail was sent, but on the fourth day
121 | # their account can't be confirmed with the token any more.
122 | # Default is nil, meaning there is no restriction on how long a user can take
123 | # before confirming their account.
124 | # config.confirm_within = 3.days
125 |
126 | # If true, requires any email changes to be confirmed (exactly the same way as
127 | # initial account confirmation) to be applied. Requires additional unconfirmed_email
128 | # db field (see migrations). Until confirmed, new email is stored in
129 | # unconfirmed_email column, and copied to email column on successful confirmation.
130 | config.reconfirmable = true
131 |
132 | # Defines which key will be used when confirming an account
133 | # config.confirmation_keys = [:email]
134 |
135 | # ==> Configuration for :rememberable
136 | # The time the user will be remembered without asking for credentials again.
137 | # config.remember_for = 2.weeks
138 |
139 | # Invalidates all the remember me tokens when the user signs out.
140 | config.expire_all_remember_me_on_sign_out = true
141 |
142 | # If true, extends the user's remember period when remembered via cookie.
143 | # config.extend_remember_period = false
144 |
145 | # Options to be passed to the created cookie. For instance, you can set
146 | # secure: true in order to force SSL only cookies.
147 | # config.rememberable_options = {}
148 |
149 | # ==> Configuration for :validatable
150 | # Range for password length.
151 | config.password_length = 6..128
152 |
153 | # Email regex used to validate email formats. It simply asserts that
154 | # one (and only one) @ exists in the given string. This is mainly
155 | # to give user feedback and not to assert the e-mail validity.
156 | config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
157 |
158 | # ==> Configuration for :timeoutable
159 | # The time you want to timeout the user session without activity. After this
160 | # time the user will be asked for credentials again. Default is 30 minutes.
161 | # config.timeout_in = 30.minutes
162 |
163 | # ==> Configuration for :lockable
164 | # Defines which strategy will be used to lock an account.
165 | # :failed_attempts = Locks an account after a number of failed attempts to sign in.
166 | # :none = No lock strategy. You should handle locking by yourself.
167 | # config.lock_strategy = :failed_attempts
168 |
169 | # Defines which key will be used when locking and unlocking an account
170 | # config.unlock_keys = [:email]
171 |
172 | # Defines which strategy will be used to unlock an account.
173 | # :email = Sends an unlock link to the user email
174 | # :time = Re-enables login after a certain amount of time (see :unlock_in below)
175 | # :both = Enables both strategies
176 | # :none = No unlock strategy. You should handle unlocking by yourself.
177 | # config.unlock_strategy = :both
178 |
179 | # Number of authentication tries before locking an account if lock_strategy
180 | # is failed attempts.
181 | # config.maximum_attempts = 20
182 |
183 | # Time interval to unlock the account if :time is enabled as unlock_strategy.
184 | # config.unlock_in = 1.hour
185 |
186 | # Warn on the last attempt before the account is locked.
187 | # config.last_attempt_warning = true
188 |
189 | # ==> Configuration for :recoverable
190 | #
191 | # Defines which key will be used when recovering the password for an account
192 | # config.reset_password_keys = [:email]
193 |
194 | # Time interval you can reset your password with a reset password key.
195 | # Don't put a too small interval or your users won't have the time to
196 | # change their passwords.
197 | config.reset_password_within = 6.hours
198 |
199 | # When set to false, does not sign a user in automatically after their password is
200 | # reset. Defaults to true, so a user is signed in automatically after a reset.
201 | # config.sign_in_after_reset_password = true
202 |
203 | # ==> Configuration for :encryptable
204 | # Allow you to use another hashing or encryption algorithm besides bcrypt (default).
205 | # You can use :sha1, :sha512 or algorithms from others authentication tools as
206 | # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20
207 | # for default behavior) and :restful_authentication_sha1 (then you should set
208 | # stretches to 10, and copy REST_AUTH_SITE_KEY to pepper).
209 | #
210 | # Require the `devise-encryptable` gem when using anything other than bcrypt
211 | # config.encryptor = :sha512
212 |
213 | # ==> Scopes configuration
214 | # Turn scoped views on. Before rendering "sessions/new", it will first check for
215 | # "users/sessions/new". It's turned off by default because it's slower if you
216 | # are using only default views.
217 | # config.scoped_views = false
218 |
219 | # Configure the default scope given to Warden. By default it's the first
220 | # devise role declared in your routes (usually :user).
221 | # config.default_scope = :user
222 |
223 | # Set this configuration to false if you want /users/sign_out to sign out
224 | # only the current scope. By default, Devise signs out all scopes.
225 | # config.sign_out_all_scopes = true
226 |
227 | # ==> Navigation configuration
228 | # Lists the formats that should be treated as navigational. Formats like
229 | # :html, should redirect to the sign in page when the user does not have
230 | # access, but formats like :xml or :json, should return 401.
231 | #
232 | # If you have any extra navigational formats, like :iphone or :mobile, you
233 | # should add them to the navigational formats lists.
234 | #
235 | # The "*/*" below is required to match Internet Explorer requests.
236 | # config.navigational_formats = ['*/*', :html]
237 |
238 | # The default HTTP method used to sign out a resource. Default is :delete.
239 | config.sign_out_via = :delete
240 |
241 | # ==> OmniAuth
242 | # Add a new OmniAuth provider. Check the wiki for more information on setting
243 | # up on your models and hooks.
244 | # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
245 |
246 | # Devise.omniauth_configs
247 |
248 | config.omniauth :vkontakte,
249 | *Settings.oauth.vkontakte.tokens,
250 | Settings.oauth.vkontakte.options.to_h
251 |
252 | config.omniauth :facebook,
253 | *Settings.oauth.facebook.tokens,
254 | Settings.oauth.facebook.options.to_h
255 |
256 | config.omniauth :twitter,
257 | *Settings.oauth.twitter.tokens,
258 | Settings.oauth.twitter.options.to_h
259 |
260 | config.omniauth :google_oauth2,
261 | *Settings.oauth.google_oauth2.tokens,
262 | Settings.oauth.google_oauth2.options.to_h
263 |
264 | config.omniauth :odnoklassniki,
265 | *Settings.oauth.odnoklassniki.tokens,
266 | Settings.oauth.odnoklassniki.options.to_h
267 |
268 | # ==> Warden configuration
269 | # If you want to use other strategies, that are not supported by Devise, or
270 | # change the failure app, you can configure them inside the config.warden block.
271 | #
272 | # config.warden do |manager|
273 | # manager.intercept_401 = false
274 | # manager.default_strategies(scope: :user).unshift :some_external_strategy
275 | # end
276 |
277 | # ==> Mountable engine configurations
278 | # When using Devise inside an engine, let's call it `MyEngine`, and this engine
279 | # is mountable, there are some extra configurations to be taken into account.
280 | # The following options are available, assuming the engine is mounted as:
281 | #
282 | # mount MyEngine, at: '/my_engine'
283 | #
284 | # The router that invoked `devise_for`, in the example above, would be:
285 | # config.router_name = :my_engine
286 | #
287 | # When using OmniAuth, Devise cannot automatically set OmniAuth path,
288 | # so you need to do it manually. For the users scope, it would be:
289 | # config.omniauth_path_prefix = '/my_engine/users/auth'
290 | end
291 |
--------------------------------------------------------------------------------
/config/initializers/_RAILS_APP.rb:
--------------------------------------------------------------------------------
1 | app = Rails.application
2 |
3 | # Time
4 | ::Time.zone = Settings.app.time_zone
5 | app.config.time_zone = Settings.app.time_zone
6 |
7 | # Locales
8 | app.config.i18n.default_locale = Settings.app.default_locale
9 |
10 | # Delayed processing
11 | app.config.active_job.queue_adapter = :sidekiq
12 |
13 | # RAILS APP secrets
14 | # Rails.application.secrets
15 | #
16 | # Be sure to restart your server when you modify this file.
17 | #
18 | # Your secret key is used for verifying the integrity of signed cookies.
19 | # If you change this key, all old signed cookies will become invalid!
20 | #
21 | # Make sure the secret is at least 30 characters and all random,
22 | # no regular words or you'll be exposed to dictionary attacks.
23 | # You can use `rails secret` to generate a secure secret key.
24 | #
25 | app.config.secret_key_base = Settings.app.secret_key_base
26 | app.config.secret_token = Settings.app.secret_token
27 |
--------------------------------------------------------------------------------
/config/initializers/_REDIS.rb:
--------------------------------------------------------------------------------
1 | redis_port = Settings.redis.port
2 | $redis = Redis.new(port: redis_port)
3 |
4 | puts "Redis: will try to init on port: #{ redis_port }!".cyan
5 |
--------------------------------------------------------------------------------
/config/initializers/_SIDEKIQ.rb:
--------------------------------------------------------------------------------
1 | redis_url = Settings.redis.url
2 | redis_port = Settings.redis.port
3 | sq_namespace = Settings.sidekiq.namespace
4 |
5 | SQ_ERR_LOGGER = Logger.new("#{ Rails.root }/log/sidekiq_errors.log")
6 |
7 | puts "Sidekiq: will try to connect to Redis on port: #{ redis_port }".cyan
8 |
9 | Sidekiq.configure_client do |config|
10 | config.redis = {
11 | url: redis_url,
12 | namespace: sq_namespace
13 | }
14 | end
15 |
16 | Sidekiq.configure_server do |config|
17 | config.redis = {
18 | url: redis_url,
19 | namespace: sq_namespace
20 | }
21 | end
22 |
23 | Sidekiq.configure_server do |config|
24 | config.error_handlers << Proc.new do |ex,context|
25 | # ExceptionNotifier.notify_exception(ex, data: { sidekiq: context })
26 | SQ_ERR_LOGGER.error "#{ex}\n#{context}\n\n"
27 | end
28 | end
29 |
--------------------------------------------------------------------------------
/config/initializers/_THINKING_SPHINX.rb:
--------------------------------------------------------------------------------
1 | if defined? ThinkingSphinx
2 | class ThinkingSphinx::Configuration
3 | private
4 |
5 | def settings_file
6 | framework_root.join 'config', 'ENV', Rails.env.to_s, 'services', 'thinking_sphinx.yml'
7 | end
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/config/initializers/application_controller_renderer.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # ApplicationController.renderer.defaults.merge!(
4 | # http_host: 'example.org',
5 | # https: false
6 | # )
7 |
--------------------------------------------------------------------------------
/config/initializers/assets.rb:
--------------------------------------------------------------------------------
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 | # Add additional assets to the asset load path.
7 | # Rails.application.config.assets.paths << Emoji.images_path
8 | # Add Yarn node_modules folder to the asset load path.
9 | Rails.application.config.assets.paths << Rails.root.join('node_modules')
10 |
11 | # Precompile additional assets.
12 | # application.js, application.css, and all non-JS/CSS in the app/assets
13 | # folder are already added.
14 | # Rails.application.config.assets.precompile += %w( admin.js admin.css )
15 |
--------------------------------------------------------------------------------
/config/initializers/backtrace_silencers.rb:
--------------------------------------------------------------------------------
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!
8 |
--------------------------------------------------------------------------------
/config/initializers/config.rb:
--------------------------------------------------------------------------------
1 | Config.setup do |config|
2 | # Name of the constant exposing loaded settings
3 | config.const_name = 'Settings'
4 |
5 | # Ability to remove elements of the array set in earlier loaded settings file. For example value: '--'.
6 | #
7 | # config.knockout_prefix = nil
8 |
9 | # Overwrite arrays found in previously loaded settings file. When set to `false`, arrays will be merged.
10 | #
11 | # config.overwrite_arrays = true
12 |
13 | # Load environment variables from the `ENV` object and override any settings defined in files.
14 | #
15 | # config.use_env = false
16 |
17 | # Define ENV variable prefix deciding which variables to load into config.
18 | #
19 | # config.env_prefix = 'Settings'
20 |
21 | # What string to use as level separator for settings loaded from ENV variables. Default value of '.' works well
22 | # with Heroku, but you might want to change it for example for '__' to easy override settings from command line, where
23 | # using dots in variable names might not be allowed (eg. Bash).
24 | #
25 | # config.env_separator = '.'
26 |
27 | # Ability to process variables names:
28 | # * nil - no change
29 | # * :downcase - convert to lower case
30 | #
31 | # config.env_converter = :downcase
32 |
33 | # Parse numeric values as integers instead of strings.
34 | #
35 | # config.env_parse_values = true
36 | end
37 |
--------------------------------------------------------------------------------
/config/initializers/cookies_serializer.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Specify a serializer for the signed and encrypted cookie jars.
4 | # Valid options are :json, :marshal, and :hybrid.
5 | Rails.application.config.action_dispatch.cookies_serializer = :json
6 |
--------------------------------------------------------------------------------
/config/initializers/filter_parameter_logging.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Configure sensitive parameters which will be filtered from the log file.
4 | Rails.application.config.filter_parameters += [:password]
5 |
--------------------------------------------------------------------------------
/config/initializers/inflections.rb:
--------------------------------------------------------------------------------
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
17 |
--------------------------------------------------------------------------------
/config/initializers/kaminari_config.rb:
--------------------------------------------------------------------------------
1 | Kaminari.configure do |config|
2 | # config.default_per_page = 25
3 | # config.max_per_page = nil
4 | # config.window = 4
5 | # config.outer_window = 0
6 | # config.left = 0
7 | # config.right = 0
8 | # config.page_method_name = :page
9 | # config.param_name = :page
10 | end
11 |
--------------------------------------------------------------------------------
/config/initializers/mime_types.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Add new mime types for use in respond_to blocks:
4 | # Mime::Type.register "text/richtext", :rtf
5 |
--------------------------------------------------------------------------------
/config/initializers/new_framework_defaults.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 | #
3 | # This file contains migration options to ease your Rails 5.0 upgrade.
4 | #
5 | # Read the Guide for Upgrading Ruby on Rails for more info on each option.
6 |
7 | # Enable per-form CSRF tokens. Previous versions had false.
8 | Rails.application.config.action_controller.per_form_csrf_tokens = true
9 |
10 | # Enable origin-checking CSRF mitigation. Previous versions had false.
11 | Rails.application.config.action_controller.forgery_protection_origin_check = true
12 |
13 | # Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`.
14 | # Previous versions had false.
15 | ActiveSupport.to_time_preserves_timezone = true
16 |
17 | # Require `belongs_to` associations by default. Previous versions had false.
18 | Rails.application.config.active_record.belongs_to_required_by_default = true
19 |
20 | # Configure SSL options to enable HSTS with subdomains. Previous versions had false.
21 | Rails.application.config.ssl_options = { hsts: { subdomains: true } }
22 |
23 | # Unknown asset fallback will return the path passed in when the given
24 | # asset is not present in the asset pipeline.
25 | Rails.application.config.assets.unknown_asset_fallback = false
26 |
--------------------------------------------------------------------------------
/config/initializers/wrap_parameters.rb:
--------------------------------------------------------------------------------
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]
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
15 |
--------------------------------------------------------------------------------
/config/locales/devise.en.yml:
--------------------------------------------------------------------------------
1 | # Additional translations at https://github.com/plataformatec/devise/wiki/I18n
2 |
3 | en:
4 | devise:
5 | confirmations:
6 | confirmed: "Your email address has been successfully confirmed."
7 | send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes."
8 | send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes."
9 | failure:
10 | already_authenticated: "You are already signed in."
11 | inactive: "Your account is not activated yet."
12 | invalid: "Invalid %{authentication_keys} or password."
13 | locked: "Your account is locked."
14 | last_attempt: "You have one more attempt before your account is locked."
15 | not_found_in_database: "Invalid %{authentication_keys} or password."
16 | timeout: "Your session expired. Please sign in again to continue."
17 | unauthenticated: "You need to sign in or sign up before continuing."
18 | unconfirmed: "You have to confirm your email address before continuing."
19 | mailer:
20 | confirmation_instructions:
21 | subject: "Confirmation instructions"
22 | reset_password_instructions:
23 | subject: "Reset password instructions"
24 | unlock_instructions:
25 | subject: "Unlock instructions"
26 | password_change:
27 | subject: "Password Changed"
28 | omniauth_callbacks:
29 | failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
30 | success: "Successfully authenticated from %{kind} account."
31 | passwords:
32 | no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
33 | send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
34 | send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
35 | updated: "Your password has been changed successfully. You are now signed in."
36 | updated_not_active: "Your password has been changed successfully."
37 | registrations:
38 | destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon."
39 | signed_up: "Welcome! You have signed up successfully."
40 | signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
41 | signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
42 | signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account."
43 | update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirm link to confirm your new email address."
44 | updated: "Your account has been updated successfully."
45 | sessions:
46 | signed_in: "Signed in successfully."
47 | signed_out: "Signed out successfully."
48 | already_signed_out: "Signed out successfully."
49 | unlocks:
50 | send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes."
51 | send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes."
52 | unlocked: "Your account has been unlocked successfully. Please sign in to continue."
53 | errors:
54 | messages:
55 | already_confirmed: "was already confirmed, please try signing in"
56 | confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
57 | expired: "has expired, please request a new one"
58 | not_found: "not found"
59 | not_locked: "was not locked"
60 | not_saved:
61 | one: "1 error prohibited this %{resource} from being saved:"
62 | other: "%{count} errors prohibited this %{resource} from being saved:"
63 |
--------------------------------------------------------------------------------
/config/locales/en.yml:
--------------------------------------------------------------------------------
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 | # The following keys must be escaped otherwise they will not be retrieved by
20 | # the default I18n backend:
21 | #
22 | # true, false, on, off, yes, no
23 | #
24 | # Instead, surround them with single quotes.
25 | #
26 | # en:
27 | # 'true': 'foo'
28 | #
29 | # To learn more, please read the Rails Internationalization guide
30 | # available at http://guides.rubyonrails.org/i18n.html.
31 |
32 | en:
33 | hello: "Hello world"
34 |
--------------------------------------------------------------------------------
/config/routes.rb:
--------------------------------------------------------------------------------
1 | require 'sidekiq/web'
2 |
3 | Sidekiq::Web.use Rack::Auth::Basic do |username, password|
4 | username == 'admin' && password == Settings.sidekiq.ui.password
5 | end
6 |
7 | Rails.application.routes.draw do
8 | mount Sidekiq::Web => '/async/tasks'
9 | mount ActionCable.server => '/app-cable'
10 |
11 | root to: "notes#index"
12 |
13 | devise_for :users
14 | resources :notes
15 |
16 | get '/search' => 'search#search', as: :search
17 | end
18 |
19 | # For details on the DSL available within this file,
20 | # see http://guides.rubyonrails.org/routing.html
21 |
--------------------------------------------------------------------------------
/config/webpack/development.js:
--------------------------------------------------------------------------------
1 | // Note: You must restart bin/webpack-watcher for changes to take effect
2 |
3 | const webpack = require('webpack')
4 | const merge = require('webpack-merge')
5 |
6 | const sharedConfig = require('./shared.js')
7 |
8 | module.exports = merge(sharedConfig.config, {
9 | devtool: 'sourcemap',
10 |
11 | stats: {
12 | errorDetails: true
13 | },
14 |
15 | output: {
16 | pathinfo: true
17 | },
18 |
19 | plugins: [
20 | new webpack.LoaderOptionsPlugin({
21 | debug: true
22 | })
23 | ]
24 | })
25 |
--------------------------------------------------------------------------------
/config/webpack/production.js:
--------------------------------------------------------------------------------
1 | // Note: You must restart bin/webpack-watcher for changes to take effect
2 |
3 | const webpack = require('webpack')
4 | const merge = require('webpack-merge')
5 | const CompressionPlugin = require('compression-webpack-plugin')
6 |
7 | const sharedConfig = require('./shared.js')
8 |
9 | module.exports = merge(sharedConfig.config, {
10 | output: { filename: '[name]-[chunkhash].js' },
11 |
12 | plugins: [
13 | new webpack.LoaderOptionsPlugin({
14 | minimize: true
15 | }),
16 | new webpack.optimize.UglifyJsPlugin(),
17 | new CompressionPlugin({
18 | asset: '[path].gz[query]',
19 | algorithm: 'gzip',
20 | test: /\.js$/
21 | })
22 | ]
23 | })
24 |
--------------------------------------------------------------------------------
/config/webpack/shared.js:
--------------------------------------------------------------------------------
1 | // Note: You must restart bin/webpack-watcher for changes to take effect
2 |
3 | const webpack = require('webpack')
4 | const path = require('path')
5 | const process = require('process')
6 | const glob = require('glob')
7 | const extname = require('path-complete-extname')
8 |
9 | let distDir = process.env.WEBPACK_DIST_DIR
10 |
11 | if (distDir === undefined) {
12 | distDir = 'packs'
13 | }
14 |
15 | const config = {
16 | entry: glob.sync(path.join('app', 'javascript', 'packs', '*.js*')).reduce(
17 | (map, entry) => {
18 | const basename = path.basename(entry, extname(entry))
19 | const localMap = map
20 | localMap[basename] = path.resolve(entry)
21 | return localMap
22 | }, {}
23 | ),
24 |
25 | output: { filename: '[name].js', path: path.resolve('public', distDir) },
26 |
27 | module: {
28 | rules: [
29 | { test: /\.coffee(\.erb)?$/, loader: 'coffee-loader' },
30 | {
31 | test: /\.jsx?(\.erb)?$/,
32 | exclude: /node_modules/,
33 | loader: 'babel-loader',
34 | options: {
35 | presets: [
36 | 'react',
37 | ['env', { modules: false }]
38 | ]
39 | }
40 | },
41 | {
42 | test: /\.erb$/,
43 | enforce: 'pre',
44 | exclude: /node_modules/,
45 | loader: 'rails-erb-loader',
46 | options: {
47 | runner: 'DISABLE_SPRING=1 bin/rails runner'
48 | }
49 | }
50 | ]
51 | },
52 |
53 | plugins: [
54 | new webpack.EnvironmentPlugin(Object.keys(process.env))
55 | ],
56 |
57 | resolve: {
58 | extensions: ['.js', '.coffee'],
59 | modules: [
60 | path.resolve('app/javascript'),
61 | path.resolve('node_modules')
62 | ]
63 | },
64 |
65 | resolveLoader: {
66 | modules: [path.resolve('node_modules')]
67 | }
68 | }
69 |
70 | module.exports = {
71 | distDir,
72 | config
73 | }
74 |
--------------------------------------------------------------------------------
/db/REDIS/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DeployRB/Rails5App/04efd4f6d812e34d7969c667c149b6f9b46d801a/db/REDIS/.keep
--------------------------------------------------------------------------------
/db/SPHINX/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DeployRB/Rails5App/04efd4f6d812e34d7969c667c149b6f9b46d801a/db/SPHINX/.keep
--------------------------------------------------------------------------------
/db/migrate/20160918152255_devise_create_users.rb:
--------------------------------------------------------------------------------
1 | class DeviseCreateUsers < ActiveRecord::Migration[5.0]
2 | def change
3 | create_table :users do |t|
4 | ## Database authenticatable
5 | t.string :email, null: false, default: ""
6 | t.string :encrypted_password, null: false, default: ""
7 |
8 | ## Recoverable
9 | t.string :reset_password_token
10 | t.datetime :reset_password_sent_at
11 |
12 | ## Rememberable
13 | t.datetime :remember_created_at
14 |
15 | ## Trackable
16 | t.integer :sign_in_count, default: 0, null: false
17 | t.datetime :current_sign_in_at
18 | t.datetime :last_sign_in_at
19 | t.string :current_sign_in_ip
20 | t.string :last_sign_in_ip
21 |
22 | ## Confirmable
23 | # t.string :confirmation_token
24 | # t.datetime :confirmed_at
25 | # t.datetime :confirmation_sent_at
26 | # t.string :unconfirmed_email # Only if using reconfirmable
27 |
28 | ## Lockable
29 | # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
30 | # t.string :unlock_token # Only if unlock strategy is :email or :both
31 | # t.datetime :locked_at
32 |
33 |
34 | t.timestamps null: false
35 | end
36 |
37 | add_index :users, :email, unique: true
38 | add_index :users, :reset_password_token, unique: true
39 | # add_index :users, :confirmation_token, unique: true
40 | # add_index :users, :unlock_token, unique: true
41 | end
42 | end
43 |
--------------------------------------------------------------------------------
/db/migrate/20160921090347_create_notes.rb:
--------------------------------------------------------------------------------
1 | class CreateNotes < ActiveRecord::Migration[5.0]
2 | def change
3 | create_table :notes do |t|
4 | t.integer :user_id
5 | t.string :title
6 | t.text :content
7 |
8 | t.timestamps
9 | end
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/db/schema.rb:
--------------------------------------------------------------------------------
1 | # This file is auto-generated from the current state of the database. Instead
2 | # of editing this file, please use the migrations feature of Active Record to
3 | # incrementally modify your database, and then regenerate this schema definition.
4 | #
5 | # Note that this schema.rb definition is the authoritative source for your
6 | # database schema. If you need to create the application database on another
7 | # system, you should be using db:schema:load, not running all the migrations
8 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations
9 | # you'll amass, the slower it'll run and the greater likelihood for issues).
10 | #
11 | # It's strongly recommended that you check this file into your version control system.
12 |
13 | ActiveRecord::Schema.define(version: 20160921090347) do
14 |
15 | # These are extensions that must be enabled in order to support this database
16 | enable_extension "plpgsql"
17 |
18 | create_table "notes", id: :serial, force: :cascade do |t|
19 | t.integer "user_id"
20 | t.string "title"
21 | t.text "content"
22 | t.datetime "created_at", null: false
23 | t.datetime "updated_at", null: false
24 | end
25 |
26 | create_table "users", id: :serial, force: :cascade do |t|
27 | t.string "email", default: "", null: false
28 | t.string "encrypted_password", default: "", null: false
29 | t.string "reset_password_token"
30 | t.datetime "reset_password_sent_at"
31 | t.datetime "remember_created_at"
32 | t.integer "sign_in_count", default: 0, null: false
33 | t.datetime "current_sign_in_at"
34 | t.datetime "last_sign_in_at"
35 | t.string "current_sign_in_ip"
36 | t.string "last_sign_in_ip"
37 | t.datetime "created_at", null: false
38 | t.datetime "updated_at", null: false
39 | t.index ["email"], name: "index_users_on_email", unique: true
40 | t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
41 | end
42 |
43 | end
44 |
--------------------------------------------------------------------------------
/db/seeds.rb:
--------------------------------------------------------------------------------
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 rails db:seed command (or created alongside the database with db:setup).
3 | #
4 | # Examples:
5 | #
6 | # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
7 | # Character.create(name: 'Luke', movie: movies.first)
8 |
9 | puts
10 | print "Create users:"
11 |
12 | 10.times do |index|
13 | User.create!(
14 | email: FFaker::Internet.email,
15 | password: "qwerty#{ index.next }",
16 | password_confirmation: "qwerty#{ index.next }"
17 | )
18 | print '.'
19 | end
20 |
21 | puts
22 | print "Create notes:"
23 |
24 | User.all.each do |user|
25 | 10.times do
26 | user.notes.create!(
27 | title: FFaker::Lorem.sentence,
28 | content: FFaker::Lorem.paragraph(3),
29 | created_at: Time.now - (rand*100000).to_i.minutes
30 | )
31 | print '.'
32 | end
33 | end
34 |
35 | puts
36 |
--------------------------------------------------------------------------------
/lib/assets/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DeployRB/Rails5App/04efd4f6d812e34d7969c667c149b6f9b46d801a/lib/assets/.keep
--------------------------------------------------------------------------------
/lib/tasks/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DeployRB/Rails5App/04efd4f6d812e34d7969c667c149b6f9b46d801a/lib/tasks/.keep
--------------------------------------------------------------------------------
/lib/tasks/app_init.rake:
--------------------------------------------------------------------------------
1 | namespace :app do
2 | desc 'rake app:init'
3 | task init: :environment do
4 | Rake::Task['db:drop'].invoke
5 | Rake::Task['db:create'].invoke
6 | Rake::Task['db:migrate'].invoke
7 | Rake::Task['db:seed'].invoke
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/log/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DeployRB/Rails5App/04efd4f6d812e34d7969c667c149b6f9b46d801a/log/.keep
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "rails51",
3 | "private": true,
4 | "dependencies": {
5 | "babel-core": "^6.23.1",
6 | "babel-loader": "^6.4.0",
7 | "babel-preset-env": "^1.2.1",
8 | "babel-preset-react": "^6.23.0",
9 | "coffee-loader": "^0.7.3",
10 | "coffee-script": "^1.12.4",
11 | "compression-webpack-plugin": "^0.3.2",
12 | "glob": "^7.1.1",
13 | "path-complete-extname": "^0.1.0",
14 | "rails-erb-loader": "^3.2.0",
15 | "react": "^15.4.2",
16 | "react-dom": "^15.4.2",
17 | "webpack": "^2.2.1",
18 | "webpack-merge": "^4.0.0"
19 | },
20 | "devDependencies": {
21 | "webpack-dev-server": "^2.4.1"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/public/404.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | The page you were looking for doesn't exist (404)
5 |
6 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
The page you were looking for doesn't exist.
62 |
You may have mistyped the address or the page may have moved.
63 |
64 |
If you are the application owner check the logs for more information.
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/public/422.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | The change you wanted was rejected (422)
5 |
6 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
The change you wanted was rejected.
62 |
Maybe you tried to change something you didn't have access to.
63 |
64 |
If you are the application owner check the logs for more information.
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/public/500.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | We're sorry, but something went wrong (500)
5 |
6 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
We're sorry, but something went wrong.
62 |
63 |
If you are the application owner check the logs for more information.
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/public/apple-touch-icon-precomposed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DeployRB/Rails5App/04efd4f6d812e34d7969c667c149b6f9b46d801a/public/apple-touch-icon-precomposed.png
--------------------------------------------------------------------------------
/public/apple-touch-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DeployRB/Rails5App/04efd4f6d812e34d7969c667c149b6f9b46d801a/public/apple-touch-icon.png
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DeployRB/Rails5App/04efd4f6d812e34d7969c667c149b6f9b46d801a/public/favicon.ico
--------------------------------------------------------------------------------
/public/robots.txt:
--------------------------------------------------------------------------------
1 | # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
2 |
--------------------------------------------------------------------------------
/test/application_system_test_case.rb:
--------------------------------------------------------------------------------
1 | require "test_helper"
2 |
3 | class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
4 | driven_by :selenium, using: :chrome, screen_size: [1400, 1400]
5 | end
6 |
--------------------------------------------------------------------------------
/test/controllers/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DeployRB/Rails5App/04efd4f6d812e34d7969c667c149b6f9b46d801a/test/controllers/.keep
--------------------------------------------------------------------------------
/test/fixtures/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DeployRB/Rails5App/04efd4f6d812e34d7969c667c149b6f9b46d801a/test/fixtures/.keep
--------------------------------------------------------------------------------
/test/fixtures/files/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DeployRB/Rails5App/04efd4f6d812e34d7969c667c149b6f9b46d801a/test/fixtures/files/.keep
--------------------------------------------------------------------------------
/test/helpers/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DeployRB/Rails5App/04efd4f6d812e34d7969c667c149b6f9b46d801a/test/helpers/.keep
--------------------------------------------------------------------------------
/test/integration/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DeployRB/Rails5App/04efd4f6d812e34d7969c667c149b6f9b46d801a/test/integration/.keep
--------------------------------------------------------------------------------
/test/mailers/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DeployRB/Rails5App/04efd4f6d812e34d7969c667c149b6f9b46d801a/test/mailers/.keep
--------------------------------------------------------------------------------
/test/models/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DeployRB/Rails5App/04efd4f6d812e34d7969c667c149b6f9b46d801a/test/models/.keep
--------------------------------------------------------------------------------
/test/system/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DeployRB/Rails5App/04efd4f6d812e34d7969c667c149b6f9b46d801a/test/system/.keep
--------------------------------------------------------------------------------
/test/test_helper.rb:
--------------------------------------------------------------------------------
1 | require File.expand_path('../../config/environment', __FILE__)
2 | require 'rails/test_help'
3 |
4 | class ActiveSupport::TestCase
5 | # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
6 | fixtures :all
7 |
8 | # Add more helper methods to be used by all tests here...
9 | end
10 |
--------------------------------------------------------------------------------
/test/workers/notes_random_worker_test.rb:
--------------------------------------------------------------------------------
1 | require_relative 'test_helper'
2 | class NotesRandomWorkerTest < Minitest::Test
3 | def test_example
4 | skip "add some examples to (or delete) #{__FILE__}"
5 | end
6 | end
7 |
--------------------------------------------------------------------------------
/tmp/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DeployRB/Rails5App/04efd4f6d812e34d7969c667c149b6f9b46d801a/tmp/.keep
--------------------------------------------------------------------------------
/tmp/cache/assets/.keep:
--------------------------------------------------------------------------------
1 | .keep
2 |
--------------------------------------------------------------------------------
/tmp/pids/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DeployRB/Rails5App/04efd4f6d812e34d7969c667c149b6f9b46d801a/tmp/pids/.keep
--------------------------------------------------------------------------------
/tmp/sessions/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DeployRB/Rails5App/04efd4f6d812e34d7969c667c149b6f9b46d801a/tmp/sessions/.keep
--------------------------------------------------------------------------------
/tmp/sockets/.keep:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/vendor/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DeployRB/Rails5App/04efd4f6d812e34d7969c667c149b6f9b46d801a/vendor/.keep
--------------------------------------------------------------------------------