active_median 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c745189711eba49f050c97e7248da0f6a9b2ea4f
4
- data.tar.gz: e85bcea23ebc2c71c73f2ee4b2eef25f360d2e48
3
+ metadata.gz: b551770177ca1b626f794e53a6076dcd2fd80f09
4
+ data.tar.gz: 94f4f4e96beaefbadba494726b7809a5ff65e649
5
5
  SHA512:
6
- metadata.gz: dc818f5388d8b43ad4f73c5a0fc4f99090960f38029b842ab1b63fe34c7eeb63019f0effbc157cb93c900e4e9918939bae0b9a6e999b2dcc8927d81ffe954394
7
- data.tar.gz: 2a80eec59464b05351a371dc07c6eb03c17baac3e6bd1358a9568cc6680677b4daa06a78ab8bc0c264d499df5bd07d84d2f2045e5cc35c72b578a6e5d95ec700
6
+ metadata.gz: d8a51b06f6d07222bda15aeac042384bbf04d94cf1810f2bb85e32404c76b21b417912272653369c0a393d38b107eaa18ecec83418762f5b498303130511ba72
7
+ data.tar.gz: 78a344daee6bc290764695fa6a7b6504aec0f6392d2788dcb3767b28e5f61c3b6d5499782719e0c236db2435f6c6315c9831e49a18c7d8ca5ded9af5333455a0
@@ -0,0 +1,22 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.3.0
4
+ sudo: false
5
+ script: bundle exec rake test
6
+ before_script:
7
+ - gem install bundler
8
+ - psql -c 'create database active_median_test;' -U postgres
9
+ notifications:
10
+ email:
11
+ on_success: never
12
+ on_failure: change
13
+ gemfile:
14
+ - Gemfile
15
+ - test/gemfiles/activerecord50.gemfile
16
+ - test/gemfiles/activerecord41.gemfile
17
+ - test/gemfiles/activerecord40.gemfile
18
+ - test/gemfiles/activerecord32.gemfile
19
+ matrix:
20
+ allow_failures:
21
+ - gemfile: test/gemfiles/activerecord50.gemfile
22
+ - gemfile: test/gemfiles/activerecord32.gemfile
@@ -1,3 +1,7 @@
1
+ ## 0.1.3
2
+
3
+ - Added support for ActiveRecord 5.0
4
+
1
5
  ## 0.1.2
2
6
 
3
7
  - Added support for ActiveRecord 4.2
data/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  Median for ActiveRecord - PostgreSQL only at the moment
4
4
 
