Skip to content

Commit

Permalink
gemspec, README and a few other changes to support gem install
Browse files Browse the repository at this point in the history
  • Loading branch information
alex committed Dec 16, 2009
1 parent 5a1c2e4 commit dad1acd
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
debug.log debug.log
coverage coverage
coverage.data coverage.data
pkg/
4 changes: 4 additions & 0 deletions README.markdown
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
This ActiverRecord plugin allows you to easily define and pull statistics for AR models. This plugin was built with reporting in mind. This ActiverRecord plugin allows you to easily define and pull statistics for AR models. This plugin was built with reporting in mind.


## Installation ## Installation
gem install statistics
OR
script/plugin install git://github.com/acatighera/statistics.git script/plugin install git://github.com/acatighera/statistics.git


## Examples ## Examples
Expand Down Expand Up @@ -60,6 +62,8 @@ This is a new feature that uses `Rails.cache`. You can cache certain statistics


Account.statistics(:state => 'PA') # This call generates a SQL query because the user count for NY and PA could be different (and probably is) Account.statistics(:state => 'PA') # This call generates a SQL query because the user count for NY and PA could be different (and probably is)


Note: If you want Rails.cache to work properly, you need to use mem_cache_store in your rails enviroment file (ie. `config.cache_store = :mem_cache_store` in your enviroment.rb file).

#### Standardized #### Standardized


All ActiveRecord classes now respond to `statistics` and `get_stat` methods All ActiveRecord classes now respond to `statistics` and `get_stat` methods
Expand Down
13 changes: 13 additions & 0 deletions Rakefile
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,13 @@
begin
require 'jeweler'
Jeweler::Tasks.new do |gemspec|
gemspec.name = "statistics"
gemspec.summary = "An ActiveRecord gem that makes it easier to do reporting."
gemspec.email = "acatighera@gmail.com"
gemspec.homepage = "http://github.com/acatighera/statistics"
gemspec.authors = ["Alexandru Catighera"]
end
rescue LoadError
puts "Jeweler not available. Install it with: sudo gem install jeweler"
end

1 change: 0 additions & 1 deletion init.rb
Original file line number Original file line Diff line number Diff line change
@@ -1,2 +1 @@
require File.join(File.dirname(__FILE__), 'lib', 'statistics') require File.join(File.dirname(__FILE__), 'lib', 'statistics')
ActiveRecord::Base.send(:include, Statistics)
3 changes: 2 additions & 1 deletion lib/statistics.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -176,5 +176,6 @@ def sql_options(options)
options options
end end
end end

end end

ActiveRecord::Base.send(:include, Statistics)
48 changes: 48 additions & 0 deletions statistics.gemspec
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,48 @@
# Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
# -*- encoding: utf-8 -*-

Gem::Specification.new do |s|
s.name = %q{statistics}
s.version = "0.1.1"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Alexandru Catighera"]
s.date = %q{2009-12-16}
s.email = %q{acatighera@gmail.com}
s.extra_rdoc_files = [
"README.markdown"
]
s.files = [
".gitignore",
"CHANGES.markdown",
"MIT-LICENSE",
"README.markdown",
"Rakefile",
"VERSION",
"init.rb",
"lib/statistics.rb",
"statistics.gemspec",
"test/statistics_test.rb"
]
s.homepage = %q{http://github.com/acatighera/statistics}
s.rdoc_options = ["--charset=UTF-8"]
s.require_paths = ["lib"]
s.rubygems_version = %q{1.3.5}
s.summary = %q{An ActiveRecord gem that makes it easier to do reporting.}
s.test_files = [
"test/statistics_test.rb"
]

if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 3

if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
else
end
else
end
end

0 comments on commit dad1acd

Please sign in to comment.