pig-ci-rails 0.1.3 → 0.1.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8394ca55c3db58b23157e53816e5fcac10fbce265b489a0d257c89b8f3a94b82
4
- data.tar.gz: 6d73a5fede30a3ab10958357b1ffcc36e06fc69ef0b3b11f2e4b7d668ed98e18
3
+ metadata.gz: 9a5d58f2c466ba3ddd5a11b5c4af7e6a9d300e5526ea1c6d3cf808f8e73ea6b9
4
+ data.tar.gz: 1fd23fe41910c53a784d7ef5ac77b80c05085279a879aff4a2f760c4b19682d7
5
5
  SHA512:
6
- metadata.gz: dadf2604201efda1f497b0e7862fe5f28bc964a930de24e2cc440f1d22985787e3e8de535378be90e0d402fdfd45affeb964160c3da421a96d692765ef84e588
7
- data.tar.gz: ba7fcc7ce0f031c0070a4e833884244f79e77ee738ac54de504acbecbede11ba894da6599645a85ff4879a40378b8d94aa3540699d4b334870a4d5b47e8fbd26
6
+ metadata.gz: b7c7467d599bc6f67ce2c0224b7cc0f950341c81461dca606c771b3d8f07eb019df98e408625fee01b3a543b1d61b72aa1c06f21bdc76fe8a1ea6841b3409ea9
7
+ data.tar.gz: 4b4f5bdefac64e25125e93d35ac4167e010be1d4da7e37ceaf95d3c371162f21f0d16d5ec56772e922c1dac7a514ee7f79b6be8f6d93afee6a53e0bccdda6689
@@ -0,0 +1,3 @@
1
+ # These are supported funding model platforms
2
+
3
+ custom: ['https://pigci.com/']
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.4
4
+
5
+ * [Precompile assets before tests run](https://github.com/PigCI/pig-ci-rails/pull/11)
6
+
3
7
  ## 0.1.3
4
8
 
5
9
  * [Gracefully handling SockerError when submitting reports while offline](https://github.com/PigCI/pig-ci-rails/pull/7)
data/README.md CHANGED
@@ -96,7 +96,7 @@ end
96
96
 
97
97
  #### Request Time
98
98
 
99
- Often the first request test will be slow, as rails is loading a full environment. To mitigate this issue, this gem will make a blank request to your application before your test suite starts.
99
+ Often the first request test will be slow, as rails is loading a full environment & rendering assets. To mitigate this issue, this gem will make a blank request to your application before your test suite starts & compiling assets.
100
100
 
101
101
  You can disable this functionality by setting your configuration to be:
102
102
 
@@ -104,15 +104,10 @@ You can disable this functionality by setting your configuration to be:
104
104
  require 'pig_ci'
105
105
  PigCI.start do |config|
106
106
  config.during_setup_make_blank_application_request = false
107
+ config.during_setup_precompile_assets = false
107
108
  end
108
109
  ```
109
110
 
110
- You can also improve the first request performance (and overall memory usage) by precompiling your assets before running RSpec:
111
-
112
- ```ruby
113
- bundle exec rake assets:precompile RAILS_ENV=test
114
- ```
115
-
116
111
  ## Authors
117
112
 
118
113
  * This gem was made by [@MikeRogers0](https://github.com/MikeRogers0).
@@ -135,6 +130,7 @@ Features I'd like to add at some point:
135
130
  * Document setting branch/commit encase of weird CI.
136
131
  * Add rake for submitting reports.
137
132
  * https://rubydoc.info/gems/yard/file/docs/GettingStarted.md - Document the gem so it's easier for people to jump on.
133
+ * Attempt to precompile assets (They throw off the first request timing)
138
134
 
139
135
  ## Contributing
140
136
 
data/lib/pig_ci.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'active_support'
2
2
  require 'active_support/core_ext/string/inflections'
3
+ require 'rake'
3
4
 
4
5
  require 'pig_ci/version'
5
6
  require 'pig_ci/api'
@@ -55,6 +56,11 @@ module PigCI
55
56
  @during_setup_make_blank_application_request.nil? || @during_setup_make_blank_application_request
56
57
  end
57
58
 
59
+ attr_writer :during_setup_precompile_assets
60
+ def during_setup_precompile_assets?
61
+ @during_setup_precompile_assets.nil? || @during_setup_precompile_assets
62
+ end
63
+
58
64
  attr_writer :terminal_report_row_limit
59
65
  def terminal_report_row_limit
60
66
  @terminal_report_row_limit || -1
@@ -20,6 +20,7 @@ class PigCI::ProfilerEngine::Rails < ::PigCI::ProfilerEngine
20
20
 
21
21
  def setup!
22
22
  super do
23
+ precompile_assets! if PigCI.during_setup_precompile_assets?
23
24
  eager_load_rails! if PigCI.during_setup_eager_load_application?
24
25
  make_blank_application_request! if PigCI.during_setup_make_blank_application_request?
25
26
  end
@@ -27,9 +28,16 @@ class PigCI::ProfilerEngine::Rails < ::PigCI::ProfilerEngine
27
28
 
28
29
  private
29
30
 
31
+ def precompile_assets!
32
+ # From: https://github.com/rails/sprockets-rails/blob/e9ca63edb6e658cdfcf8a35670c525b369c2ccca/test/test_railtie.rb#L7-L13
33
+ ::Rails.application.load_tasks
34
+ ::Rake.application['assets:precompile'].execute
35
+ end
36
+
30
37
  def eager_load_rails!
31
38
  # Eager load rails to give more accurate memory levels.
32
39
  ::Rails.application.eager_load!
40
+ ::Rails.application.routes.eager_load!
33
41
  ::Rails::Engine.subclasses.map(&:instance).each(&:eager_load!)
34
42
  ::ActiveRecord::Base.descendants
35
43
  end
@@ -1,3 +1,3 @@
1
1
  module PigCI
2
- VERSION = '0.1.3'.freeze
2
+ VERSION = '0.1.4'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pig-ci-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Rogers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-28 00:00:00.000000000 Z
11
+ date: 2019-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -200,6 +200,7 @@ executables: []
200
200
  extensions: []
201
201
  extra_rdoc_files: []
202
202
  files:
203
+ - ".github/FUNDING.yml"
203
204
  - ".gitignore"
204
205
  - ".rubocop.yml"
205
206
  - ".travis.yml"