5
+ [![Build Status](https://travis-ci.org/ankane/active_median.svg)](https://travis-ci.org/ankane/active_median)
6
+
5
7
  ```ruby
6
8
  Item.median(:price)
7
9
  ```
@@ -17,7 +19,7 @@ Order.group("date_trunc('week', created_at)").median(:total)
17
19
  Add this line to your application’s Gemfile:
18
20
 
19
21
  ```ruby
20
- gem "active_median"
22
+ gem 'active_median'
21
23
  ```
22
24
 
23
25
  And add the `median` function to the database from the Rails console.
@@ -28,8 +30,9 @@ ActiveMedian.create_function
28
30
 
29
31
  ## Contributing
30
32
 
31
- 1. Fork it
32
- 2. Create your feature branch (`git checkout -b my-new-feature`)
33
- 3. Commit your changes (`git commit -am 'Add some feature'`)
34
- 4. Push to the branch (`git push origin my-new-feature`)
35
- 5. Create new Pull Request
33
+ Everyone is encouraged to help improve this project. Here are a few ways you can help:
34
+
35
+ - [Report bugs](https://github.com/ankane/active_median/issues)
36
+ - Fix bugs and [submit pull requests](https://github.com/ankane/active_median/pulls)
37
+ - Write, clarify, or fix documentation
38
+ - Suggest or add new features
@@ -22,5 +22,6 @@ Gem::Specification.new do |spec|
22
22
 
23
23
  spec.add_development_dependency "bundler", "~> 1.3"
24
24
  spec.add_development_dependency "rake"
25
+ spec.add_development_dependency "minitest"
25
26
  spec.add_development_dependency "pg"
26
27
  end
@@ -46,8 +46,8 @@ end
46
46
 
47
47
  module ActiveRecord
48
48
  module Calculations
49
- def median(column_name, options = {})
50
- calculate(:median, column_name, options)
49
+ def median(*args)
50
+ calculate(:median, *args)
51
51
  end
52
52
  end
53
53
  end
@@ -1,3 +1,3 @@
1
1
  module ActiveMedian
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -1,4 +1,4 @@
1
- require "test_helper"
1
+ require_relative "test_helper"
2
2
 
3
3
  class TestActiveMedian < Minitest::Test
4
4
 
@@ -8,12 +8,12 @@ class TestActiveMedian < Minitest::Test
8
8
  end
9
9
 
10
10
  def test_even
11
- 6.times {|n| User.create!(visits_count: n) }
11
+ [1, 1, 2, 3, 4, 100].each {|n| User.create!(visits_count: n) }
12
12
  assert_equal 2.5, User.median(:visits_count)
13
13
  end
14
14
 
15
15
  def test_odd
16
- 5.times {|n| User.create!(visits_count: n) }
16
+ [1, 1, 2, 4, 100].each {|n| User.create!(visits_count: n) }
17
17
  assert_equal 2, User.median(:visits_count)
18
18
  end
19
19
 
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in active_median.gemspec
4
+ gemspec path: "../../"
5
+
6
+ gem "activerecord", "~> 3.2.0"
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in active_median.gemspec
4
+ gemspec path: "../../"
5
+
6
+ gem "activerecord", "~> 4.0.0"
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in active_median.gemspec
4
+ gemspec path: "../../"
5
+
6
+ gem "activerecord", "~> 4.1.0"
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in active_median.gemspec
4
+ gemspec path: "../../"
5
+
6
+ gem "activerecord", "~> 5.0.0.beta3"
@@ -2,11 +2,14 @@ require "bundler/setup"
2
2
  Bundler.require :default
3
3
  require "minitest/autorun"
4
4
  require "minitest/pride"
5
+ require "logger"
5
6
 
6
7
  Minitest::Test = Minitest::Unit::TestCase unless defined?(Minitest::Test)
7
8
 
8
9
  ActiveRecord::Base.establish_connection adapter: "postgresql", database: "active_median_test"
9
10
 
11
+ # ActiveRecord::Base.logger = Logger.new(STDOUT)
12
+
10
13
  ActiveRecord::Migration.create_table :users, force: true do |t|
11
14
  t.integer :visits_count
12
15
  t.decimal :latitude
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_median
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-27 00:00:00.000000000 Z
11
+ date: 2016-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: minitest
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'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: pg
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -74,18 +88,20 @@ extensions: []
74
88
  extra_rdoc_files: []
75
89
  files:
76
90
  - ".gitignore"
91
+ - ".travis.yml"
77
92
  - CHANGELOG.md
78
93
  - Gemfile
79
94
  - LICENSE.txt
80
95
  - README.md
81
96
  - Rakefile
82
97
  - active_median.gemspec
83
- - gemfiles/activerecord32.gemfile
84
- - gemfiles/activerecord40.gemfile
85
- - gemfiles/activerecord41.gemfile
86
98
  - lib/active_median.rb
87
99
  - lib/active_median/version.rb
88
100
  - test/active_median_test.rb
101
+ - test/gemfiles/activerecord32.gemfile
102
+ - test/gemfiles/activerecord40.gemfile
103
+ - test/gemfiles/activerecord41.gemfile
104
+ - test/gemfiles/activerecord50.gemfile
89
105
  - test/test_helper.rb
90
106
  homepage: https://github.com/ankane/active_median
91
107
  licenses:
@@ -107,10 +123,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
123
  version: '0'
108
124
  requirements: []
109
125
  rubyforge_project:
110
- rubygems_version: 2.2.2
126
+ rubygems_version: 2.6.1
111
127
  signing_key:
112
128
  specification_version: 4
113
129
  summary: Median for ActiveRecord
114
130
  test_files:
115
131
  - test/active_median_test.rb
132
+ - test/gemfiles/activerecord32.gemfile
133
+ - test/gemfiles/activerecord40.gemfile
134
+ - test/gemfiles/activerecord41.gemfile
135
+ - test/gemfiles/activerecord50.gemfile
116
136
  - test/test_helper.rb
137
+ has_rdoc:
@@ -1,6 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in searchkick.gemspec
4
- gemspec path: "../"
5
-
6
- gem "activerecord", "~> 3.2.0"
@@ -1,6 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in searchkick.gemspec
4
- gemspec path: "../"
5
-
6
- gem "activerecord", "~> 4.0.0"
@@ -1,6 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in searchkick.gemspec
4
- gemspec path: "../"
5
-
6
- gem "activerecord", "~> 4.1.0"