onotole 1.1.15 → 1.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/goodies/tests_speed_up_hack.md +41 -0
- data/lib/onotole/add_user_gems/after_install_patch.rb +2 -0
- data/lib/onotole/add_user_gems/before_bundle_patch.rb +4 -2
- data/lib/onotole/tests.rb +1 -0
- data/lib/onotole/version.rb +1 -1
- data/templates/Gemfile.erb +8 -5
- data/templates/deferred_garbage_collection.rb +19 -0
- data/templates/dotenv.erb +1 -0
- data/templates/dotfiles/.pryrc +22 -5
- data/templates/postgresql_database.yml.erb +2 -0
- data/templates/rails_helper.rb +11 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a8dd7dd3a3fb81888507b9e11c1bbdc75df569a
|
4
|
+
data.tar.gz: 96a65d4e644a0b0152d9e53961f3173462f8707e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6480755542c48aee82f3ff5eed19dbca350baef01308fde0be2eee24ea1cbedcb398a72de7df1336cb5e3447d55ce1c0f6fe2b8c03cfecd3271f7bc561c195f7
|
7
|
+
data.tar.gz: 71e1114bc65b14ca181c539fad15e8a95bb4c04868e8d26408dc0e1c1955a3251243579a686e6dfcd53d7425a3012683aa2bb2cb78b01b4c9ee627061d3dbff4
|
data/README.md
CHANGED
@@ -318,6 +318,10 @@ selected for pretty view from the box
|
|
318
318
|
* No need to add `rails_helper` or `spec_helper` in specs.
|
319
319
|
* In `.env` just switch on `#{app_name}_COVERAGE` to true and get your test
|
320
320
|
coverage.
|
321
|
+
* Added `kaminari-i18n` installation with `ActiveAdmin` or `kaminari` gem
|
322
|
+
* Moved asset gems in assets group in Gemfile
|
323
|
+
* Disable logging and deferred garbage collecting gives up 20% test speed
|
324
|
+
improvement
|
321
325
|
|
322
326
|
## Heroku
|
323
327
|
|
@@ -0,0 +1,41 @@
|
|
1
|
+
There are 2 tricky methods to speed up your tests in Onotole. It made up to 25%
|
2
|
+
boost. At first you need to disable logging in tests (usually you do not read
|
3
|
+
it). [see](http://blog.plataformatec.com.br/2011/12/three-tips-to-improve-the-performance-of-your-test-suite/)
|
4
|
+
|
5
|
+
```
|
6
|
+
Rails.logger.level = 4
|
7
|
+
```
|
8
|
+
|
9
|
+
And the second one is to differ garbage collection, by adding `garbage.rb` file
|
10
|
+
|
11
|
+
```
|
12
|
+
class DeferredGarbageCollection
|
13
|
+
DEFERRED_GC_THRESHOLD = (ENV['DEFER_GC'] || 15.0).to_f
|
14
|
+
|
15
|
+
@last_gc_run = Time.now
|
16
|
+
|
17
|
+
def self.start
|
18
|
+
GC.disable
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.reconsider
|
22
|
+
if Time.now - @last_gc_run >= DEFERRED_GC_THRESHOLD
|
23
|
+
GC.enable
|
24
|
+
GC.start
|
25
|
+
GC.disable
|
26
|
+
@last_gc_run = Time.now
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
```
|
31
|
+
|
32
|
+
And make it running with this snippet of code
|
33
|
+
```
|
34
|
+
unless ENV['DEFER_GC'] == '0' || ENV['DEFER_GC'] == 'false'
|
35
|
+
require 'support/deferred_garbage_collection'
|
36
|
+
RSpec.configure do |config|
|
37
|
+
config.before(:all) { DeferredGarbageCollection.start }
|
38
|
+
config.after(:all) { DeferredGarbageCollection.reconsider }
|
39
|
+
end
|
40
|
+
end
|
41
|
+
```
|
@@ -290,6 +290,8 @@ end
|
|
290
290
|
|
291
291
|
def after_install_ckeditor
|
292
292
|
append_file(AppBuilder.js_file, "\n#= require ckeditor/init")
|
293
|
+
append_file('config/initializers/assets.rb',
|
294
|
+
"\nRails.application.config.assets.precompile += %w( ckeditor/* )")
|
293
295
|
end
|
294
296
|
|
295
297
|
def after_install_image_optim
|
@@ -13,7 +13,7 @@ module Onotole
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def add_haml_gem
|
16
|
-
inject_into_file('Gemfile', "\ngem 'haml-rails'", after: '
|
16
|
+
inject_into_file('Gemfile', "\ngem 'haml-rails'", after: 'group :assets do')
|
17
17
|
end
|
18
18
|
|
19
19
|
def add_dotenv_heroku_gem
|
@@ -23,7 +23,7 @@ module Onotole
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def add_slim_gem
|
26
|
-
inject_into_file('Gemfile', "\ngem 'slim-rails'", after: '
|
26
|
+
inject_into_file('Gemfile', "\ngem 'slim-rails'", after: 'group :assets do')
|
27
27
|
inject_into_file('Gemfile', "\n gem 'html2slim'", after: 'group :development do')
|
28
28
|
end
|
29
29
|
|
@@ -165,6 +165,7 @@ module Onotole
|
|
165
165
|
|
166
166
|
def add_activeadmin_gem
|
167
167
|
inject_into_file('Gemfile', "\ngem 'activeadmin', github: 'activeadmin'", after: '# user_choice')
|
168
|
+
inject_into_file('Gemfile', "\ngem 'kaminari-i18n'", after: '# user_choice')
|
168
169
|
copy_file 'activeadmin.en.yml', 'config/locales/activeadmin.en.yml'
|
169
170
|
copy_file 'activeadmin.ru.yml', 'config/locales/activeadmin.ru.yml'
|
170
171
|
# it still live https://github.com/Prelang/feedback/issues/14 and this patch helps
|
@@ -203,6 +204,7 @@ module Onotole
|
|
203
204
|
|
204
205
|
def add_kaminari_gem
|
205
206
|
inject_into_file('Gemfile', "\ngem 'kaminari'", after: '# user_choice')
|
207
|
+
inject_into_file('Gemfile', "\ngem 'kaminari-i18n'", after: '# user_choice')
|
206
208
|
copy_file 'kaminari.rb', 'config/initializers/kaminari.rb'
|
207
209
|
inject_into_file('Gemfile', "\ngem 'bootstrap-kaminari-views'",
|
208
210
|
after: '# user_choice') if user_choose?(:bootstrap3) ||
|
data/lib/onotole/tests.rb
CHANGED
@@ -28,6 +28,7 @@ end
|
|
28
28
|
remove_file 'spec/rails_helper.rb'
|
29
29
|
remove_file 'spec/spec_helper.rb'
|
30
30
|
copy_file 'rails_helper.rb', 'spec/rails_helper.rb'
|
31
|
+
copy_file 'deferred_garbage_collection.rb', 'spec/deferred_garbage_collection.rb'
|
31
32
|
template 'spec_helper.rb.erb', 'spec/spec_helper.rb'
|
32
33
|
end
|
33
34
|
|
data/lib/onotole/version.rb
CHANGED
data/templates/Gemfile.erb
CHANGED
@@ -2,8 +2,6 @@ source "https://rubygems.org"
|
|
2
2
|
|
3
3
|
ruby "<%= Onotole::RUBY_VERSION %>"
|
4
4
|
|
5
|
-
gem "autoprefixer-rails"
|
6
|
-
gem "coffee-rails", "~> 4.1.0"
|
7
5
|
gem "delayed_job_active_record"
|
8
6
|
gem "flutie"
|
9
7
|
gem "high_voltage"
|
@@ -13,16 +11,21 @@ gem "pg"
|
|
13
11
|
gem "puma"
|
14
12
|
gem "rack-canonical-host"
|
15
13
|
gem "rails", "<%= Onotole::RAILS_VERSION %>"
|
16
|
-
gem "sass-rails", "~> 5.0"
|
17
14
|
gem "simple_form"
|
18
15
|
gem "title"
|
19
|
-
gem "uglifier"
|
20
16
|
gem "therubyracer"
|
21
|
-
gem 'rake', '~>
|
17
|
+
gem 'rake', '~> 11.1.0'
|
22
18
|
gem "awesome_print", :require=>"ap"
|
23
19
|
gem "dotenv-rails"
|
24
20
|
# user_choice
|
25
21
|
|
22
|
+
group :assets do
|
23
|
+
gem "sass-rails", "~> 5.0"
|
24
|
+
gem "autoprefixer-rails"
|
25
|
+
gem "coffee-rails", "~> 4.1.0"
|
26
|
+
gem "uglifier"
|
27
|
+
end
|
28
|
+
|
26
29
|
group :development do
|
27
30
|
gem "quiet_assets"
|
28
31
|
gem "spring"
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
class DeferredGarbageCollection
|
3
|
+
DEFERRED_GC_THRESHOLD = (ENV['DEFER_GC'] || 15.0).to_f
|
4
|
+
|
5
|
+
@last_gc_run = Time.zone.now
|
6
|
+
|
7
|
+
def self.start
|
8
|
+
GC.disable
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.reconsider
|
12
|
+
if Time.zone.now - @last_gc_run >= DEFERRED_GC_THRESHOLD
|
13
|
+
GC.enable
|
14
|
+
GC.start
|
15
|
+
GC.disable
|
16
|
+
@last_gc_run = Time.zone.now
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/templates/dotenv.erb
CHANGED
data/templates/dotfiles/.pryrc
CHANGED
@@ -1,8 +1,25 @@
|
|
1
|
-
|
1
|
+
begin
|
2
|
+
require 'hirb'
|
3
|
+
rescue LoadError
|
4
|
+
# Missing goodies, bummer
|
5
|
+
end
|
6
|
+
|
7
|
+
if defined? Hirb
|
8
|
+
# Slightly dirty hack to fully support in-session Hirb.disable/enable toggling
|
9
|
+
Hirb::View.instance_eval do
|
10
|
+
def enable_output_method
|
11
|
+
@output_method = true
|
12
|
+
@old_print = Pry.config.print
|
13
|
+
Pry.config.print = proc do |*args|
|
14
|
+
Hirb::View.view_or_page_output(args[1]) || @old_print.call(*args)
|
15
|
+
end
|
16
|
+
end
|
2
17
|
|
3
|
-
|
18
|
+
def disable_output_method
|
19
|
+
Pry.config.print = @old_print
|
20
|
+
@output_method = nil
|
21
|
+
end
|
22
|
+
end
|
4
23
|
|
5
|
-
|
6
|
-
Pry.config.print = proc do |*args|
|
7
|
-
Hirb::View.view_or_page_output(args[1]) || old_print.call(*args)
|
24
|
+
Hirb.enable
|
8
25
|
end
|
@@ -12,6 +12,8 @@ test:
|
|
12
12
|
database: <%= app_name %>_test
|
13
13
|
|
14
14
|
production: &deploy
|
15
|
+
adapter: postgresql
|
16
|
+
database: <%= app_name %>_production
|
15
17
|
encoding: utf8
|
16
18
|
min_messages: warning
|
17
19
|
pool: <%%= [Integer(ENV.fetch("MAX_THREADS", 5)), Integer(ENV.fetch("DB_POOL", 5))].max %>
|
data/templates/rails_helper.rb
CHANGED
@@ -22,3 +22,14 @@ RSpec.configure do |config|
|
|
22
22
|
end
|
23
23
|
|
24
24
|
ActiveRecord::Migration.maintain_test_schema!
|
25
|
+
|
26
|
+
Rails.logger.level = 4
|
27
|
+
|
28
|
+
# Improves performance by forcing the garbage collector to run less often.
|
29
|
+
unless ENV['DEFER_GC'] == '0' || ENV['DEFER_GC'] == 'false'
|
30
|
+
require 'support/deferred_garbage_collection'
|
31
|
+
RSpec.configure do |config|
|
32
|
+
config.before(:all) { DeferredGarbageCollection.start }
|
33
|
+
config.after(:all) { DeferredGarbageCollection.reconsider }
|
34
|
+
end
|
35
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: onotole
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kvokka
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-04-
|
12
|
+
date: 2016-04-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -84,6 +84,7 @@ files:
|
|
84
84
|
- bin/setup
|
85
85
|
- goodies/custom_404_and_others_in_1_minute.md
|
86
86
|
- goodies/mailcatcher_loading_patch.md
|
87
|
+
- goodies/tests_speed_up_hack.md
|
87
88
|
- lib/onotole.rb
|
88
89
|
- lib/onotole/actions.rb
|
89
90
|
- lib/onotole/adapters/heroku.rb
|
@@ -139,6 +140,7 @@ files:
|
|
139
140
|
- templates/config_locales_en.yml.erb
|
140
141
|
- templates/config_locales_ru.yml.erb
|
141
142
|
- templates/database_cleaner_rspec.rb
|
143
|
+
- templates/deferred_garbage_collection.rb
|
142
144
|
- templates/dev.rake
|
143
145
|
- templates/devise.ru.yml
|
144
146
|
- templates/devise_rspec.rb
|