caddie 0.1.2 → 0.2.0
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/caddie/crest_data_retriever.rb +1 -1
- data/app/models/caddie/crest_price_history_update.rb +11 -3
- data/app/models/caddie/m_threaded_updater.rb +38 -1
- data/app/models/crest_price_history.rb +4 -0
- data/db/migrate/20160725091214_add_indexes_to_crest_price_history_update.rb +8 -0
- data/lib/caddie/version.rb +1 -1
- data/lib/tasks/caddie_tasks.rake +8 -3
- data/lib/tasks/m_threaded_updater_test.rake +53 -0
- data/test/dummy/app/models/eve_item.rb +53 -0
- data/test/dummy/app/models/region.rb +4 -0
- data/test/dummy/config/database.yml +3 -3
- data/test/dummy/db/migrate/20150410082132_create_eve_items.rb +11 -0
- data/test/dummy/db/migrate/20150414095303_add_name_lowcase_to_eve_item.rb +5 -0
- data/test/dummy/db/migrate/20150416154256_rename_eve_item_id.rb +5 -0
- data/test/dummy/db/migrate/20150417135716_add_cost_to_eve_item.rb +5 -0
- data/test/dummy/db/migrate/20150906171550_add_cpp_market_group_id_to_eve_item.rb +6 -0
- data/test/dummy/db/migrate/20150909162142_add_involved_in_blueprint_to_eve_item.rb +5 -0
- data/test/dummy/db/migrate/20150910074544_create_regions.rb +11 -0
- data/test/dummy/db/migrate/20150910080646_create_crest_price_histories.rb +18 -0
- data/test/dummy/db/schema.rb +19 -299
- data/test/dummy/log/development.log +446 -54107
- data/test/dummy/log/test.log +46048 -0
- data/test/factories/caddie/crest_price_history_updates.rb +4 -0
- data/test/factories/caddie/eve_items.rb +54 -0
- data/test/factories/caddie/regions.rb +33 -0
- data/test/models/caddie/crest_price_history_update_test.rb +19 -4
- data/test/models/caddie/m_threaded_updater_test.rb +26 -0
- data/test/test_helper.rb +10 -0
- metadata +72 -30
- data/app/models/crest_price_history.rb +0 -1
- data/app/models/eve_item.rb +0 -1
- data/app/models/region.rb +0 -1
- data/test/fixtures/caddie/crest_price_history_update_logs.yml +0 -11
@@ -0,0 +1,54 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
|
3
|
+
factory :caddie_eve_item, class: EveItem do
|
4
|
+
|
5
|
+
cost 5
|
6
|
+
involved_in_blueprint true
|
7
|
+
|
8
|
+
sequence :cpp_eve_item_id do |n|
|
9
|
+
n
|
10
|
+
end
|
11
|
+
sequence :name do |n|
|
12
|
+
"Name #{n}"
|
13
|
+
end
|
14
|
+
sequence :name_lowcase do |n|
|
15
|
+
"name #{n}"
|
16
|
+
end
|
17
|
+
|
18
|
+
# An example of item with blueprint and market group
|
19
|
+
factory :caddie_inferno_fury_cruise_missile do
|
20
|
+
cpp_eve_item_id 2621
|
21
|
+
name "Inferno Fury Cruise Missile"
|
22
|
+
name_lowcase "inferno fury cruise missile"
|
23
|
+
cost 1815252.83
|
24
|
+
# market_group { FactoryGirl.create( :advanced_high_damage_cruise_missiles_market_group ) }
|
25
|
+
|
26
|
+
after(:create) do |eve_item|
|
27
|
+
# create( :inferno_fury_cruise_blueprint, eve_item: eve_item )
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
# An example of item with blueprint but no market group
|
33
|
+
factory :caddie_mjolnir_fury_cruise_missile do
|
34
|
+
cpp_eve_item_id 24535
|
35
|
+
name "Mjolnir Fury Cruise Missile"
|
36
|
+
name_lowcase "mjolnir fury cruise missile"
|
37
|
+
cost 1815252.83
|
38
|
+
|
39
|
+
after(:create) do |eve_item|
|
40
|
+
# create( :inferno_fury_cruise_blueprint, eve_item: eve_item )
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
# An example with no blueprint and no market group
|
46
|
+
factory :caddie_inferno_precision_cruise_missile do
|
47
|
+
cpp_eve_item_id 2637
|
48
|
+
name "Inferno Precision Cruise Missile"
|
49
|
+
name_lowcase "inferno precision cruise missile"
|
50
|
+
cost 1815252.83
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
|
3
|
+
factory :caddie_region, class: Region do
|
4
|
+
|
5
|
+
factory :caddie_heimatar do
|
6
|
+
cpp_region_id '10000030'
|
7
|
+
name 'Heimatar'
|
8
|
+
|
9
|
+
after(:create) do |region|
|
10
|
+
|
11
|
+
# pator = create( :rens, region: region )
|
12
|
+
# rens = create( :pator, region: region )
|
13
|
+
|
14
|
+
blueprint_and_market_group = create( :caddie_inferno_fury_cruise_missile )
|
15
|
+
blueprint_but_no_market_group = create( :caddie_mjolnir_fury_cruise_missile )
|
16
|
+
no_market_group_and_no_blueprint = create( :caddie_inferno_precision_cruise_missile )
|
17
|
+
|
18
|
+
[ blueprint_and_market_group, blueprint_but_no_market_group, no_market_group_and_no_blueprint ].each do |item|
|
19
|
+
|
20
|
+
# [ pator, rens ].each do |trade_hub|
|
21
|
+
# create( :min_price, trade_hub: trade_hub, eve_item: item )
|
22
|
+
# end
|
23
|
+
|
24
|
+
# create( :crest_prices_last_month_average, eve_item: item, region: region )
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -1,9 +1,24 @@
|
|
1
1
|
require 'test_helper'
|
2
|
+
require 'minitest/mock'
|
2
3
|
|
3
4
|
module Caddie
|
4
5
|
class CrestPriceHistoryUpdateTest < ActiveSupport::TestCase
|
5
|
-
|
6
|
-
|
7
|
-
|
6
|
+
|
7
|
+
def setup
|
8
|
+
@region = create( :caddie_heimatar )
|
9
|
+
next_process_date = Time.now.to_date
|
10
|
+
1.upto( 53 ).each do
|
11
|
+
item = create( :caddie_eve_item )
|
12
|
+
create( :crest_price_history_update, region: @region, eve_item: item, next_process_date: next_process_date )
|
13
|
+
end
|
14
|
+
Caddie::CrestPriceHistoryUpdate.stubs( :get_markets ).returns( [ [], 5 ] )
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
test 'feed_price_histories' do
|
19
|
+
result = Caddie::CrestPriceHistoryUpdate.feed_price_histories
|
20
|
+
assert_equal 265, result[1]
|
21
|
+
end
|
22
|
+
|
8
23
|
end
|
9
|
-
end
|
24
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
#
|
2
|
+
# I keep this because it is a very good example of fixture creation code
|
3
|
+
#
|
4
|
+
# @region = create( :heimatar )
|
5
|
+
# next_process_date = Time.now.to_date
|
6
|
+
# objs = []
|
7
|
+
# 1.upto( 53 ).each do
|
8
|
+
# item = create( :eve_item )
|
9
|
+
#
|
10
|
+
# obj = create( :crest_price_history_update, region: @region, eve_item: item, next_process_date: next_process_date )
|
11
|
+
# objs << obj
|
12
|
+
#
|
13
|
+
# end
|
14
|
+
|
15
|
+
# increment = 1
|
16
|
+
# File.open( 'test/fixtures/caddie/crest_price_history_updates.yml', 'w') do |f|
|
17
|
+
# objs.each do |obj|
|
18
|
+
# attrs = obj.attributes
|
19
|
+
# attrs.delete_if{|k,v| v.blank?}
|
20
|
+
#
|
21
|
+
# output = { 'r_' + increment.to_s => attrs}
|
22
|
+
# f << output.to_yaml.gsub(/^--- \n/,'') + "\n"
|
23
|
+
#
|
24
|
+
# increment += 1
|
25
|
+
# end
|
26
|
+
# end
|
data/test/test_helper.rb
CHANGED
@@ -19,3 +19,13 @@ if ActiveSupport::TestCase.respond_to?(:fixture_path=)
|
|
19
19
|
ActionDispatch::IntegrationTest.fixture_path = ActiveSupport::TestCase.fixture_path
|
20
20
|
ActiveSupport::TestCase.fixtures :all
|
21
21
|
end
|
22
|
+
|
23
|
+
class ActiveSupport::TestCase
|
24
|
+
include FactoryGirl::Syntax::Methods
|
25
|
+
end
|
26
|
+
|
27
|
+
ENGINE_RAILS_ROOT=File.join(File.dirname(__FILE__), '../')
|
28
|
+
Dir[File.join(ENGINE_RAILS_ROOT, "test/factories/**/*.rb")].each {|f| require f }
|
29
|
+
|
30
|
+
require 'minitest/unit'
|
31
|
+
require 'mocha/mini_test'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: caddie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zuger Cédric
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -50,6 +50,20 @@ dependencies:
|
|
50
50
|
- - ">="
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: 0.18.4
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: mocha
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
60
|
+
type: :runtime
|
61
|
+
prerelease: false
|
62
|
+
version_requirements: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
53
67
|
description: A rails engine that allow to download CREST market data (designed to
|
54
68
|
be plugged into a custom application)
|
55
69
|
email:
|
@@ -70,8 +84,6 @@ files:
|
|
70
84
|
- app/models/caddie/m_threaded_updater.rb
|
71
85
|
- app/models/caddie/update_table.sql
|
72
86
|
- app/models/crest_price_history.rb
|
73
|
-
- app/models/eve_item.rb
|
74
|
-
- app/models/region.rb
|
75
87
|
- app/views/layouts/caddie/application.html.erb
|
76
88
|
- config/routes.rb
|
77
89
|
- db/migrate/20160524122651_create_caddie_crest_price_history_updates.rb
|
@@ -79,10 +91,12 @@ files:
|
|
79
91
|
- db/migrate/20160707153021_create_caddie_crest_price_history_update_logs.rb
|
80
92
|
- db/migrate/20160710163612_add_total_inserts_to_crest_price_history_update_log.rb
|
81
93
|
- db/migrate/20160710163641_add_co_seconds_to_crest_price_history_update_log.rb
|
94
|
+
- db/migrate/20160725091214_add_indexes_to_crest_price_history_update.rb
|
82
95
|
- lib/caddie.rb
|
83
96
|
- lib/caddie/engine.rb
|
84
97
|
- lib/caddie/version.rb
|
85
98
|
- lib/tasks/caddie_tasks.rake
|
99
|
+
- lib/tasks/m_threaded_updater_test.rake
|
86
100
|
- test/caddie_test.rb
|
87
101
|
- test/dummy/README.rdoc
|
88
102
|
- test/dummy/Rakefile
|
@@ -90,6 +104,8 @@ files:
|
|
90
104
|
- test/dummy/app/assets/stylesheets/application.css
|
91
105
|
- test/dummy/app/controllers/application_controller.rb
|
92
106
|
- test/dummy/app/helpers/application_helper.rb
|
107
|
+
- test/dummy/app/models/eve_item.rb
|
108
|
+
- test/dummy/app/models/region.rb
|
93
109
|
- test/dummy/app/views/layouts/application.html.erb
|
94
110
|
- test/dummy/bin/bundle
|
95
111
|
- test/dummy/bin/rails
|
@@ -114,16 +130,28 @@ files:
|
|
114
130
|
- test/dummy/config/locales/en.yml
|
115
131
|
- test/dummy/config/routes.rb
|
116
132
|
- test/dummy/config/secrets.yml
|
133
|
+
- test/dummy/db/migrate/20150410082132_create_eve_items.rb
|
134
|
+
- test/dummy/db/migrate/20150414095303_add_name_lowcase_to_eve_item.rb
|
135
|
+
- test/dummy/db/migrate/20150416154256_rename_eve_item_id.rb
|
136
|
+
- test/dummy/db/migrate/20150417135716_add_cost_to_eve_item.rb
|
137
|
+
- test/dummy/db/migrate/20150906171550_add_cpp_market_group_id_to_eve_item.rb
|
138
|
+
- test/dummy/db/migrate/20150909162142_add_involved_in_blueprint_to_eve_item.rb
|
139
|
+
- test/dummy/db/migrate/20150910074544_create_regions.rb
|
140
|
+
- test/dummy/db/migrate/20150910080646_create_crest_price_histories.rb
|
117
141
|
- test/dummy/db/schema.rb
|
118
142
|
- test/dummy/log/development.log
|
143
|
+
- test/dummy/log/test.log
|
119
144
|
- test/dummy/public/404.html
|
120
145
|
- test/dummy/public/422.html
|
121
146
|
- test/dummy/public/500.html
|
122
147
|
- test/dummy/public/favicon.ico
|
123
|
-
- test/
|
148
|
+
- test/factories/caddie/crest_price_history_updates.rb
|
149
|
+
- test/factories/caddie/eve_items.rb
|
150
|
+
- test/factories/caddie/regions.rb
|
124
151
|
- test/integration/navigation_test.rb
|
125
152
|
- test/models/caddie/crest_price_history_update_log_test.rb
|
126
153
|
- test/models/caddie/crest_price_history_update_test.rb
|
154
|
+
- test/models/caddie/m_threaded_updater_test.rb
|
127
155
|
- test/test_helper.rb
|
128
156
|
homepage: https://github.com/czuger/caddie
|
129
157
|
licenses:
|
@@ -145,50 +173,64 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
145
173
|
version: '0'
|
146
174
|
requirements: []
|
147
175
|
rubyforge_project:
|
148
|
-
rubygems_version: 2.
|
176
|
+
rubygems_version: 2.4.8
|
149
177
|
signing_key:
|
150
178
|
specification_version: 4
|
151
179
|
summary: Crest mArket DownloaD engInE
|
152
180
|
test_files:
|
153
|
-
- test/models/caddie/crest_price_history_update_test.rb
|
154
|
-
- test/models/caddie/crest_price_history_update_log_test.rb
|
155
|
-
- test/caddie_test.rb
|
156
181
|
- test/integration/navigation_test.rb
|
157
|
-
- test/
|
182
|
+
- test/caddie_test.rb
|
183
|
+
- test/factories/caddie/eve_items.rb
|
184
|
+
- test/factories/caddie/regions.rb
|
185
|
+
- test/factories/caddie/crest_price_history_updates.rb
|
158
186
|
- test/test_helper.rb
|
187
|
+
- test/dummy/Rakefile
|
188
|
+
- test/dummy/README.rdoc
|
189
|
+
- test/dummy/public/500.html
|
190
|
+
- test/dummy/public/favicon.ico
|
191
|
+
- test/dummy/public/404.html
|
192
|
+
- test/dummy/public/422.html
|
193
|
+
- test/dummy/log/test.log
|
194
|
+
- test/dummy/log/development.log
|
195
|
+
- test/dummy/db/migrate/20150417135716_add_cost_to_eve_item.rb
|
196
|
+
- test/dummy/db/migrate/20150416154256_rename_eve_item_id.rb
|
197
|
+
- test/dummy/db/migrate/20150910080646_create_crest_price_histories.rb
|
198
|
+
- test/dummy/db/migrate/20150910074544_create_regions.rb
|
199
|
+
- test/dummy/db/migrate/20150906171550_add_cpp_market_group_id_to_eve_item.rb
|
200
|
+
- test/dummy/db/migrate/20150909162142_add_involved_in_blueprint_to_eve_item.rb
|
201
|
+
- test/dummy/db/migrate/20150414095303_add_name_lowcase_to_eve_item.rb
|
202
|
+
- test/dummy/db/migrate/20150410082132_create_eve_items.rb
|
159
203
|
- test/dummy/db/schema.rb
|
204
|
+
- test/dummy/config.ru
|
205
|
+
- test/dummy/config/database.yml
|
160
206
|
- test/dummy/config/routes.rb
|
161
|
-
- test/dummy/config/
|
207
|
+
- test/dummy/config/secrets.yml
|
162
208
|
- test/dummy/config/boot.rb
|
209
|
+
- test/dummy/config/environment.rb
|
163
210
|
- test/dummy/config/locales/en.yml
|
164
|
-
- test/dummy/config/secrets.yml
|
165
|
-
- test/dummy/config/initializers/cookies_serializer.rb
|
166
211
|
- test/dummy/config/initializers/mime_types.rb
|
167
|
-
- test/dummy/config/initializers/filter_parameter_logging.rb
|
168
|
-
- test/dummy/config/initializers/assets.rb
|
169
212
|
- test/dummy/config/initializers/wrap_parameters.rb
|
170
213
|
- test/dummy/config/initializers/session_store.rb
|
214
|
+
- test/dummy/config/initializers/assets.rb
|
171
215
|
- test/dummy/config/initializers/inflections.rb
|
216
|
+
- test/dummy/config/initializers/filter_parameter_logging.rb
|
217
|
+
- test/dummy/config/initializers/cookies_serializer.rb
|
172
218
|
- test/dummy/config/initializers/backtrace_silencers.rb
|
173
|
-
- test/dummy/config/application.rb
|
174
|
-
- test/dummy/config/database.yml
|
175
|
-
- test/dummy/config/environments/test.rb
|
176
|
-
- test/dummy/config/environments/development.rb
|
177
219
|
- test/dummy/config/environments/production.rb
|
178
|
-
- test/dummy/
|
220
|
+
- test/dummy/config/environments/development.rb
|
221
|
+
- test/dummy/config/environments/test.rb
|
222
|
+
- test/dummy/config/application.rb
|
179
223
|
- test/dummy/app/helpers/application_helper.rb
|
180
224
|
- test/dummy/app/views/layouts/application.html.erb
|
181
|
-
- test/dummy/app/
|
225
|
+
- test/dummy/app/models/region.rb
|
226
|
+
- test/dummy/app/models/eve_item.rb
|
227
|
+
- test/dummy/app/controllers/application_controller.rb
|
182
228
|
- test/dummy/app/assets/stylesheets/application.css
|
183
|
-
- test/dummy/
|
184
|
-
- test/dummy/public/favicon.ico
|
185
|
-
- test/dummy/public/404.html
|
186
|
-
- test/dummy/public/500.html
|
187
|
-
- test/dummy/README.rdoc
|
188
|
-
- test/dummy/log/development.log
|
189
|
-
- test/dummy/Rakefile
|
190
|
-
- test/dummy/config.ru
|
191
|
-
- test/dummy/bin/setup
|
229
|
+
- test/dummy/app/assets/javascripts/application.js
|
192
230
|
- test/dummy/bin/rake
|
193
231
|
- test/dummy/bin/bundle
|
194
232
|
- test/dummy/bin/rails
|
233
|
+
- test/dummy/bin/setup
|
234
|
+
- test/models/caddie/crest_price_history_update_log_test.rb
|
235
|
+
- test/models/caddie/crest_price_history_update_test.rb
|
236
|
+
- test/models/caddie/m_threaded_updater_test.rb
|
@@ -1 +0,0 @@
|
|
1
|
-
../../../eve_business_server/app/models/crest_price_history.rb
|
data/app/models/eve_item.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
../../../eve_business_server/app/models/eve_item.rb
|
data/app/models/region.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
../../../eve_business_server/app/models/region.rb
|