mincer 0.0.1 → 0.1.0

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: 8e653063bab2730285042586172b1542c9049bb3
4
- data.tar.gz: ca4b849d4f77baa0bda11828ac41cc24fae54569
3
+ metadata.gz: 48b963be79455d1a78fb2ba3ba717e7797a1c68b
4
+ data.tar.gz: 38811ae437f8dd4e35d338e7abcd1a50988df393
5
5
  SHA512:
6
- metadata.gz: f08dfbf9d5b4a37b0232421a2265fa6759e837827847ed3ab9aa552dc902d695a5c9a2ea98aae97c01a3719d557ac33e3489f03c40cbc244b61cdce03c53c376
7
- data.tar.gz: c144b4b21d23414def052b9b904187246d3d134d13ce0242f2507ff6a581eac2a8a97a34422f03cff4b5b122bc53e569b999d4ac1f47f35dcfa03733fdd2b0f2
6
+ metadata.gz: 9eaae3dda688bbb12f58fd56ce8850e5570354e8ed232bcff89614617c97dd73cd46018322559ddc5288c51a5e52425d7b5f3492deb89ac8898249a7b1fb995b
7
+ data.tar.gz: fd7512ad6cc69e82410e525a517db83657050f6f40bdb0bc0741e97b507239e68ce2918622ded82012f7a74a0c5503f51c5c7177ee67f3fc4fa7bac0eceb1002
data/.travis.yml ADDED
@@ -0,0 +1,16 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ - 1.9.3
5
+ - ruby-head
6
+
7
+ before_script:
8
+ - psql -c 'create database mincer;' -U postgres
9
+ - psql -d mincer -c 'CREATE EXTENSION IF NOT EXISTS pgcrypto;' -U postgres
10
+
11
+ addons:
12
+ postgresql: "9.3"
13
+ code_climate:
14
+ repo_token: c4c8988b92d1a65f4a986d81a870b80fccb91f7c65d685fd21d914edfc85a949
15
+
16
+ script: bundle exec rspec spec
data/Gemfile CHANGED
@@ -2,3 +2,8 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in mincer.gemspec
4
4
  gemspec
5
+
6
+ group :test do
7
+ gem 'codeclimate-test-reporter', require: nil
8
+ gem 'simplecov'
9
+ end
data/README.md CHANGED
@@ -1,4 +1,7 @@
1
1
  # Mincer
