redisk 0.1.0

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/.document ADDED
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/.gitignore ADDED
@@ -0,0 +1,23 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+
21
+ ## PROJECT::SPECIFIC
22
+ dump.rdb
23
+ redis-test.pid
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Aaron Quint
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,56 @@
1
+ = redisk
2
+
3
+ An interface to Redis that mimic's Ruby's IO classes
4
+
5
+ == WHAT
6
+
7
+ Redis (http://code.google.com/p/redis/) is a super awesome persisted key-value store.
8
+
9
+ Why are we still logging to files then?
10
+
11
+ Redisk is a set of Ruby classes that mimic's Ruby's built in IO classes to allow
12
+ drop in replacement for logging and other fun things.
13
+
14
+ == USAGE
15
+
16
+ Currently, Redisk provides two main classes Redisk::IO and Redisk::Logger.
17
+
18
+ Redisk::IO implements _most_ of the methods of Ruby's IO class (http://ruby-doc.org/core/classes/IO.html)
19
+
20
+ require 'redisk'
21
+
22
+ io = Redisk::IO.new('mylog.log') # not a file, a Redis List
23
+ io.puts "Log this!"
24
+ io.gets #=> "Log this!"
25
+ io.gets #=> nil
26
+ io.lineno = 2
27
+
28
+ Its much more interesting to use it with logger.
29
+
30
+ logger = Logger.new(Redisk::IO.new('test.log))
31
+ logger.info("Hahah, I'm logging to redis")
32
+ logger.warn("whu?")
33
+ logger.error("zuh")
34
+
35
+ Theres also a nifty wrapper for that behavior:
36
+
37
+ logger = Redisk::Logger.new('test.log')
38
+ logger.info "10 less characters!"
39
+
40
+ By default, Redisk uses the Redis on localhost:6379, but you can change that by setting
41
+
42
+ Redisk.redis = 'myhost:myport'
43
+
44
+ == Note on Patches/Pull Requests
45
+
46
+ * Fork the project.
47
+ * Make your feature addition or bug fix.
48
+ * Add tests for it. This is important so I don't break it in a
49
+ future version unintentionally.
50
+ * Commit, do not mess with rakefile, version, or history.
51
+ (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)
52
+ * Send me a pull request. Bonus points for topic branches.
53
+
54
+ == Copyright
55
+
56
+ Copyright (c) 2009 Aaron Quint. See LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1,49 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(File.expand_path(__FILE__)), 'lib'))
2
+ require 'rubygems'
3
+ require 'rake'
4
+ require 'redisk'
5
+
6
+ begin
7
+ require 'jeweler'
8
+ Jeweler::Tasks.new do |gem|
9
+ gem.name = "redisk"
10
+ gem.version = Redisk::VERSION
11
+ gem.summary = %Q{An interface to Redis that mimic's Ruby's IO classes}
12
+ gem.description = %Q{Redisk includes Redisk::IO which is ~ Ruby's stdlib IO. It can be used with stdlib's Logger to log directly to redis}
13
+ gem.email = "aaron@quirkey.com"
14
+ gem.homepage = "http://github.com/quirkey/redis_log"
15
+ gem.authors = ["Aaron Quint"]
16
+ gem.add_dependency "redis", ">=0.1.1"
17
+ gem.add_dependency "redis-namespace", ">=0.1.0"
18
+ gem.add_development_dependency "rspec", ">= 1.2.9"
19
+ end
20
+ Jeweler::GemcutterTasks.new
21
+ rescue LoadError
22
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
23
+ end
24
+
25
+ require 'spec/rake/spectask'
26
+ Spec::Rake::SpecTask.new(:spec) do |spec|
27
+ spec.libs << 'lib' << 'spec'
28
+ spec.spec_files = FileList['spec/**/*_spec.rb']
29
+ end
30
+
31
+ Spec::Rake::SpecTask.new(:rcov) do |spec|
32
+ spec.libs << 'lib' << 'spec'
33
+ spec.pattern = 'spec/**/*_spec.rb'
34
+ spec.rcov = true
35
+ end
36
+
37
+ task :spec => :check_dependencies
38
+
39
+ task :default => :spec
40
+
41
+ require 'rake/rdoctask'
42
+ Rake::RDocTask.new do |rdoc|
43
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
44
+
45
+ rdoc.rdoc_dir = 'rdoc'
46
+ rdoc.title = "redis-log #{version}"
47
+ rdoc.rdoc_files.include('README*')
48
+ rdoc.rdoc_files.include('lib/**/*.rb')
49
+ end
@@ -0,0 +1,13 @@
1
+ module Redisk
2
+ module Helper
3
+
4
+ def redis
5
+ Redisk.redis
6
+ end
7
+
8
+ def redis=(server)
9
+ Redisk.redis=(server)
10
+ end
11
+
12
+ end
13
+ end