onotole 1.1.15 → 1.1.16

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a6ff42ba06b4286a0f01b1bc40141b0bedad666a
4
- data.tar.gz: c470f375a1dc97127b247bb944f008c3d7e228b5
3
+ metadata.gz: 6a8dd7dd3a3fb81888507b9e11c1bbdc75df569a
4
+ data.tar.gz: 96a65d4e644a0b0152d9e53961f3173462f8707e
5
5
  SHA512:
6
- metadata.gz: aa5cb35fc96f5b948fd9639528ba3f15db15c8da18d91f65f97d85eb7df6c9fa42771f109bbefd48c4875eb44c2e62467998e6792348bcd0387d61c45a6d574f
7
- data.tar.gz: 78efe3f6ba31f82c34adc7d468d8800fb7dd0d969d9ef2411a49c9728f01afc10c35a98a7aed63c14a71c7d6b8c45cfab981d7f8692650848060d79b620ad8d5
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: '# user_choice')
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: '# user_choice')
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) ||
@@ -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
 
@@ -2,5 +2,5 @@
2
2
  module Onotole
3
3
  RAILS_VERSION = '~> 4.2.0'
4
4
  RUBY_VERSION = IO.read("#{File.dirname(__FILE__)}/../../.ruby-version").strip
5
- VERSION = '1.1.15'
5
+ VERSION = '1.1.16'
6
6
  end
@@ -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', '~> 10.5.0'
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
@@ -14,3 +14,4 @@ EXECJS_RUNTIME=Node
14
14
  <%= "#{app_name.upcase}_MAX_THREADS=16" %>
15
15
  <%= "#{app_name.upcase}_RAILS_SERVE_STATIC_FILES=true" %>
16
16
  <%= "#{app_name.upcase}_COVERAGE=false" %>
17
+ DEFER_GC=1
@@ -1,8 +1,25 @@
1
- require 'hirb'
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
- Hirb.enable
18
+ def disable_output_method
19
+ Pry.config.print = @old_print
20
+ @output_method = nil
21
+ end
22
+ end
4
23
 
5
- old_print = Pry.config.print
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 %>
@@ -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.15
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-09 00:00:00.000000000 Z
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