cohort_scope 0.1.3 → 0.1.4

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.
data/.gitignore CHANGED
@@ -19,3 +19,5 @@ rdoc
19
19
  pkg
20
20
 
21
21
  ## PROJECT::SPECIFIC
22
+ Gemfile.lock
23
+ test/test.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in cohort_scope.gemspec
4
+ gemspec
data/Rakefile CHANGED
@@ -1,25 +1,7 @@
1
- require 'rubygems'
2
- require 'rake'
3
-
4
- begin
5
- require 'jeweler'
6
- Jeweler::Tasks.new do |gem|
7
- gem.name = "cohort_scope"
8
- gem.summary = %Q{Provides cohorts (in the form of ActiveRecord scopes) that dynamically widen until they contain a certain number of records.}
9
- gem.description = %Q{Provides big_cohort, which widens by finding the constraint that eliminates the most records and removing it. Also provides strict_cohort, which widens by eliminating constraints in order.}
10
- gem.email = "seamus@abshere.net"
11
- gem.homepage = "http://github.com/seamusabshere/cohort_scope"
12
- gem.authors = ["Seamus Abshere", "Andy Rossmeissl", "Derek Kastner"]
13
- gem.add_dependency "activesupport", ">=3.0.0.beta4"
14
- gem.add_dependency "activerecord", ">=3.0.0.beta4"
15
- gem.add_development_dependency "shoulda", ">= 2.10.3"
16
- gem.add_development_dependency 'sqlite3-ruby'
17
- end
18
- Jeweler::GemcutterTasks.new
19
- rescue LoadError
20
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
21
- end
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
22
3
 
4
+ require 'rake'
23
5
  require 'rake/testtask'
24
6
  Rake::TestTask.new(:test) do |test|
25
7
  test.libs << 'lib' << 'test'
@@ -28,28 +10,16 @@ Rake::TestTask.new(:test) do |test|
28
10
  end
29
11
 
30
12
  begin
31
- require 'rcov/rcovtask'
32
- Rcov::RcovTask.new do |test|
33
- test.libs << 'test'
34
- test.pattern = 'test/**/test_*.rb'
35
- test.verbose = true
13
+ require 'rake/rdoctask'
14
+ Rake::RDocTask.new do |rdoc|
15
+ rdoc.rdoc_dir = 'rdoc'
16
+ rdoc.title = 'cohort_scope'
17
+ rdoc.options << '--line-numbers' << '--inline-source'
18
+ rdoc.rdoc_files.include('README*')
19
+ rdoc.rdoc_files.include('lib/**/*.rb')
36
20
  end
37
21
  rescue LoadError
38
- task :rcov do
39
- abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
40
- end
22
+ puts "Rdoc is not available"
41
23
  end
42
24
 
43
- task :test => :check_dependencies
44
-
45
25
  task :default => :test
46
-
47
- require 'rake/rdoctask'
48
- Rake::RDocTask.new do |rdoc|
49
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
50
-
51
- rdoc.rdoc_dir = 'rdoc'
52
- rdoc.title = "cohort_scope #{version}"
53
- rdoc.rdoc_files.include('README*')
54
- rdoc.rdoc_files.include('lib/**/*.rb')
55
- end
data/cohort_scope.gemspec CHANGED
@@ -1,68 +1,26 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
1
  # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "cohort_scope/version"
5
4
 
6
5
  Gem::Specification.new do |s|
