lab_tech 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +323 -0
  4. data/Rakefile +30 -0
  5. data/app/models/lab_tech/application_record.rb +5 -0
  6. data/app/models/lab_tech/default_cleaner.rb +87 -0
  7. data/app/models/lab_tech/experiment.rb +190 -0
  8. data/app/models/lab_tech/observation.rb +40 -0
  9. data/app/models/lab_tech/percentile.rb +41 -0
  10. data/app/models/lab_tech/result.rb +130 -0
  11. data/app/models/lab_tech/speedup.rb +65 -0
  12. data/app/models/lab_tech/summary.rb +183 -0
  13. data/config/routes.rb +2 -0
  14. data/db/migrate/20190815192130_create_experiment_tables.rb +50 -0
  15. data/lib/lab_tech.rb +176 -0
  16. data/lib/lab_tech/engine.rb +6 -0
  17. data/lib/lab_tech/version.rb +3 -0
  18. data/lib/tasks/lab_tech_tasks.rake +4 -0
  19. data/spec/dummy/Rakefile +6 -0
  20. data/spec/dummy/app/assets/config/manifest.js +1 -0
  21. data/spec/dummy/app/assets/javascripts/application.js +14 -0
  22. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  23. data/spec/dummy/app/controllers/application_controller.rb +2 -0
  24. data/spec/dummy/app/jobs/application_job.rb +2 -0
  25. data/spec/dummy/app/models/application_record.rb +3 -0
  26. data/spec/dummy/bin/bundle +3 -0
  27. data/spec/dummy/bin/rails +4 -0
  28. data/spec/dummy/bin/rake +4 -0
  29. data/spec/dummy/bin/setup +33 -0
  30. data/spec/dummy/bin/update +28 -0
  31. data/spec/dummy/config.ru +5 -0
  32. data/spec/dummy/config/application.rb +35 -0
  33. data/spec/dummy/config/boot.rb +5 -0
  34. data/spec/dummy/config/database.yml +25 -0
  35. data/spec/dummy/config/environment.rb +5 -0
  36. data/spec/dummy/config/environments/development.rb +46 -0
  37. data/spec/dummy/config/environments/production.rb +71 -0
  38. data/spec/dummy/config/environments/test.rb +36 -0
  39. data/spec/dummy/config/initializers/application_controller_renderer.rb +8 -0
  40. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  41. data/spec/dummy/config/initializers/cors.rb +16 -0
  42. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  43. data/spec/dummy/config/initializers/inflections.rb +16 -0
  44. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  45. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  46. data/spec/dummy/config/locales/en.yml +33 -0
  47. data/spec/dummy/config/puma.rb +34 -0
  48. data/spec/dummy/config/routes.rb +3 -0
  49. data/spec/dummy/config/spring.rb +6 -0
  50. data/spec/dummy/db/schema.rb +52 -0
  51. data/spec/dummy/db/test.sqlite3 +0 -0
  52. data/spec/dummy/log/development.log +0 -0
  53. data/spec/dummy/log/test.log +1519 -0
  54. data/spec/examples.txt +79 -0
  55. data/spec/models/lab_tech/default_cleaner_spec.rb +32 -0
  56. data/spec/models/lab_tech/experiment_spec.rb +110 -0
  57. data/spec/models/lab_tech/percentile_spec.rb +85 -0
  58. data/spec/models/lab_tech/result_spec.rb +198 -0
  59. data/spec/models/lab_tech/speedup_spec.rb +133 -0
  60. data/spec/models/lab_tech/summary_spec.rb +325 -0
  61. data/spec/models/lab_tech_spec.rb +23 -0
  62. data/spec/rails_helper.rb +62 -0
  63. data/spec/spec_helper.rb +98 -0
  64. data/spec/support/misc_helpers.rb +7 -0
  65. metadata +238 -0
