gatherable 0.0.1 → 0.0.2
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/app/models/{data_point.rb → data_table.rb} +4 -4
- data/app/writers/controller_writer.rb +6 -6
- data/app/writers/migration_writer.rb +13 -8
- data/app/writers/model_writer.rb +7 -7
- data/lib/gatherable.rb +4 -4
- data/lib/gatherable/configuration.rb +8 -4
- data/lib/gatherable/version.rb +1 -1
- data/lib/generators/gatherable/gatherable_generator.rb +6 -6
- data/lib/generators/gatherable/templates/gatherable.rb +6 -0
- data/spec/controllers/gatherable/application_controller_spec.rb +2 -1
- data/spec/dummy/log/development.log +0 -0
- data/spec/dummy/log/test.log +2209 -0
- data/spec/lib/gatherable_spec.rb +13 -7
- data/spec/lib/generators/gatherable_generator_spec.rb +1 -1
- data/spec/models/{data_point_spec.rb → data_table_spec.rb} +2 -18
- data/spec/rails_helper.rb +2 -1
- metadata +9 -8
- data/lib/version.rb +0 -3
data/spec/lib/gatherable_spec.rb
CHANGED
@@ -3,14 +3,20 @@ require "gatherable/configuration"
|
|
3
3
|
|
4
4
|
describe Gatherable do
|
5
5
|
describe '#configuration' do
|
6
|
-
context 'data
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
context 'data tables' do
|
7
|
+
context 'saving data tables' do
|
8
|
+
it 'saves data tables' do
|
9
|
+
expect(Gatherable.config.data_tables.count).to eql 1
|
10
|
+
end
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
12
|
+
it 'saves data tables as data with correct name' do
|
13
|
+
expect(Gatherable.config.data_tables.first.name).to eql :price
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'saves data tables as data tables with correct columns' do
|
17
|
+
expect(Gatherable.config.data_tables.first.columns).to eql \
|
18
|
+
({:monthly_repayment_amount => :decimal,:price => :decimal, :total_cost => :decimal})
|
19
|
+
end
|
14
20
|
end
|
15
21
|
end
|
16
22
|
|
@@ -81,7 +81,7 @@ end
|
|
81
81
|
|
82
82
|
context 'setup' do
|
83
83
|
it 'copies application controller' do
|
84
|
-
allow(Gatherable.config).to receive(:
|
84
|
+
allow(Gatherable.config).to receive(:data_tables) { [] }
|
85
85
|
expect(generator).to receive(:copy_file).with('application_controller.rb', 'app/controllers/gatherable/application_controller.rb')
|
86
86
|
Rails::Generators.invoke('gatherable', ['controllers'])
|
87
87
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'rails_helper'
|
2
2
|
|
3
3
|
module Gatherable
|
4
|
-
describe
|
5
|
-
subject(:
|
4
|
+
describe DataTable do
|
5
|
+
subject(:data_table) { described_class.new(:price, :decimal) }
|
6
6
|
context 'generating models' do
|
7
7
|
before { subject.classify }
|
8
8
|
it 'creates the model class' do
|
@@ -24,21 +24,5 @@ module Gatherable
|
|
24
24
|
expect(Gatherable::PricesController.superclass).to be Gatherable::ApplicationController
|
25
25
|
end
|
26
26
|
end
|
27
|
-
|
28
|
-
#TODO: move these
|
29
|
-
=begin
|
30
|
-
before do
|
31
|
-
Gatherable.configure do |config|
|
32
|
-
config.data_point :price, :decimal
|
33
|
-
end
|
34
|
-
end
|
35
|
-
it 'indexes the global_identifier' do
|
36
|
-
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'prefixes the primary key with the class name' do
|
40
|
-
|
41
|
-
end
|
42
|
-
=end
|
43
27
|
end
|
44
28
|
end
|
data/spec/rails_helper.rb
CHANGED
@@ -45,8 +45,9 @@ RSpec.configure do |config|
|
|
45
45
|
|
46
46
|
Gatherable.configure do |c|
|
47
47
|
c.global_identifier = :session_id
|
48
|
-
c.
|
48
|
+
c.data_table :price, { price: :decimal, total_cost: :decimal, monthly_repayment_amount: :decimal }
|
49
49
|
end
|
50
|
+
|
50
51
|
Rails.application.load_tasks
|
51
52
|
Rake::Task['db:prepare'].invoke #this is essentially an integration test of the migration writer
|
52
53
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gatherable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Schepers
|
@@ -108,7 +108,7 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
-
description:
|
111
|
+
description: Dynamically define models, controllers, and routes
|
112
112
|
email:
|
113
113
|
- schepedw@gmail.com
|
114
114
|
executables: []
|
@@ -119,7 +119,7 @@ files:
|
|
119
119
|
- Rakefile
|
120
120
|
- app/assets/javascripts/gatherable/application.js
|
121
121
|
- app/controllers/gatherable/application_controller.rb
|
122
|
-
- app/models/
|
122
|
+
- app/models/data_table.rb
|
123
123
|
- app/writers/controller_writer.rb
|
124
124
|
- app/writers/migration_writer.rb
|
125
125
|
- app/writers/model_writer.rb
|
@@ -134,7 +134,6 @@ files:
|
|
134
134
|
- lib/generators/gatherable/templates/gatherable.rb
|
135
135
|
- lib/tasks/db_tasks.rake
|
136
136
|
- lib/tasks/gatherable_tasks.rake
|
137
|
-
- lib/version.rb
|
138
137
|
- spec/controllers/gatherable/application_controller_spec.rb
|
139
138
|
- spec/dummy/Rakefile
|
140
139
|
- spec/dummy/app/assets/javascripts/application.js
|
@@ -165,6 +164,7 @@ files:
|
|
165
164
|
- spec/dummy/config/locales/en.yml
|
166
165
|
- spec/dummy/config/routes.rb
|
167
166
|
- spec/dummy/config/secrets.yml
|
167
|
+
- spec/dummy/log/development.log
|
168
168
|
- spec/dummy/log/test.log
|
169
169
|
- spec/dummy/public/404.html
|
170
170
|
- spec/dummy/public/422.html
|
@@ -172,10 +172,10 @@ files:
|
|
172
172
|
- spec/dummy/public/favicon.ico
|
173
173
|
- spec/lib/gatherable_spec.rb
|
174
174
|
- spec/lib/generators/gatherable_generator_spec.rb
|
175
|
-
- spec/models/
|
175
|
+
- spec/models/data_table_spec.rb
|
176
176
|
- spec/rails_helper.rb
|
177
177
|
- spec/spec_helper.rb
|
178
|
-
homepage:
|
178
|
+
homepage: https://github.com/schepedw/gatherable
|
179
179
|
licenses:
|
180
180
|
- MIT
|
181
181
|
metadata: {}
|
@@ -198,7 +198,7 @@ rubyforge_project:
|
|
198
198
|
rubygems_version: 2.4.5
|
199
199
|
signing_key:
|
200
200
|
specification_version: 4
|
201
|
-
summary:
|
201
|
+
summary: Painlessly gather and store data
|
202
202
|
test_files:
|
203
203
|
- spec/controllers/gatherable/application_controller_spec.rb
|
204
204
|
- spec/dummy/app/assets/javascripts/application.js
|
@@ -229,6 +229,7 @@ test_files:
|
|
229
229
|
- spec/dummy/config/routes.rb
|
230
230
|
- spec/dummy/config/secrets.yml
|
231
231
|
- spec/dummy/config.ru
|
232
|
+
- spec/dummy/log/development.log
|
232
233
|
- spec/dummy/log/test.log
|
233
234
|
- spec/dummy/public/404.html
|
234
235
|
- spec/dummy/public/422.html
|
@@ -237,7 +238,7 @@ test_files:
|
|
237
238
|
- spec/dummy/Rakefile
|
238
239
|
- spec/lib/gatherable_spec.rb
|
239
240
|
- spec/lib/generators/gatherable_generator_spec.rb
|
240
|
-
- spec/models/
|
241
|
+
- spec/models/data_table_spec.rb
|
241
242
|
- spec/rails_helper.rb
|
242
243
|
- spec/spec_helper.rb
|
243
244
|
has_rdoc:
|
data/lib/version.rb
DELETED