7
- s.name = %q{cohort_scope}
8
- s.version = "0.1.3"
6
+ s.name = "cohort_scope"
7
+ s.version = CohortScope::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Seamus Abshere", "Andy Rossmeissl", "Derek Kastner"]
10
+ s.email = ["seamus@abshere.net"]
11
+ s.homepage = "https://github.com/seamusabshere/cohort_scope"
12
+ s.summary = %Q{Provides cohorts (in the form of ActiveRecord scopes) that dynamically widen until they contain a certain number of records.}
13
+ s.description = %Q{Provides big_cohort, which widens by finding the constraint that eliminates the most records and removing it. Also provides strict_cohort, which widens by eliminating constraints in order.}
9
14
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Seamus Abshere", "Andy Rossmeissl", "Derek Kastner"]
12
- s.date = %q{2011-02-01}
13
- s.description = %q{Provides big_cohort, which widens by finding the constraint that eliminates the most records and removing it. Also provides strict_cohort, which widens by eliminating constraints in order.}
14
- s.email = %q{seamus@abshere.net}
15
- s.extra_rdoc_files = [
16
- "LICENSE",
17
- "README.rdoc"
18
- ]
19
- s.files = [
20
- ".document",
21
- ".gitignore",
22
- "LICENSE",
23
- "README.rdoc",
24
- "Rakefile",
25
- "VERSION",
26
- "cohort_scope.gemspec",
27
- "lib/cohort_scope.rb",
28
- "lib/cohort_scope/big_cohort.rb",
29
- "lib/cohort_scope/cohort.rb",
30
- "lib/cohort_scope/strict_cohort.rb",
31
- "test/helper.rb",
32
- "test/test_cohort.rb",
33
- "test/test_cohort_scope.rb"
34
- ]
35
- s.homepage = %q{http://github.com/seamusabshere/cohort_scope}
36
- s.rdoc_options = ["--charset=UTF-8"]
37
- s.require_paths = ["lib"]
38
- s.rubygems_version = %q{1.3.7}
39
- s.summary = %q{Provides cohorts (in the form of ActiveRecord scopes) that dynamically widen until they contain a certain number of records.}
40
- s.test_files = [
41
- "test/helper.rb",
42
- "test/test_cohort.rb",
43
- "test/test_cohort_scope.rb"
44
- ]
45
-
46
- if s.respond_to? :specification_version then
47
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
48
- s.specification_version = 3
15
+ s.rubyforge_project = "cohort_scope"
49
16
 
50
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
51
- s.add_runtime_dependency(%q<activesupport>, [">= 3.0.0.beta4"])
52
- s.add_runtime_dependency(%q<activerecord>, [">= 3.0.0.beta4"])
53
- s.add_development_dependency(%q<shoulda>, [">= 2.10.3"])
54
- s.add_development_dependency(%q<sqlite3-ruby>, [">= 0"])
55
- else
56
- s.add_dependency(%q<activesupport>, [">= 3.0.0.beta4"])
57
- s.add_dependency(%q<activerecord>, [">= 3.0.0.beta4"])
58
- s.add_dependency(%q<shoulda>, [">= 2.10.3"])
59
- s.add_dependency(%q<sqlite3-ruby>, [">= 0"])
60
- end
61
- else
62
- s.add_dependency(%q<activesupport>, [">= 3.0.0.beta4"])
63
- s.add_dependency(%q<activerecord>, [">= 3.0.0.beta4"])
64
- s.add_dependency(%q<shoulda>, [">= 2.10.3"])
65
- s.add_dependency(%q<sqlite3-ruby>, [">= 0"])
66
- end
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+
22
+ s.add_dependency "activesupport", ">=3.0.0.beta4"
23
+ s.add_dependency "activerecord", ">=3.0.0.beta4"
24
+ s.add_development_dependency "shoulda", ">= 2.10.3"
25
+ s.add_development_dependency 'sqlite3-ruby'
67
26
  end
68
-
@@ -92,7 +92,11 @@ module CohortScope
92
92
 
93
93
  # sabshere 2/1/11 overriding as_json per usual doesn't seem to work
94
94
  def to_json(*)
95
- { :members => count }.to_json
95
+ as_json.to_json
96
+ end
97
+
98
+ def as_json(*)
99
+ { :members => count }
96
100
  end
97
101
 
98
102
  # sabshere 2/1/11 ActiveRecord does this for #any? but not for #none?
@@ -0,0 +1,3 @@
1
+ module CohortScope
2
+ VERSION = '0.1.4'
3
+ end
data/lib/cohort_scope.rb CHANGED
@@ -4,6 +4,7 @@ require 'active_support/version'
4
4
 
5
5
  require 'active_support/core_ext/module/delegation' if ActiveSupport::VERSION::MAJOR == 3
6
6
 
7
+ require 'cohort_scope/version'
7
8
  require 'cohort_scope/cohort'
8
9
  require 'cohort_scope/big_cohort'
9
10
  require 'cohort_scope/strict_cohort'
data/test/helper.rb CHANGED
@@ -1,10 +1,11 @@
1
1
  require 'rubygems'
2
+ require 'bundler'
3
+ Bundler.setup
2
4
  require 'test/unit'
3
5
  require 'shoulda'
4
6
  require 'logger'
5
-
6
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
7
7
  $LOAD_PATH.unshift(File.dirname(__FILE__))
8
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
8
9
  require 'cohort_scope'
9
10
 
10
11
  class Test::Unit::TestCase
@@ -44,6 +44,11 @@ class TestCohortScope < Test::Unit::TestCase
44
44
  cohort = Citizen.big_cohort :birthdate => @date_range, :favorite_color => 'heliotrope'
45
45
  assert_equal "<Massive ActiveRecord scope with 9 members>", cohort.inspect
46
46
  end
47
+
48
+ should "not get fooled into revealing all of its members by a parent's #to_hash" do
49
+ cohort = Citizen.big_cohort :birthdate => @date_range, :favorite_color => 'heliotrope'
50
+ assert_equal '{"c":{"members":9}}', { :c => cohort }.to_hash.to_json
51
+ end
47
52
 
48
53
  should "retain the scope's original behavior" do
49
54
  cohort = Citizen.big_cohort :birthdate => @date_range, :favorite_color => 'heliotrope'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cohort_scope
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 3
10
- version: 0.1.3
9
+ - 4
10
+ version: 0.1.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Seamus Abshere
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2011-02-01 00:00:00 -06:00
20
+ date: 2011-02-11 00:00:00 -06:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
@@ -85,36 +85,37 @@ dependencies:
85
85
  type: :development
86
86
  version_requirements: *id004
87
87
  description: Provides big_cohort, which widens by finding the constraint that eliminates the most records and removing it. Also provides strict_cohort, which widens by eliminating constraints in order.
88
- email: seamus@abshere.net
88
+ email:
89
+ - seamus@abshere.net
89
90
  executables: []
90
91
 
91
92
  extensions: []
92
93
 
93
- extra_rdoc_files:
94
- - LICENSE
95
- - README.rdoc
94
+ extra_rdoc_files: []
95
+
96
96
  files:
97
97
  - .document
98
98
  - .gitignore
99
+ - Gemfile
99
100
  - LICENSE
100
101
  - README.rdoc
101
102
  - Rakefile
102
- - VERSION
103
103
  - cohort_scope.gemspec
104
104
  - lib/cohort_scope.rb
105
105
  - lib/cohort_scope/big_cohort.rb
106
106
  - lib/cohort_scope/cohort.rb
107
107
  - lib/cohort_scope/strict_cohort.rb
108
+ - lib/cohort_scope/version.rb
108
109
  - test/helper.rb
109
110
  - test/test_cohort.rb
110
111
  - test/test_cohort_scope.rb
111
112
  has_rdoc: true
112
- homepage: http://github.com/seamusabshere/cohort_scope
113
+ homepage: https://github.com/seamusabshere/cohort_scope
113
114
  licenses: []
114
115
 
115
116
  post_install_message:
116
- rdoc_options:
117
- - --charset=UTF-8
117
+ rdoc_options: []
118
+
118
119
  require_paths:
119
120
  - lib
120
121
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -137,7 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
138
  version: "0"
138
139
  requirements: []
139
140
 
140
- rubyforge_project:
141
+ rubyforge_project: cohort_scope
141
142
  rubygems_version: 1.3.7
142
143
  signing_key:
143
144
  specification_version: 3
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.1.3