added jeweler, yard, and more to rakefile

This commit is contained in:
2010-07-27 20:59:27 +03:00
parent 7ea7ec4ba1
commit 51bdc73387
7 changed files with 150 additions and 32 deletions

5
.document Normal file
View File

@@ -0,0 +1,5 @@
README.md
lib/**/*.rb
bin/*
features/**/*.feature
LICENSE

20
LICENSE Normal file
View File

@@ -0,0 +1,20 @@
Copyright (c) 2010 Jim Myhrberg.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

38
README.md Normal file
View File

@@ -0,0 +1,38 @@
# redistat
Description goes here.
## Note on Patches/Pull Requests
* Fork the project.
* Make your feature addition or bug fix.
* Add tests for it. This is important so I don't break it in a
future version unintentionally.
* Commit, do not mess with rakefile, version, or history.
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
* Send me a pull request. Bonus points for topic branches.
## License and Copyright
Copyright (c) 2010 Jim Myhrberg.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -1,22 +1,50 @@
require "rubygems"
require 'rubygems'
require 'rake'
require "spec"
require "spec/rake/spectask"
begin
require 'jeweler'
Jeweler::Tasks.new do |gem|
gem.name = "redistat"
gem.summary = %Q{TODO: one-line summary of your gem}
gem.description = %Q{TODO: longer description of your gem}
gem.email = "contact@jimeh.me"
gem.homepage = "http://github.com/jimeh/redistat"
gem.authors = ["Jim Myhrberg"]
gem.add_dependency "activesupport", ">= 2.3.0"
gem.add_dependency "json", ">= 1.0.0"
gem.add_dependency "redis", ">= 2.0.0"
gem.add_dependency "time_ext", ">= 0.1.0"
gem.add_development_dependency "rspec", ">= 1.2.9"
gem.add_development_dependency "yard", ">= 0"
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
end
Jeweler::GemcutterTasks.new
rescue LoadError
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
end
REDIS_DIR = File.expand_path(File.join("..", "spec"), __FILE__)
REDIS_CNF = File.join(REDIS_DIR, "redis-test.conf")
REDIS_PID = File.join(REDIS_DIR, "db", "redis.pid")
require 'spec/rake/spectask'
Spec::Rake::SpecTask.new(:spec) do |spec|
spec.libs << 'lib' << 'spec'
spec.spec_files = FileList['spec/**/*_spec.rb']
end
Spec::Rake::SpecTask.new(:rcov) do |spec|
spec.libs << 'lib' << 'spec'
spec.pattern = 'spec/**/*_spec.rb'
spec.rcov = true
end
task :spec => :check_dependencies
task :default => [:start, :spec, :stop]
# define the spec task
Spec::Rake::SpecTask.new do |t|
t.spec_opts = %w(--format specdoc --colour)
t.libs = ["spec"]
end
# Start/stop Redis test server
REDIS_DIR = File.expand_path(File.join("..", "spec"), __FILE__)
REDIS_CNF = File.join(REDIS_DIR, "redis-test.conf")
REDIS_PID = File.join(REDIS_DIR, "db", "redis.pid")
desc "Start the Redis test server"
task :start do
@@ -31,4 +59,15 @@ task :stop do
system "kill #{File.read(REDIS_PID)}"
system "rm #{REDIS_PID}"
end
end
end
# YARD Documentation
begin
require 'yard'
YARD::Rake::YardocTask.new
rescue LoadError
task :yardoc do
abort "YARD is not available. In order to run yardoc, you must: sudo gem install yard"
end
end

View File

@@ -1,21 +1,25 @@
require "redis"
require "date"
require "time"
require "json/pure"
require "digest/sha1"
require 'rubygems'
require 'active_support'
require 'redis'
require 'date'
require 'time'
require 'time/ext'
require 'json'
require 'digest/sha1'
require "redistat/database"
require "redistat/date"
require "redistat/event"
require "redistat/extensions/date"
require "redistat/extensions/time"
require "redistat/extensions/fixnum"
require "redistat/key"
require "redistat/label"
require "redistat/model"
require "redistat/scope"
require "redistat/summary"
require 'redistat/database'
require 'redistat/date'
require 'redistat/event'
require 'redistat/key'
require 'redistat/label'
require 'redistat/model'
require 'redistat/scope'
require 'redistat/summary'
require 'redistat/core_ext/date'
require 'redistat/core_ext/time'
require 'redistat/core_ext/fixnum'
module Redistat
@@ -45,7 +49,7 @@ module Redistat
# @option options [#to_s] :db (0) Database number.
# @option options [#to_s] :timeout (0) Database timeout in seconds.
# @example Connect to a database in port 6380.
# Ohm.connect(:port => 6380)
# Redistat.connect(:port => 6380)
def connect(*options)
self.redis = nil
@options = options

2
spec/spec.opts Normal file
View File

@@ -0,0 +1,2 @@
--format specdoc
--color

View File

@@ -1,5 +1,15 @@
require "rubygems"
require File.dirname(__FILE__) + "/../lib/redistat"
# require "rubygems"
# require File.dirname(__FILE__) + "/../lib/redistat"
$LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'redistat'
require 'spec'
require 'spec/autorun'
Spec::Runner.configure do |config|
end
Redistat.connect({:port => 8379, :db => 15})
Redistat.flush