@@ -0,0 +1,23 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe LabTech do
4
+
5
+ describe ".science" do
6
+ let(:experiment) { instance_double(LabTech::Experiment) }
7
+
8
+ before do
9
+ allow( LabTech::Experiment ).to receive( :named ).with( "wibble" ).and_return( experiment )
10
+ end
11
+
12
+ it "finds the named LabTech::Experiment.science, yields it to the block, then runs it" do
13
+ yielded = nil
14
+ expect( experiment ).to receive( :run ).with( nil )
15
+ LabTech.science "wibble", foo: "spam" do |exp|
16
+ yielded = exp
17
+ end
18
+
19
+ expect( yielded ).to be( experiment )
20
+ end
21
+ end
22
+
23
+ end
@@ -0,0 +1,62 @@
1
+ # This file is copied to spec/ when you run 'rails generate rspec:install'
2
+ require 'spec_helper'
3
+ ENV['RAILS_ENV'] ||= 'test'
4
+ require File.expand_path('../dummy/config/environment', __FILE__)
5
+ # Prevent database truncation if the environment is production
6
+ abort("The Rails environment is running in production mode!") if Rails.env.production?
7
+ require 'rspec/rails'
8
+ # Add additional requires below this line. Rails is not loaded until this point!
9
+
10
+ # Requires supporting ruby files with custom matchers and macros, etc, in
11
+ # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
12
+ # run as spec files by default. This means that files in spec/support that end
13
+ # in _spec.rb will both be required and run as specs, causing the specs to be
14
+ # run twice. It is recommended that you do not name files matching this glob to
15
+ # end with _spec.rb. You can configure this pattern with the --pattern
16
+ # option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
17
+ #
18
+ # The following line is provided for convenience purposes. It has the downside
19
+ # of increasing the boot-up time by auto-requiring all files in the support
20
+ # directory. Alternatively, in the individual `*_spec.rb` files, manually
21
+ # require only the support files necessary.
22
+ #
23
+ # Dir[Rails.root.join('spec', 'support', '**', '*.rb')].each { |f| require f }
24
+
25
+ # Checks for pending migrations and applies them before tests are run.
26
+ # If you are not using ActiveRecord, you can remove these lines.
27
+ begin
28
+ ActiveRecord::Migration.maintain_test_schema!
29
+ rescue ActiveRecord::PendingMigrationError => e
30
+ puts e.to_s.strip
31
+ exit 1
32
+ end
33
+
34
+ RSpec.configure do |config|
35
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
36
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
37
+
38
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
39
+ # examples within a transaction, remove the following line or assign false
40
+ # instead of true.
41
+ config.use_transactional_fixtures = true
42
+
43
+ # RSpec Rails can automatically mix in different behaviours to your tests
44
+ # based on their file location, for example enabling you to call `get` and
45
+ # `post` in specs under `spec/controllers`.
46
+ #
47
+ # You can disable this behaviour by removing the line below, and instead
48
+ # explicitly tag your specs with their type, e.g.:
49
+ #
50
+ # RSpec.describe UsersController, :type => :controller do
51
+ # # ...
52
+ # end
53
+ #
54
+ # The different available types are documented in the features, such as in
55
+ # https://relishapp.com/rspec/rspec-rails/docs
56
+ config.infer_spec_type_from_file_location!
57
+
58
+ # Filter lines from Rails gems in backtraces.
59
+ config.filter_rails_from_backtrace!
60
+ # arbitrary gems may also be filtered via:
61
+ # config.filter_gems_from_backtrace("gem name")
62
+ end
@@ -0,0 +1,98 @@
1
+ # This file was generated by the `rails generate rspec:install` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
4
+ # this file to always be loaded, without a need to explicitly require it in any
5
+ # files.
6
+ #
7
+ # Given that it is always loaded, you are encouraged to keep this file as
8
+ # light-weight as possible. Requiring heavyweight dependencies from this file
9
+ # will add to the boot time of your test suite on EVERY test run, even for an
10
+ # individual file that may not need all of that loaded. Instead, consider making
11
+ # a separate helper file that requires the additional dependencies and performs
12
+ # the additional setup, and require it from the spec files that actually need
13
+ # it.
14
+ #
15
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
16
+ RSpec.configure do |config|
17
+ # rspec-expectations config goes here. You can use an alternate
18
+ # assertion/expectation library such as wrong or the stdlib/minitest
19
+ # assertions if you prefer.
20
+ config.expect_with :rspec do |expectations|
21
+ # This option will default to `true` in RSpec 4. It makes the `description`
22
+ # and `failure_message` of custom matchers include text for helper methods
23
+ # defined using `chain`, e.g.:
24
+ # be_bigger_than(2).and_smaller_than(4).description
25
+ # # => "be bigger than 2 and smaller than 4"
26
+ # ...rather than:
27
+ # # => "be bigger than 2"
28
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
29
+ end
30
+
31
+ # rspec-mocks config goes here. You can use an alternate test double
32
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
33
+ config.mock_with :rspec do |mocks|
34
+ # Prevents you from mocking or stubbing a method that does not exist on
35
+ # a real object. This is generally recommended, and will default to
36
+ # `true` in RSpec 4.
37
+ mocks.verify_partial_doubles = true
38
+ end
39
+
40
+ # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
41
+ # have no way to turn it off -- the option exists only for backwards
42
+ # compatibility in RSpec 3). It causes shared context metadata to be
43
+ # inherited by the metadata hash of host groups and examples, rather than
44
+ # triggering implicit auto-inclusion in groups with matching metadata.
45
+ config.shared_context_metadata_behavior = :apply_to_host_groups
46
+
47
+ # This allows you to limit a spec run to individual examples or groups
48
+ # you care about by tagging them with `:focus` metadata. When nothing
49
+ # is tagged with `:focus`, all examples get run. RSpec also provides
50
+ # aliases for `it`, `describe`, and `context` that include `:focus`
51
+ # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
52
+ config.filter_run_when_matching :focus
53
+
54
+ # Allows RSpec to persist some state between runs in order to support
55
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
56
+ # you configure your source control system to ignore this file.
57
+ config.example_status_persistence_file_path = "spec/examples.txt"
58
+
59
+ # Limits the available syntax to the non-monkey patched syntax that is
60
+ # recommended. For more details, see:
61
+ # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
62
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
63
+ # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
64
+ config.disable_monkey_patching!
65
+
66
+ # Many RSpec users commonly either run the entire suite or an individual
67
+ # file, and it's useful to allow more verbose output when running an
68
+ # individual spec file.
69
+ if config.files_to_run.one?
70
+ # Use the documentation formatter for detailed output,
71
+ # unless a formatter has already been configured
72
+ # (e.g. via a command-line flag).
73
+ config.default_formatter = "doc"
74
+ end
75
+
76
+ # Print the 10 slowest examples and example groups at the
77
+ # end of the spec run, to help surface which specs are running
78
+ # particularly slow.
79
+ # config.profile_examples = 10
80
+
81
+ # Run specs in random order to surface order dependencies. If you find an
82
+ # order dependency and want to debug it, you can fix the order by providing
83
+ # the seed, which is printed after each run.
84
+ # --seed 1234
85
+ config.order = :random
86
+
87
+ # Seed global randomization in this process using the `--seed` CLI option.
88
+ # Setting this allows you to use `--seed` to deterministically reproduce
89
+ # test failures related to randomization by passing the same `--seed` value
90
+ # as the one that triggered the failure.
91
+ Kernel.srand config.seed
92
+ end
93
+
94
+ require "awesome_print"
95
+ require "table_print"
96
+
97
+ SPEC_ROOT = Pathname.new( File.dirname(__FILE__) )
98
+
@@ -0,0 +1,7 @@
1
+ def wtf
2
+ puts "", "#" * 100
3
+ puts "\nExperiments" ; tp LabTech::Experiment.all
4
+ puts "\nResults" ; tp LabTech::Result.all
5
+ puts "\nObservations" ; tp LabTech::Observation.all
6
+ puts "", "#" * 100
7
+ end
metadata ADDED
@@ -0,0 +1,238 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lab_tech
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Sam Livingston-Gray
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-08-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '5.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '5.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: scientist
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.3'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: sqlite3
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec-rails
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.8'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.8'
69
+ - !ruby/object:Gem::Dependency
70
+ name: awesome_print
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: table_print
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: Tools for using GitHub's 'Scientist' library with ActiveRecord, for those
98
+ of us not operating apps at ROFLscale
99
+ email:
100
+ - geeksam@gmail.com
101
+ executables: []
102
+ extensions: []
103
+ extra_rdoc_files: []
104
+ files:
105
+ - MIT-LICENSE
106
+ - README.md
107
+ - Rakefile
108
+ - app/models/lab_tech/application_record.rb
109
+ - app/models/lab_tech/default_cleaner.rb
110
+ - app/models/lab_tech/experiment.rb
111
+ - app/models/lab_tech/observation.rb
112
+ - app/models/lab_tech/percentile.rb
113
+ - app/models/lab_tech/result.rb
114
+ - app/models/lab_tech/speedup.rb
115
+ - app/models/lab_tech/summary.rb
116
+ - config/routes.rb
117
+ - db/migrate/20190815192130_create_experiment_tables.rb
118
+ - lib/lab_tech.rb
119
+ - lib/lab_tech/engine.rb
120
+ - lib/lab_tech/version.rb
121
+ - lib/tasks/lab_tech_tasks.rake
122
+ - spec/dummy/Rakefile
123
+ - spec/dummy/app/assets/config/manifest.js
124
+ - spec/dummy/app/assets/javascripts/application.js
125
+ - spec/dummy/app/assets/stylesheets/application.css
126
+ - spec/dummy/app/controllers/application_controller.rb
127
+ - spec/dummy/app/jobs/application_job.rb
128
+ - spec/dummy/app/models/application_record.rb
129
+ - spec/dummy/bin/bundle
130
+ - spec/dummy/bin/rails
131
+ - spec/dummy/bin/rake
132
+ - spec/dummy/bin/setup
133
+ - spec/dummy/bin/update
134
+ - spec/dummy/config.ru
135
+ - spec/dummy/config/application.rb
136
+ - spec/dummy/config/boot.rb
137
+ - spec/dummy/config/database.yml
138
+ - spec/dummy/config/environment.rb
139
+ - spec/dummy/config/environments/development.rb
140
+ - spec/dummy/config/environments/production.rb
141
+ - spec/dummy/config/environments/test.rb
142
+ - spec/dummy/config/initializers/application_controller_renderer.rb
143
+ - spec/dummy/config/initializers/backtrace_silencers.rb
144
+ - spec/dummy/config/initializers/cors.rb
145
+ - spec/dummy/config/initializers/filter_parameter_logging.rb
146
+ - spec/dummy/config/initializers/inflections.rb
147
+ - spec/dummy/config/initializers/mime_types.rb
148
+ - spec/dummy/config/initializers/wrap_parameters.rb
149
+ - spec/dummy/config/locales/en.yml
150
+ - spec/dummy/config/puma.rb
151
+ - spec/dummy/config/routes.rb
152
+ - spec/dummy/config/spring.rb
153
+ - spec/dummy/db/schema.rb
154
+ - spec/dummy/db/test.sqlite3
155
+ - spec/dummy/log/development.log
156
+ - spec/dummy/log/test.log
157
+ - spec/examples.txt
158
+ - spec/models/lab_tech/default_cleaner_spec.rb
159
+ - spec/models/lab_tech/experiment_spec.rb
160
+ - spec/models/lab_tech/percentile_spec.rb
161
+ - spec/models/lab_tech/result_spec.rb
162
+ - spec/models/lab_tech/speedup_spec.rb
163
+ - spec/models/lab_tech/summary_spec.rb
164
+ - spec/models/lab_tech_spec.rb
165
+ - spec/rails_helper.rb
166
+ - spec/spec_helper.rb
167
+ - spec/support/misc_helpers.rb
168
+ homepage: https://github.com/RealGeeks/lab_tech
169
+ licenses:
170
+ - MIT
171
+ metadata: {}
172
+ post_install_message:
173
+ rdoc_options: []
174
+ require_paths:
175
+ - lib
176
+ required_ruby_version: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ required_rubygems_version: !ruby/object:Gem::Requirement
182
+ requirements:
183
+ - - ">="
184
+ - !ruby/object:Gem::Version
185
+ version: '0'
186
+ requirements: []
187
+ rubygems_version: 3.0.3
188
+ signing_key:
189
+ specification_version: 4
190
+ summary: Tools for using GitHub's 'Scientist' library with ActiveRecord, for those
191
+ of us not operating apps at ROFLscale
192
+ test_files:
193
+ - spec/spec_helper.rb
194
+ - spec/dummy/app/models/application_record.rb
195
+ - spec/dummy/app/jobs/application_job.rb
196
+ - spec/dummy/app/controllers/application_controller.rb
197
+ - spec/dummy/app/assets/config/manifest.js
198
+ - spec/dummy/app/assets/javascripts/application.js
199
+ - spec/dummy/app/assets/stylesheets/application.css
200
+ - spec/dummy/bin/update
201
+ - spec/dummy/bin/rake
202
+ - spec/dummy/bin/setup
203
+ - spec/dummy/bin/bundle
204
+ - spec/dummy/bin/rails
205
+ - spec/dummy/config/routes.rb
206
+ - spec/dummy/config/locales/en.yml
207
+ - spec/dummy/config/environments/production.rb
208
+ - spec/dummy/config/environments/development.rb
209
+ - spec/dummy/config/environments/test.rb
210
+ - spec/dummy/config/spring.rb
211
+ - spec/dummy/config/environment.rb
212
+ - spec/dummy/config/application.rb
213
+ - spec/dummy/config/puma.rb
214
+ - spec/dummy/config/database.yml
215
+ - spec/dummy/config/boot.rb
216
+ - spec/dummy/config/initializers/application_controller_renderer.rb
217
+ - spec/dummy/config/initializers/backtrace_silencers.rb
218
+ - spec/dummy/config/initializers/mime_types.rb
219
+ - spec/dummy/config/initializers/filter_parameter_logging.rb
220
+ - spec/dummy/config/initializers/wrap_parameters.rb
221
+ - spec/dummy/config/initializers/inflections.rb
222
+ - spec/dummy/config/initializers/cors.rb
223
+ - spec/dummy/config.ru
224
+ - spec/dummy/Rakefile
225
+ - spec/dummy/db/schema.rb
226
+ - spec/dummy/db/test.sqlite3
227
+ - spec/dummy/log/test.log
228
+ - spec/dummy/log/development.log
229
+ - spec/examples.txt
230
+ - spec/models/lab_tech/summary_spec.rb
231
+ - spec/models/lab_tech/percentile_spec.rb
232
+ - spec/models/lab_tech/result_spec.rb
233
+ - spec/models/lab_tech/default_cleaner_spec.rb
234
+ - spec/models/lab_tech/experiment_spec.rb
235
+ - spec/models/lab_tech/speedup_spec.rb
236
+ - spec/models/lab_tech_spec.rb
237
+ - spec/support/misc_helpers.rb
238
+ - spec/rails_helper.rb