2
+ [![Build Status](https://travis-ci.org/spilin/mincer.png)](https://travis-ci.org/spilin/mincer)
3
+ [![Code Climate](https://codeclimate.com/repos/52b775836956801ba7000bdb/badges/ec5d5862e4b89d10695c/gpa.png)](https://codeclimate.com/repos/52b775836956801ba7000bdb/feed)
4
+ [![Gem Version](https://badge.fury.io/rb/mincer.png)](http://badge.fury.io/rb/mincer)
2
5
 
3
6
  TODO: Write a gem description
4
7
 
@@ -13,7 +13,7 @@ module Mincer
13
13
  end
14
14
 
15
15
  def sort_attr
16
- (@mincer.allowed_sort_attributes.include?(@args['sort']) && @args['sort']) || @mincer.default_sort_attribute
16
+ (@mincer.allowed_sort_attributes.include?(@args['sort']) && @args['sort']) || @mincer.send(:default_sort_attribute)
17
17
  end
18
18
 
19
19
  def order_attr
@@ -1,7 +1,7 @@
1
1
  module Mincer
2
2
 
3
3
  def self.version
4
- Gem::Version.new '0.0.1'
4
+ Gem::Version.new '0.1.0'
5
5
  end
6
6
 
7
7
  module VERSION #:nodoc:
data/mincer.gemspec CHANGED
@@ -22,12 +22,10 @@ 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 'rspec'
26
- spec.add_development_dependency 'guard-rspec'
25
+ spec.add_development_dependency 'rspec', '~> 2.14.1'
27
26
  spec.add_development_dependency 'pg'
28
27
  spec.add_development_dependency 'sqlite3'
29
28
  spec.add_development_dependency 'kaminari'
30
29
  spec.add_development_dependency 'will_paginate'
31
30
  spec.add_development_dependency 'textacular'
32
- spec.add_development_dependency 'simplecov'
33
31
  end
@@ -3,10 +3,7 @@ require 'spec_helper'
3
3
  describe ::Mincer::Processors::CacheDigest do
4
4
  context 'when postgres used' do
5
5
  before do
6
- config = YAML.load_file File.expand_path(File.dirname(__FILE__) + '../../../database.yml')
7
- ActiveRecord::Base.establish_connection config.merge(:adapter => :postgresql)
8
- ActiveRecord::Base.connection.execute('DROP TABLE IF EXISTS active_record_models')
9
- ActiveRecord::Base.connection.execute('CREATE TABLE IF NOT EXISTS active_record_models (id SERIAL PRIMARY KEY, text TEXT)')
6
+ setup_basic_postgres_table
10
7
  class ActiveRecordModel < ActiveRecord::Base
11
8
  end
12
9
  ActiveRecordModel.create!(text: 'Test1')
@@ -2,8 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe ::Mincer::Processors::Paginate do
4
4
  before do
5
- ActiveRecord::Base.establish_connection(:adapter => 'sqlite3', :database => ':memory:')
6
- ActiveRecord::Base.connection.execute('CREATE TABLE active_record_models (id INTEGER UNIQUE, text STRING)')
5
+ setup_basic_sqlite3_table
7
6
  class ActiveRecordModel < ActiveRecord::Base
8
7
  end
9
8
  30.times { |i| ActiveRecordModel.create(text: i) }
@@ -1,12 +1,9 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe ::Mincer::Processors::PgJsonDumper do
4
- context 'when postgres is NOT used' do
4
+ context 'when postgres is used' do
5
5
  before do
6
- config = YAML.load_file File.expand_path(File.dirname(__FILE__) + '../../../database.yml')
7
- ActiveRecord::Base.establish_connection config.merge(:adapter => :postgresql)
8
- ActiveRecord::Base.connection.execute('DROP TABLE IF EXISTS active_record_models')
9
- ActiveRecord::Base.connection.execute('CREATE TABLE IF NOT EXISTS active_record_models (id SERIAL PRIMARY KEY, text TEXT)')
6
+ setup_basic_postgres_table
10
7
  class ActiveRecordModel < ActiveRecord::Base
11
8
  end
12
9
  ActiveRecordModel.create!(text: 'Test1')
@@ -50,8 +47,7 @@ describe ::Mincer::Processors::PgJsonDumper do
50
47
  end
51
48
  context 'when postgres is NOT used' do
52
49
  before do
53
- ActiveRecord::Base.establish_connection(:adapter => 'sqlite3', :database => ':memory:')
54
- ActiveRecord::Base.connection.execute('CREATE TABLE active_record_models (id INTEGER UNIQUE, text STRING)')
50
+ setup_basic_sqlite3_table
55
51
  class ActiveRecordModel < ActiveRecord::Base
56
52
  end
57
53
  ActiveRecordModel.create!(id: 1, text: 'Test1')
@@ -3,10 +3,7 @@ require 'spec_helper'
3
3
  describe ::Mincer::Processors::Search do
4
4
  context 'when postgres used' do
5
5
  before do
6
- config = YAML.load_file File.expand_path(File.dirname(__FILE__) + '../../../database.yml')
7
- ActiveRecord::Base.establish_connection config.merge(:adapter => :postgresql)
8
- ActiveRecord::Base.connection.execute('DROP TABLE IF EXISTS active_record_models')
9
- ActiveRecord::Base.connection.execute('CREATE TABLE IF NOT EXISTS active_record_models (id SERIAL PRIMARY KEY, text TEXT)')
6
+ setup_basic_postgres_table
10
7
  class ActiveRecordModel < ActiveRecord::Base
11
8
  end
12
9
  ActiveRecordModel.create!(text: 'Test')
@@ -53,8 +50,7 @@ describe ::Mincer::Processors::Search do
53
50
 
54
51
  context 'when postgres is NOT used' do
55
52
  before do
56
- ActiveRecord::Base.establish_connection(:adapter => 'sqlite3', :database => ':memory:')
57
- ActiveRecord::Base.connection.execute('CREATE TABLE active_record_models (id INTEGER UNIQUE, text STRING)')
53
+ setup_basic_sqlite3_table
58
54
  class ActiveRecordModel < ActiveRecord::Base
59
55
  end
60
56
  ActiveRecordModel.create!(text: 'Test')
@@ -2,8 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe ::Mincer::Processors::Sort do
4
4
  before do
5
- ActiveRecord::Base.establish_connection(:adapter => 'sqlite3', :database => ':memory:')
6
- ActiveRecord::Base.connection.execute('CREATE TABLE active_record_models (id INTEGER UNIQUE, text STRING)')
5
+ setup_basic_sqlite3_table
7
6
  class ActiveRecordModel < ActiveRecord::Base
8
7
  end
9
8
  %w{a c b}.each { |i| ActiveRecordModel.create(text: i) }
data/spec/spec_helper.rb CHANGED
@@ -4,6 +4,8 @@
4
4
  # loaded once.
5
5
  #
6
6
  # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
+ require 'codeclimate-test-reporter'
8
+ CodeClimate::TestReporter.start
7
9
  require 'simplecov'
8
10
  SimpleCov.start do
9
11
  add_filter 'spec'
@@ -19,6 +21,9 @@ require 'textacular'
19
21
  ActiveRecord::Base.extend(Textacular)
20
22
  require 'mincer'
21
23
 
24
+ require 'support/postgres_adapter'
25
+ require 'support/sqlite3_adapter'
26
+
22
27
  RSpec.configure do |config|
23
28
  config.treat_symbols_as_metadata_keys_with_true_values = true
24
29
  config.run_all_when_everything_filtered = true
@@ -0,0 +1,11 @@
1
+ def setup_basic_postgres_table
2
+ config = if ENV['TRAVIS']
3
+ { adapter: :postgresql, database: 'mincer', username: 'postgres' }
4
+ else
5
+ YAML.load_file File.expand_path(File.dirname(__FILE__) + '../../database.yml')
6
+ end
7
+
8
+ ActiveRecord::Base.establish_connection(config)
9
+ ActiveRecord::Base.connection.execute('DROP TABLE IF EXISTS active_record_models')
10
+ ActiveRecord::Base.connection.execute('CREATE TABLE IF NOT EXISTS active_record_models (id SERIAL PRIMARY KEY, text TEXT)')
11
+ end
@@ -0,0 +1,4 @@
1
+ def setup_basic_sqlite3_table
2
+ ActiveRecord::Base.establish_connection(:adapter => 'sqlite3', :database => ':memory:')
3
+ ActiveRecord::Base.connection.execute('CREATE TABLE active_record_models (id INTEGER UNIQUE, text STRING)')
4
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mincer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Krasinsky
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-22 00:00:00.000000000 Z
11
+ date: 2013-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -56,30 +56,16 @@ dependencies:
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
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: guard-rspec
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - '>='
59
+ - - ~>
74
60
  - !ruby/object:Gem::Version
75
- version: '0'
61
+ version: 2.14.1
76
62
  type: :development
77
63
  prerelease: false
78
64
  version_requirements: !ruby/object:Gem::Requirement
79
65
  requirements:
80
- - - '>='
66
+ - - ~>
81
67
  - !ruby/object:Gem::Version
82
- version: '0'
68
+ version: 2.14.1
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: pg
85
71
  requirement: !ruby/object:Gem::Requirement
@@ -150,20 +136,6 @@ dependencies:
150
136
  - - '>='
151
137
  - !ruby/object:Gem::Version
152
138
  version: '0'
153
- - !ruby/object:Gem::Dependency
154
- name: simplecov
155
- requirement: !ruby/object:Gem::Requirement
156
- requirements:
157
- - - '>='
158
- - !ruby/object:Gem::Version
159
- version: '0'
160
- type: :development
161
- prerelease: false
162
- version_requirements: !ruby/object:Gem::Requirement
163
- requirements:
164
- - - '>='
165
- - !ruby/object:Gem::Version
166
- version: '0'
167
139
  description: Add pagination, cache_digest, order, json generation with postgres, simple
168
140
  search support to all your queries
169
141
  email:
@@ -173,11 +145,7 @@ extensions: []
173
145
  extra_rdoc_files: []
174
146
  files:
175
147
  - .gitignore
176
- - .idea/encodings.xml
177
- - .idea/misc.xml
178
- - .idea/modules.xml
179
- - .idea/scopes/scope_settings.xml
180
- - .idea/vcs.xml
148
+ - .travis.yml
181
149
  - Gemfile
182
150
  - LICENSE.txt
183
151
  - README.md
@@ -199,6 +167,8 @@ files:
199
167
  - spec/lib/processors/search_spec.rb
200
168
  - spec/lib/processors/sort_spec.rb
201
169
  - spec/spec_helper.rb
170
+ - spec/support/postgres_adapter.rb
171
+ - spec/support/sqlite3_adapter.rb
202
172
  homepage: ''
203
173
  licenses:
204
174
  - MIT
@@ -232,3 +202,5 @@ test_files:
232
202
  - spec/lib/processors/search_spec.rb
233
203
  - spec/lib/processors/sort_spec.rb
234
204
  - spec/spec_helper.rb
205
+ - spec/support/postgres_adapter.rb
206
+ - spec/support/sqlite3_adapter.rb