gatherable 0.0.1

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.
Files changed (62) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/Rakefile +6 -0
  4. data/app/assets/javascripts/gatherable/application.js +13 -0
  5. data/app/controllers/gatherable/application_controller.rb +43 -0
  6. data/app/models/data_point.rb +28 -0
  7. data/app/writers/controller_writer.rb +34 -0
  8. data/app/writers/migration_writer.rb +90 -0
  9. data/app/writers/model_writer.rb +36 -0
  10. data/config/routes.rb +2 -0
  11. data/lib/gatherable.rb +41 -0
  12. data/lib/gatherable/configuration.rb +19 -0
  13. data/lib/gatherable/engine.rb +5 -0
  14. data/lib/gatherable/version.rb +3 -0
  15. data/lib/generators/gatherable/USAGE +32 -0
  16. data/lib/generators/gatherable/gatherable_generator.rb +33 -0
  17. data/lib/generators/gatherable/templates/application_controller.rb +43 -0
  18. data/lib/generators/gatherable/templates/gatherable.rb +9 -0
  19. data/lib/tasks/db_tasks.rake +14 -0
  20. data/lib/tasks/gatherable_tasks.rake +6 -0
  21. data/lib/version.rb +3 -0
  22. data/spec/controllers/gatherable/application_controller_spec.rb +110 -0
  23. data/spec/dummy/Rakefile +6 -0
  24. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  25. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  26. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  27. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  28. data/spec/dummy/bin/bundle +3 -0
  29. data/spec/dummy/bin/rails +4 -0
  30. data/spec/dummy/bin/rake +4 -0
  31. data/spec/dummy/bin/setup +29 -0
  32. data/spec/dummy/config.ru +4 -0
  33. data/spec/dummy/config/application.rb +26 -0
  34. data/spec/dummy/config/boot.rb +5 -0
  35. data/spec/dummy/config/database.yml +11 -0
  36. data/spec/dummy/config/database.yml.travis +4 -0
  37. data/spec/dummy/config/environment.rb +5 -0
  38. data/spec/dummy/config/environments/development.rb +41 -0
  39. data/spec/dummy/config/environments/production.rb +79 -0
  40. data/spec/dummy/config/environments/test.rb +42 -0
  41. data/spec/dummy/config/initializers/assets.rb +11 -0
  42. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  43. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  44. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  45. data/spec/dummy/config/initializers/inflections.rb +16 -0
  46. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  47. data/spec/dummy/config/initializers/session_store.rb +3 -0
  48. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  49. data/spec/dummy/config/locales/en.yml +23 -0
  50. data/spec/dummy/config/routes.rb +3 -0
  51. data/spec/dummy/config/secrets.yml +5 -0
  52. data/spec/dummy/log/test.log +1550 -0
  53. data/spec/dummy/public/404.html +67 -0
  54. data/spec/dummy/public/422.html +67 -0
  55. data/spec/dummy/public/500.html +66 -0
  56. data/spec/dummy/public/favicon.ico +0 -0
  57. data/spec/lib/gatherable_spec.rb +88 -0
  58. data/spec/lib/generators/gatherable_generator_spec.rb +107 -0
  59. data/spec/models/data_point_spec.rb +44 -0
  60. data/spec/rails_helper.rb +57 -0
  61. data/spec/spec_helper.rb +92 -0
  62. metadata +243 -0
