ar_aggregate_by_interval 1.1.5 → 1.1.6
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/.gitignore +1 -0
- data/CHANGELOG.md +7 -0
- data/README.md +20 -4
- data/ar_aggregate_by_interval.gemspec +3 -1
- data/helpers.rb +40 -0
- data/lib/ar_aggregate_by_interval/utils.rb +3 -4
- data/lib/ar_aggregate_by_interval/version.rb +1 -1
- data/spec/ar_bootstrap/database.yml +15 -0
- data/spec/ar_bootstrap/init.rb +23 -2
- data/spec/lib/ar_aggregate_by_interval_spec.rb +116 -101
- data/spec/spec_helper.rb +1 -14
- metadata +41 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60d194e4f1346228225b37d2c176e1699da97d01
|
4
|
+
data.tar.gz: 82aead17f908b020f50909b1589cc9a500233dfa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 123c5a51bb2c75d8a60628b20d46dae8b28e3c0b52ef62ae504cf3c4038a6f600ebe98c79ad337fcd0799e83b8e066c346148e75bb2c5ef64272720a6f9f523f
|
7
|
+
data.tar.gz: 13c5c11f9575481558e9d97e0dabbf320a45ed44efa43e512b68f899257b96efc3a7166ac5aa54b3ef8789aaa5e7eba79ed6793314bc84a6b32b32347bad46bd
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,13 @@ All notable changes to this project will be documented in this file.
|
|
3
3
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
4
4
|
This file adheres to [Keep a changelog](http://keepachangelog.com/).
|
5
5
|
|
6
|
+
## [1.1.6] - 2015-03-15 (maintenance)
|
7
|
+
### Added
|
8
|
+
- Tests run on MySQL, Postgres and SQLite
|
9
|
+
|
10
|
+
### Changed
|
11
|
+
- Remove memoization from Utils
|
12
|
+
|
6
13
|
## [1.1.5] - 2015-03-08 (maintenance)
|
7
14
|
### Changed
|
8
15
|
- Raise ArgumentError instead of NoMethodError or RuntimeError on bad args
|
data/README.md
CHANGED
@@ -1,13 +1,23 @@
|
|
1
|
-
# ArAggregateByInterval
|
1
|
+
# ArAggregateByInterval (Time series)
|
2
2
|
---
|
3
3
|
|
4
4
|
[](https://circleci.com/gh/jotto/ar_aggregate_by_interval)
|
5
5
|
|
6
|
+
For MySQL or Postgres.
|
7
|
+
|
6
8
|
Build arrays of counts, sums and averages from Ruby on Rails ActiveRecord models grouped by days, weeks or months. e.g.:
|
7
9
|
```ruby
|
8
|
-
#
|
9
|
-
Blog.count_weekly(1.month.ago).values
|
10
|
+
# (group_by_col, from, to = Time.now)
|
11
|
+
Blog.count_weekly(:created_at, 1.month.ago).values
|
10
12
|
=> [4, 2, 2, 0]
|
13
|
+
|
14
|
+
# (group_by_col, aggregate_col, from, to = Time.now)
|
15
|
+
Blog.sum_weekly(:created_at, :pageviews, 1.month.ago).values
|
16
|
+
=> [400, 350, 375, 250]
|
17
|
+
|
18
|
+
# (group_by_col, aggregate_col, from, to = Time.now)
|
19
|
+
Blog.avg_weekly(:created_at, :pageviews, 1.month.ago).values
|
20
|
+
=> [25, 20, 40, 10]
|
11
21
|
```
|
12
22
|
|
13
23
|
## Why?
|
@@ -16,7 +26,13 @@ Blog.count_weekly(1.month.ago).values
|
|
16
26
|
|
17
27
|
## Usage
|
18
28
|
```ruby
|
19
|
-
|
29
|
+
# be explicit and pass a hash
|
30
|
+
# [:group_by_column, :from, :to, :aggregate_column]
|
31
|
+
|
32
|
+
# or just pass arguments
|
33
|
+
# count: arg_hash can be arguments: (group_by_col, from, to)
|
34
|
+
# sum and avg: arg_hash can be arguments: (group_by_col, aggregate_col, from, to)
|
35
|
+
Blog.{count,sum,avg}_{daily,weekly,monthly}(arg_hash).{values,values_and_dates}
|
20
36
|
```
|
21
37
|
|
22
38
|
```ruby
|
@@ -19,9 +19,11 @@ Gem::Specification.new do |s|
|
|
19
19
|
|
20
20
|
s.add_development_dependency 'bundler', '~> 1.5'
|
21
21
|
s.add_development_dependency 'rake'
|
22
|
-
s.add_development_dependency 'database_cleaner', '~> 1.4'
|
23
22
|
s.add_development_dependency 'guard-rspec', '~> 4.5'
|
23
|
+
s.add_development_dependency 'mysql2'
|
24
|
+
s.add_development_dependency 'pg'
|
24
25
|
s.add_development_dependency 'sqlite3'
|
26
|
+
s.add_development_dependency 'rails', '~> 4.2' # for database tasks
|
25
27
|
s.add_dependency 'activesupport', '~> 4.0'
|
26
28
|
s.add_dependency 'activerecord', '~> 4.0'
|
27
29
|
s.add_dependency 'classy_hash', '~> 0.1'
|
data/helpers.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
ActiveRecord::Base.establish_connection adapter: 'mysql2', database: 'stocks'
|
2
|
+
class Quote < ActiveRecord::Base
|
3
|
+
end
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
ActiveRecord::Base.establish_connection adapter: 'postgresql', database: 'traianbasecu'
|
8
|
+
class Click < ActiveRecord::Base
|
9
|
+
end
|
10
|
+
r=Click.count_daily(:created_at, 3.month.ago).values_and_dates.collect{|z|z[:date]}
|
11
|
+
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
r=Click.count_weekly(:created_at, 3.month.ago).instance_variable_get('@wut').to_a.first.attributes
|
18
|
+
|
19
|
+
|
20
|
+
ArAggregateByInterval::Utils.ar_to_hash(Click.count_daily(:created_at, 3.month.ago).instance_variable_get('@wut'), {'datechunk__' => 'totalchunked__'})
|
21
|
+
ArAggregateByInterval::Utils.ar_to_hash(Click.count_weekly(:created_at, 3.month.ago).instance_variable_get('@wut'), {'datechunk__' => 'totalchunked__'})
|
22
|
+
|
23
|
+
|
24
|
+
Bundler.require
|
25
|
+
require 'rails'
|
26
|
+
ActiveRecord::Base.configurations = YAML.load_file('./config/database.yml')
|
27
|
+
|
28
|
+
ActiveRecord::Tasks::DatabaseTasks.send(:each_local_configuration) do |config|
|
29
|
+
begin
|
30
|
+
ActiveRecord::Tasks::DatabaseTasks.send(:drop, config)
|
31
|
+
rescue
|
32
|
+
end
|
33
|
+
begin
|
34
|
+
ActiveRecord::Tasks::DatabaseTasks.send(:create, config)
|
35
|
+
rescue
|
36
|
+
end
|
37
|
+
|
38
|
+
ActiveRecord::Base.establish_connection config
|
39
|
+
load './spec/ar_bootstrap/schema.rb'
|
40
|
+
end
|
@@ -48,7 +48,7 @@ module ArAggregateByInterval
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def ruby_strftime_map
|
51
|
-
|
51
|
+
{
|
52
52
|
'monthly' => '%Y-%m',
|
53
53
|
# sqlite doesn't support ISO weeks
|
54
54
|
'weekly' => Utils.db_vendor.match(/sqlite/i) ? '%Y-%U' : '%G-%V',
|
@@ -82,9 +82,8 @@ module ArAggregateByInterval
|
|
82
82
|
end
|
83
83
|
|
84
84
|
def db_vendor
|
85
|
-
|
86
|
-
|
87
|
-
ENV['DATABASE_URL']
|
85
|
+
ActiveRecord::Base.connection_config.try(:symbolize_keys).try(:[], :adapter) ||
|
86
|
+
ENV['DATABASE_URL']
|
88
87
|
end
|
89
88
|
|
90
89
|
# converts args like: [weekly, beginning] to beginning_of_week
|
@@ -0,0 +1,15 @@
|
|
1
|
+
mysql:
|
2
|
+
adapter: mysql2
|
3
|
+
encoding: utf8
|
4
|
+
database: 'ar_aggregate_by_interval_test'
|
5
|
+
pool: 1
|
6
|
+
postgresql:
|
7
|
+
adapter: postgresql
|
8
|
+
encoding: utf8
|
9
|
+
database: 'ar_aggregate_by_interval_test'
|
10
|
+
pool: 1
|
11
|
+
sqlite3:
|
12
|
+
adapter: sqlite3
|
13
|
+
encoding: utf8
|
14
|
+
database: './db/ar_aggregate_by_interval_test.sqlite3'
|
15
|
+
pool: 1
|
data/spec/ar_bootstrap/init.rb
CHANGED
@@ -1,8 +1,29 @@
|
|
1
|
+
PROJECT_ROOT = File.expand_path File.join(File.dirname(__FILE__), '../..')
|
2
|
+
|
1
3
|
require 'active_record'
|
2
4
|
|
3
|
-
|
5
|
+
# rails is needed for ActiveRecord::Tasks::DatabaseTasks
|
6
|
+
require 'rails'
|
7
|
+
|
8
|
+
# Rails.root is needed for ActiveRecord::Tasks::DatabaseTasks
|
9
|
+
def Rails.root
|
10
|
+
PROJECT_ROOT
|
11
|
+
end
|
4
12
|
|
5
|
-
load
|
13
|
+
# load database.yml
|
14
|
+
ActiveRecord::Base.configurations = YAML.load_file(File.join(PROJECT_ROOT, 'spec/ar_bootstrap/database.yml'))
|
15
|
+
# drop all DBs
|
16
|
+
ActiveRecord::Tasks::DatabaseTasks.drop_all
|
17
|
+
|
18
|
+
# iterate through each connection in database.yml
|
19
|
+
ActiveRecord::Tasks::DatabaseTasks.send(:each_local_configuration) do |config|
|
20
|
+
# create DB
|
21
|
+
ActiveRecord::Tasks::DatabaseTasks.send(:create, config)
|
22
|
+
# connect to it
|
23
|
+
ActiveRecord::Base.establish_connection config
|
24
|
+
# load schema into it
|
25
|
+
load File.join(PROJECT_ROOT, 'spec/ar_bootstrap/schema.rb')
|
26
|
+
end
|
6
27
|
|
7
28
|
class Blog < ActiveRecord::Base
|
8
29
|
has_many :page_views
|
@@ -2,150 +2,165 @@ require 'ar_aggregate_by_interval'
|
|
2
2
|
|
3
3
|
describe ArAggregateByInterval do
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
@to = @from
|
8
|
-
blog1 = Blog.create arbitrary_number: 10, created_at: @from
|
9
|
-
blog2 = Blog.create arbitrary_number: 20, created_at: @from
|
10
|
-
blog1.page_views.create date: @from
|
11
|
-
blog1.page_views.create date: @from
|
5
|
+
after(:all) do
|
6
|
+
ActiveRecord::Tasks::DatabaseTasks.drop_all
|
12
7
|
end
|
13
8
|
|
14
|
-
shared_examples_for '
|
15
|
-
it 'returns value and date with expected values' do
|
16
|
-
expect(subject.values_and_dates).to eq([date: @from.beginning_of_week.to_date, value: 2])
|
17
|
-
end
|
18
|
-
end
|
9
|
+
shared_examples_for 'working gem' do |db_config|
|
19
10
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
end
|
24
|
-
end
|
11
|
+
before(:all) do |example|
|
12
|
+
# connect to DB specified by db_config (a symbol matching database.yml keys)
|
13
|
+
ActiveRecord::Base.establish_connection db_config
|
25
14
|
|
26
|
-
|
27
|
-
|
28
|
-
|
15
|
+
@from = DateTime.parse '2013-08-05'
|
16
|
+
@to = @from
|
17
|
+
blog1 = Blog.create! arbitrary_number: 10, created_at: @from
|
18
|
+
blog2 = Blog.create! arbitrary_number: 20, created_at: @from
|
19
|
+
blog1.page_views.create! date: @from
|
20
|
+
blog1.page_views.create! date: @from
|
29
21
|
end
|
30
|
-
end
|
31
22
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
23
|
+
shared_examples_for 'count .values_and_dates' do
|
24
|
+
it "returns value and date with expected values on #{db_config}" do
|
25
|
+
expect(subject.values_and_dates).to eq([date: @from.beginning_of_week.to_date, value: 2])
|
26
|
+
end
|
36
27
|
end
|
37
|
-
it_behaves_like 'count .values_and_dates'
|
38
|
-
end
|
39
28
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
29
|
+
shared_examples_for 'sum .values_and_dates' do
|
30
|
+
it "returns value and date with expected values on #{db_config}" do
|
31
|
+
expect(subject.values_and_dates).to eq([date: @from.beginning_of_week.to_date, value: 30])
|
32
|
+
end
|
44
33
|
end
|
45
|
-
it_behaves_like 'count .values_and_dates'
|
46
|
-
end
|
47
34
|
|
48
|
-
|
35
|
+
shared_examples_for 'avg .values_and_dates' do
|
36
|
+
it "returns value and date with expected values on #{db_config}" do
|
37
|
+
expect(subject.values_and_dates).to eq([date: @from.beginning_of_week.to_date, value: 15])
|
38
|
+
end
|
39
|
+
end
|
49
40
|
|
50
|
-
context '
|
41
|
+
context 'ActiveRecord::Relation scoped' do
|
51
42
|
subject do
|
52
|
-
|
53
|
-
|
54
|
-
from: @from,
|
55
|
-
to: @to
|
56
|
-
})
|
43
|
+
# `where` returns ActiveRecord::Relation
|
44
|
+
Blog.where('id > 0').count_weekly(:created_at, @from, @from)
|
57
45
|
end
|
58
46
|
it_behaves_like 'count .values_and_dates'
|
59
47
|
end
|
60
48
|
|
61
|
-
context '
|
49
|
+
context 'Array scoped' do
|
62
50
|
subject do
|
63
|
-
|
64
|
-
|
65
|
-
aggregate_column: :arbitrary_number,
|
66
|
-
from: @from,
|
67
|
-
to: @to
|
68
|
-
})
|
51
|
+
# `associations` return arrays
|
52
|
+
Blog.first.page_views.count_weekly(:date, @from, @from)
|
69
53
|
end
|
70
|
-
it_behaves_like '
|
54
|
+
it_behaves_like 'count .values_and_dates'
|
55
|
+
end
|
56
|
+
|
57
|
+
context 'hash args' do
|
71
58
|
|
72
|
-
context '
|
59
|
+
context 'for count' do
|
60
|
+
subject do
|
61
|
+
Blog.count_weekly({
|
62
|
+
group_by_column: :created_at,
|
63
|
+
from: @from,
|
64
|
+
to: @to
|
65
|
+
})
|
66
|
+
end
|
67
|
+
it_behaves_like 'count .values_and_dates'
|
68
|
+
end
|
69
|
+
|
70
|
+
context 'for sum' do
|
73
71
|
subject do
|
74
72
|
Blog.sum_weekly({
|
75
|
-
group_by_column:
|
76
|
-
aggregate_column:
|
73
|
+
group_by_column: :created_at,
|
74
|
+
aggregate_column: :arbitrary_number,
|
77
75
|
from: @from,
|
78
76
|
to: @to
|
79
77
|
})
|
80
78
|
end
|
81
79
|
it_behaves_like 'sum .values_and_dates'
|
82
|
-
end
|
83
|
-
end
|
84
80
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
81
|
+
context 'with strings' do
|
82
|
+
subject do
|
83
|
+
Blog.sum_weekly({
|
84
|
+
group_by_column: 'created_at',
|
85
|
+
aggregate_column: 'arbitrary_number',
|
86
|
+
from: @from,
|
87
|
+
to: @to
|
88
|
+
})
|
89
|
+
end
|
90
|
+
it_behaves_like 'sum .values_and_dates'
|
91
|
+
end
|
93
92
|
end
|
94
|
-
it_behaves_like 'avg .values_and_dates'
|
95
|
-
end
|
96
|
-
|
97
|
-
end
|
98
93
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
94
|
+
context 'for avg' do
|
95
|
+
subject do
|
96
|
+
Blog.avg_weekly({
|
97
|
+
group_by_column: :created_at,
|
98
|
+
aggregate_column: :arbitrary_number,
|
99
|
+
from: @from,
|
100
|
+
to: @to
|
101
|
+
})
|
102
|
+
end
|
103
|
+
it_behaves_like 'avg .values_and_dates'
|
103
104
|
end
|
104
|
-
|
105
|
+
|
105
106
|
end
|
106
|
-
context 'for sum' do
|
107
|
-
subject do
|
108
|
-
Blog.sum_weekly(:created_at, :arbitrary_number, @from, @from)
|
109
|
-
end
|
110
|
-
it_behaves_like 'sum .values_and_dates'
|
111
107
|
|
112
|
-
|
108
|
+
context 'normal args' do
|
109
|
+
context 'for count' do
|
113
110
|
subject do
|
114
|
-
Blog.
|
111
|
+
Blog.count_weekly(:created_at, @from, @from)
|
115
112
|
end
|
116
|
-
it_behaves_like '
|
113
|
+
it_behaves_like 'count .values_and_dates'
|
117
114
|
end
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
it_behaves_like 'avg .values_and_dates'
|
124
|
-
end
|
125
|
-
end
|
115
|
+
context 'for sum' do
|
116
|
+
subject do
|
117
|
+
Blog.sum_weekly(:created_at, :arbitrary_number, @from, @from)
|
118
|
+
end
|
119
|
+
it_behaves_like 'sum .values_and_dates'
|
126
120
|
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
121
|
+
context 'with strings' do
|
122
|
+
subject do
|
123
|
+
Blog.sum_weekly('created_at', 'arbitrary_number', @from, @from)
|
124
|
+
end
|
125
|
+
it_behaves_like 'sum .values_and_dates'
|
126
|
+
end
|
131
127
|
end
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
end
|
128
|
+
context 'for avg' do
|
129
|
+
subject do
|
130
|
+
Blog.avg_weekly(:created_at, :arbitrary_number, @from, @from)
|
131
|
+
end
|
132
|
+
it_behaves_like 'avg .values_and_dates'
|
136
133
|
end
|
137
134
|
end
|
138
135
|
|
139
|
-
context '
|
140
|
-
|
141
|
-
|
136
|
+
context 'bad args' do
|
137
|
+
context 'for count' do
|
138
|
+
subject do
|
139
|
+
Blog.count_weekly(:created_at, {}, {})
|
140
|
+
end
|
141
|
+
it 'raise ArgumentError' do
|
142
|
+
expect do
|
143
|
+
subject
|
144
|
+
end.to raise_error(ArgumentError)
|
145
|
+
end
|
142
146
|
end
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
+
|
148
|
+
context 'for sum' do
|
149
|
+
subject do
|
150
|
+
Blog.sum_weekly(:created_at, @from, @from)
|
151
|
+
end
|
152
|
+
it 'raise ArgumentError' do
|
153
|
+
expect do
|
154
|
+
subject
|
155
|
+
end.to raise_error(ArgumentError, /aggregate_column/)
|
156
|
+
end
|
147
157
|
end
|
148
158
|
end
|
159
|
+
|
149
160
|
end
|
150
161
|
|
162
|
+
it_behaves_like 'working gem', :mysql
|
163
|
+
it_behaves_like 'working gem', :postgresql
|
164
|
+
it_behaves_like 'working gem', :sqlite3
|
165
|
+
|
151
166
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'database_cleaner'
|
2
|
-
|
3
1
|
# This file was generated by the `rspec --init` command. Conventionally, all
|
4
2
|
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
5
3
|
# The generated `.rspec` file contains `--require spec_helper` which will cause this
|
@@ -18,17 +16,6 @@ require 'database_cleaner'
|
|
18
16
|
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
19
17
|
RSpec.configure do |config|
|
20
18
|
|
21
|
-
config.before(:suite) do
|
22
|
-
DatabaseCleaner.strategy = :transaction
|
23
|
-
# DatabaseCleaner.clean_with(:truncation)
|
24
|
-
end
|
25
|
-
|
26
|
-
config.around(:each) do |example|
|
27
|
-
DatabaseCleaner.cleaning do
|
28
|
-
example.run
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
19
|
# rspec-expectations config goes here. You can use an alternate
|
33
20
|
# assertion/expectation library such as wrong or the stdlib/minitest
|
34
21
|
# assertions if you prefer.
|
@@ -102,4 +89,4 @@ RSpec.configure do |config|
|
|
102
89
|
=end
|
103
90
|
end
|
104
91
|
|
105
|
-
require 'ar_bootstrap/init'
|
92
|
+
require 'ar_bootstrap/init'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ar_aggregate_by_interval
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Otto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -39,33 +39,47 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: guard-rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '4.5'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '4.5'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: mysql2
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pg
|
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'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: sqlite3
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,6 +94,20 @@ dependencies:
|
|
80
94
|
- - ">="
|
81
95
|
- !ruby/object:Gem::Version
|
82
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rails
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '4.2'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '4.2'
|
83
111
|
- !ruby/object:Gem::Dependency
|
84
112
|
name: activesupport
|
85
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -154,11 +182,13 @@ files:
|
|
154
182
|
- Rakefile
|
155
183
|
- ar_aggregate_by_interval.gemspec
|
156
184
|
- circle.yml
|
185
|
+
- helpers.rb
|
157
186
|
- lib/ar_aggregate_by_interval.rb
|
158
187
|
- lib/ar_aggregate_by_interval/query_result.rb
|
159
188
|
- lib/ar_aggregate_by_interval/query_runner.rb
|
160
189
|
- lib/ar_aggregate_by_interval/utils.rb
|
161
190
|
- lib/ar_aggregate_by_interval/version.rb
|
191
|
+
- spec/ar_bootstrap/database.yml
|
162
192
|
- spec/ar_bootstrap/init.rb
|
163
193
|
- spec/ar_bootstrap/schema.rb
|
164
194
|
- spec/lib/ar_aggregate_by_interval/utils_spec.rb
|
@@ -188,6 +218,7 @@ signing_key:
|
|
188
218
|
specification_version: 4
|
189
219
|
summary: add [sum|count]_[daily|weekly|monthly] to your AR models for MySQL AND Postgres
|
190
220
|
test_files:
|
221
|
+
- spec/ar_bootstrap/database.yml
|
191
222
|
- spec/ar_bootstrap/init.rb
|
192
223
|
- spec/ar_bootstrap/schema.rb
|
193
224
|
- spec/lib/ar_aggregate_by_interval/utils_spec.rb
|