@@ -0,0 +1,57 @@
1
+ # This file is copied to spec/ when you run 'rails generate rspec:install'
2
+ ENV['RAILS_ENV'] ||= 'test'
3
+ require File.expand_path('../dummy/config/environment.rb', __FILE__)
4
+ # Prevent database truncation if the environment is production
5
+ abort("The Rails environment is running in production mode!") if Rails.env.production?
6
+ require 'spec_helper'
7
+ require 'rspec/rails'
8
+ require 'gatherable'
9
+ require 'webmock'
10
+ require 'pry'
11
+ require 'rake'
12
+ # Add additional requires below this line. Rails is not loaded until this point!
13
+
14
+ # Requires supporting ruby files with custom matchers and macros, etc, in
15
+ # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
16
+ # run as spec files by default. This means that files in spec/support that end
17
+ # in _spec.rb will both be required and run as specs, causing the specs to be
18
+ # run twice. It is recommended that you do not name files matching this glob to
19
+ # end with _spec.rb. You can configure this pattern with the --pattern
20
+ # option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
21
+ #
22
+ # The following line is provided for convenience purposes. It has the downside
23
+ # of increasing the boot-up time by auto-requiring all files in the support
24
+ # directory. Alternatively, in the individual `*_spec.rb` files, manually
25
+ # require only the support files necessary.
26
+ #
27
+ # Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
28
+
29
+ # Checks for pending migration and applies them before tests are run.
30
+ # If you are not using ActiveRecord, you can remove this line.
31
+ ActiveRecord::Migration.maintain_test_schema!
32
+
33
+ RSpec.configure do |config|
34
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
35
+ # examples within a transaction, remove the following line or assign false
36
+ # instead of true.
37
+ config.use_transactional_fixtures = true
38
+
39
+ config.infer_spec_type_from_file_location!
40
+
41
+ # Filter lines from Rails gems in backtraces.
42
+ config.filter_rails_from_backtrace!
43
+
44
+ config.before(:suite) do
45
+
46
+ Gatherable.configure do |c|
47
+ c.global_identifier = :session_id
48
+ c.data_point :price, :decimal
49
+ end
50
+ Rails.application.load_tasks
51
+ Rake::Task['db:prepare'].invoke #this is essentially an integration test of the migration writer
52
+ end
53
+
54
+ config.after(:suite) do
55
+ FileUtils.rm_rf('db/migrate')
56
+ end
57
+ end
@@ -0,0 +1,92 @@
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
+ # The `.rspec` file also contains a few flags that are not defaults but that
16
+ # users commonly want.
17
+ #
18
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
19
+ RSpec.configure do |config|
20
+ # rspec-expectations config goes here. You can use an alternate
21
+ # assertion/expectation library such as wrong or the stdlib/minitest
22
+ # assertions if you prefer.
23
+ config.expect_with :rspec do |expectations|
24
+ # This option will default to `true` in RSpec 4. It makes the `description`
25
+ # and `failure_message` of custom matchers include text for helper methods
26
+ # defined using `chain`, e.g.:
27
+ # be_bigger_than(2).and_smaller_than(4).description
28
+ # # => "be bigger than 2 and smaller than 4"
29
+ # ...rather than:
30
+ # # => "be bigger than 2"
31
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
32
+ end
33
+
34
+ # rspec-mocks config goes here. You can use an alternate test double
35
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
36
+ config.mock_with :rspec do |mocks|
37
+ # Prevents you from mocking or stubbing a method that does not exist on
38
+ # a real object. This is generally recommended, and will default to
39
+ # `true` in RSpec 4.
40
+ mocks.verify_partial_doubles = true
41
+ end
42
+
43
+ # The settings below are suggested to provide a good initial experience
44
+ # with RSpec, but feel free to customize to your heart's content.
45
+ =begin
46
+ # These two settings work together to allow you to limit a spec run
47
+ # to individual examples or groups you care about by tagging them with
48
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
49
+ # get run.
50
+ config.filter_run :focus
51
+ config.run_all_when_everything_filtered = true
52
+
53
+ # Allows RSpec to persist some state between runs in order to support
54
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
55
+ # you configure your source control system to ignore this file.
56
+ config.example_status_persistence_file_path = "spec/examples.txt"
57
+
58
+ # Limits the available syntax to the non-monkey patched syntax that is
59
+ # recommended. For more details, see:
60
+ # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
61
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
62
+ # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
63
+ config.disable_monkey_patching!
64
+
65
+ # Many RSpec users commonly either run the entire suite or an individual
66
+ # file, and it's useful to allow more verbose output when running an
67
+ # individual spec file.
68
+ if config.files_to_run.one?
69
+ # Use the documentation formatter for detailed output,
70
+ # unless a formatter has already been configured
71
+ # (e.g. via a command-line flag).
72
+ config.default_formatter = 'doc'
73
+ end
74
+
75
+ # Print the 10 slowest examples and example groups at the
76
+ # end of the spec run, to help surface which specs are running
77
+ # particularly slow.
78
+ config.profile_examples = 10
79
+
80
+ # Run specs in random order to surface order dependencies. If you find an
81
+ # order dependency and want to debug it, you can fix the order by providing
82
+ # the seed, which is printed after each run.
83
+ # --seed 1234
84
+ config.order = :random
85
+
86
+ # Seed global randomization in this process using the `--seed` CLI option.
87
+ # Setting this allows you to use `--seed` to deterministically reproduce
88
+ # test failures related to randomization by passing the same `--seed` value
89
+ # as the one that triggered the failure.
90
+ Kernel.srand config.seed
91
+ =end
92
+ end
metadata ADDED
@@ -0,0 +1,243 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gatherable
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Daniel Schepers
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-01-06 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: 3.0.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 3.0.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: pg
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry
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: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec-rails
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: simplecov
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
+ - !ruby/object:Gem::Dependency
98
+ name: webmock
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: Gatherable dynamically defines models, controllers, and routes
112
+ email:
113
+ - schepedw@gmail.com
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - MIT-LICENSE
119
+ - Rakefile
120
+ - app/assets/javascripts/gatherable/application.js
121
+ - app/controllers/gatherable/application_controller.rb
122
+ - app/models/data_point.rb
123
+ - app/writers/controller_writer.rb
124
+ - app/writers/migration_writer.rb
125
+ - app/writers/model_writer.rb
126
+ - config/routes.rb
127
+ - lib/gatherable.rb
128
+ - lib/gatherable/configuration.rb
129
+ - lib/gatherable/engine.rb
130
+ - lib/gatherable/version.rb
131
+ - lib/generators/gatherable/USAGE
132
+ - lib/generators/gatherable/gatherable_generator.rb
133
+ - lib/generators/gatherable/templates/application_controller.rb
134
+ - lib/generators/gatherable/templates/gatherable.rb
135
+ - lib/tasks/db_tasks.rake
136
+ - lib/tasks/gatherable_tasks.rake
137
+ - lib/version.rb
138
+ - spec/controllers/gatherable/application_controller_spec.rb
139
+ - spec/dummy/Rakefile
140
+ - spec/dummy/app/assets/javascripts/application.js
141
+ - spec/dummy/app/assets/stylesheets/application.css
142
+ - spec/dummy/app/controllers/application_controller.rb
143
+ - spec/dummy/app/views/layouts/application.html.erb
144
+ - spec/dummy/bin/bundle
145
+ - spec/dummy/bin/rails
146
+ - spec/dummy/bin/rake
147
+ - spec/dummy/bin/setup
148
+ - spec/dummy/config.ru
149
+ - spec/dummy/config/application.rb
150
+ - spec/dummy/config/boot.rb
151
+ - spec/dummy/config/database.yml
152
+ - spec/dummy/config/database.yml.travis
153
+ - spec/dummy/config/environment.rb
154
+ - spec/dummy/config/environments/development.rb
155
+ - spec/dummy/config/environments/production.rb
156
+ - spec/dummy/config/environments/test.rb
157
+ - spec/dummy/config/initializers/assets.rb
158
+ - spec/dummy/config/initializers/backtrace_silencers.rb
159
+ - spec/dummy/config/initializers/cookies_serializer.rb
160
+ - spec/dummy/config/initializers/filter_parameter_logging.rb
161
+ - spec/dummy/config/initializers/inflections.rb
162
+ - spec/dummy/config/initializers/mime_types.rb
163
+ - spec/dummy/config/initializers/session_store.rb
164
+ - spec/dummy/config/initializers/wrap_parameters.rb
165
+ - spec/dummy/config/locales/en.yml
166
+ - spec/dummy/config/routes.rb
167
+ - spec/dummy/config/secrets.yml
168
+ - spec/dummy/log/test.log
169
+ - spec/dummy/public/404.html
170
+ - spec/dummy/public/422.html
171
+ - spec/dummy/public/500.html
172
+ - spec/dummy/public/favicon.ico
173
+ - spec/lib/gatherable_spec.rb
174
+ - spec/lib/generators/gatherable_generator_spec.rb
175
+ - spec/models/data_point_spec.rb
176
+ - spec/rails_helper.rb
177
+ - spec/spec_helper.rb
178
+ homepage:
179
+ licenses:
180
+ - MIT
181
+ metadata: {}
182
+ post_install_message:
183
+ rdoc_options: []
184
+ require_paths:
185
+ - lib
186
+ required_ruby_version: !ruby/object:Gem::Requirement
187
+ requirements:
188
+ - - ">="
189
+ - !ruby/object:Gem::Version
190
+ version: '0'
191
+ required_rubygems_version: !ruby/object:Gem::Requirement
192
+ requirements:
193
+ - - ">="
194
+ - !ruby/object:Gem::Version
195
+ version: '0'
196
+ requirements: []
197
+ rubyforge_project:
198
+ rubygems_version: 2.4.5
199
+ signing_key:
200
+ specification_version: 4
201
+ summary: Painless gather and store data
202
+ test_files:
203
+ - spec/controllers/gatherable/application_controller_spec.rb
204
+ - spec/dummy/app/assets/javascripts/application.js
205
+ - spec/dummy/app/assets/stylesheets/application.css
206
+ - spec/dummy/app/controllers/application_controller.rb
207
+ - spec/dummy/app/views/layouts/application.html.erb
208
+ - spec/dummy/bin/bundle
209
+ - spec/dummy/bin/rails
210
+ - spec/dummy/bin/rake
211
+ - spec/dummy/bin/setup
212
+ - spec/dummy/config/application.rb
213
+ - spec/dummy/config/boot.rb
214
+ - spec/dummy/config/database.yml
215
+ - spec/dummy/config/database.yml.travis
216
+ - spec/dummy/config/environment.rb
217
+ - spec/dummy/config/environments/development.rb
218
+ - spec/dummy/config/environments/production.rb
219
+ - spec/dummy/config/environments/test.rb
220
+ - spec/dummy/config/initializers/assets.rb
221
+ - spec/dummy/config/initializers/backtrace_silencers.rb
222
+ - spec/dummy/config/initializers/cookies_serializer.rb
223
+ - spec/dummy/config/initializers/filter_parameter_logging.rb
224
+ - spec/dummy/config/initializers/inflections.rb
225
+ - spec/dummy/config/initializers/mime_types.rb
226
+ - spec/dummy/config/initializers/session_store.rb
227
+ - spec/dummy/config/initializers/wrap_parameters.rb
228
+ - spec/dummy/config/locales/en.yml
229
+ - spec/dummy/config/routes.rb
230
+ - spec/dummy/config/secrets.yml
231
+ - spec/dummy/config.ru
232
+ - spec/dummy/log/test.log
233
+ - spec/dummy/public/404.html
234
+ - spec/dummy/public/422.html
235
+ - spec/dummy/public/500.html
236
+ - spec/dummy/public/favicon.ico
237
+ - spec/dummy/Rakefile
238
+ - spec/lib/gatherable_spec.rb
239
+ - spec/lib/generators/gatherable_generator_spec.rb
240
+ - spec/models/data_point_spec.rb
241
+ - spec/rails_helper.rb
242
+ - spec/spec_helper.rb
243
+ has_rdoc: