io_shuten 0.0.1.dev0

Sign up to get free protection for your applications and to get access to all the features.
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ -f d
data/.rvmrc ADDED
@@ -0,0 +1,71 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # This is an RVM Project .rvmrc file, used to automatically load the ruby
4
+ # development environment upon cd'ing into the directory
5
+
6
+ # First we specify our desired <ruby>[@<gemset>], the @gemset name is optional.
7
+ environment_id="ruby-1.9.3-p0@io_shuten"
8
+
9
+ #
10
+ # Uncomment following line if you want options to be set only for given project.
11
+ #
12
+ # PROJECT_JRUBY_OPTS=( --1.9 )
13
+ #
14
+ # The variable PROJECT_JRUBY_OPTS requires the following to be run in shell:
15
+ #
16
+ # chmod +x ${rvm_path}/hooks/after_use_jruby_opts
17
+ #
18
+
19
+ #
20
+ # First we attempt to load the desired environment directly from the environment
21
+ # file. This is very fast and efficient compared to running through the entire
22
+ # CLI and selector. If you want feedback on which environment was used then
23
+ # insert the word 'use' after --create as this triggers verbose mode.
24
+ #
25
+ if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \
26
+ && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
27
+ then
28
+ \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
29
+
30
+ if [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]]
31
+ then
32
+ . "${rvm_path:-$HOME/.rvm}/hooks/after_use"
33
+ fi
34
+ else
35
+ # If the environment file has not yet been created, use the RVM CLI to select.
36
+ if ! rvm --create use "$environment_id"
37
+ then
38
+ echo "Failed to create RVM environment '${environment_id}'."
39
+ return 1
40
+ fi
41
+ fi
42
+
43
+ #
44
+ # If you use an RVM gemset file to install a list of gems (*.gems), you can have
45
+ # it be automatically loaded. Uncomment the following and adjust the filename if
46
+ # necessary.
47
+ #
48
+ # filename=".gems"
49
+ # if [[ -s "$filename" ]]
50
+ # then
51
+ # rvm gemset import "$filename" | grep -v already | grep -v listed | grep -v complete | sed '/^$/d'
52
+ # fi
53
+
54
+ # If you use bundler, this might be useful to you:
55
+ # if [[ -s Gemfile ]] && ! command -v bundle >/dev/null
56
+ # then
57
+ # printf "The rubygem 'bundler' is not installed. Installing it now.\n"
58
+ # gem install bundler
59
+ # fi
60
+ # if [[ -s Gemfile ]] && command -v bundle
61
+ # then
62
+ # bundle install
63
+ # fi
64
+
65
+ if [[ $- == *i* ]] # check for interactive shells
66
+ then
67
+ echo "Using: $(tput setaf 2)$GEM_HOME$(tput sgr0)" # show the user the ruby and gemset they are using in green
68
+ else
69
+ echo "Using: $GEM_HOME" # don't use colors in interactive shells
70
+ fi
71
+
data/.simplecov ADDED
@@ -0,0 +1,16 @@
1
+ if ENV["COV"] || ENV["COVERAGE"]
2
+ require 'simplecov-rcov'
3
+ require 'simplecov-csv'
4
+ class SimpleCov::Formatter::MergedFormatter
5
+ def format(result)
6
+ SimpleCov::Formatter::RcovFormatter.new.format(result)
7
+ SimpleCov::Formatter::HTMLFormatter.new.format(result)
8
+ SimpleCov::Formatter::CSVFormatter.new.format(result)
9
+ end
10
+ end
11
+ SimpleCov.formatter = SimpleCov::Formatter::MergedFormatter
12
+ SimpleCov.start do
13
+ add_filter "/spec/"
14
+ end
15
+ end
16
+
data/Gemfile ADDED
@@ -0,0 +1,22 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "hiredis", "~> 0.4.4"
4
+ gem "redis", "~> 2.2.2", :require => ["redis/connection/hiredis", "redis"]
5
+
6
+ gem "bson_ext", "~> 1.5.2"
7
+ gem "mongo", "~> 1.5.2"
8
+
9
+ group :development, :test do
10
+ gem "rake"
11
+ gem "jeweler"
12
+
13
+ gem "rspec", "~> 2.8.0"
14
+ gem "simplecov", :require => false
15
+ gem "simplecov-rcov", :require => false
16
+ gem "simplecov-csv", :require => false
17
+
18
+ gem "pry"
19
+ gem "pry-doc"
20
+ end
21
+
22
+
data/Gemfile.lock ADDED
@@ -0,0 +1,67 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ bson (1.5.2)
5
+ bson_ext (1.5.2)
6
+ bson (= 1.5.2)
7
+ coderay (0.9.8)
8
+ diff-lcs (1.1.3)
9
+ git (1.2.5)
10
+ hiredis (0.4.4)
11
+ jeweler (1.6.4)
12
+ bundler (~> 1.0)
13
+ git (>= 1.2.5)
14
+ rake
15
+ method_source (0.6.7)
16
+ ruby_parser (>= 2.3.1)
17
+ mongo (1.5.2)
18
+ bson (= 1.5.2)
19
+ multi_json (1.0.4)
20
+ pry (0.9.7.4)
21
+ coderay (~> 0.9.8)
22
+ method_source (~> 0.6.7)
23
+ ruby_parser (>= 2.3.1)
24
+ slop (~> 2.1.0)
25
+ pry-doc (0.3.0)
26
+ pry (>= 0.9.0)
27
+ yard (>= 0.6.4)
28
+ rake (0.9.2.2)
29
+ redis (2.2.2)
30
+ rspec (2.8.0)
31
+ rspec-core (~> 2.8.0)
32
+ rspec-expectations (~> 2.8.0)
33
+ rspec-mocks (~> 2.8.0)
34
+ rspec-core (2.8.0)
35
+ rspec-expectations (2.8.0)
36
+ diff-lcs (~> 1.1.2)
37
+ rspec-mocks (2.8.0)
38
+ ruby_parser (2.3.1)
39
+ sexp_processor (~> 3.0)
40
+ sexp_processor (3.0.10)
41
+ simplecov (0.5.4)
42
+ multi_json (~> 1.0.3)
43
+ simplecov-html (~> 0.5.3)
44
+ simplecov-csv (0.1.3)
45
+ simplecov
46
+ simplecov-html (0.5.3)
47
+ simplecov-rcov (0.2.3)
48
+ simplecov (>= 0.4.1)
49
+ slop (2.1.0)
50
+ yard (0.7.4)
51
+
52
+ PLATFORMS
53
+ ruby
54
+
55
+ DEPENDENCIES
56
+ bson_ext (~> 1.5.2)
57
+ hiredis (~> 0.4.4)
58
+ jeweler
59
+ mongo (~> 1.5.2)
60
+ pry
61
+ pry-doc
62
+ rake
63
+ redis (~> 2.2.2)
64
+ rspec (~> 2.8.0)
65
+ simplecov
66
+ simplecov-csv
67
+ simplecov-rcov
data/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright (c) 2012 Christoph 'asaaki' Grabo
2
+
3
+ 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:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ 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.
data/LICENSE.de ADDED
@@ -0,0 +1,7 @@
1
+ Copyright (c) 2012 Christoph 'asaaki' Grabo
2
+
3
+ Hiermit wird unentgeltlich, jeder Person, die eine Kopie der Software und der zugehörigen Dokumentationen (die "Software") erhält, die Erlaubnis erteilt, uneingeschränkt zu benutzen, inklusive und ohne Ausnahme, dem Recht, sie zu verwenden, kopieren, ändern, fusionieren, verlegen, verbreiten, unterlizenzieren und/oder zu verkaufen, und Personen, die diese Software erhalten, diese Rechte zu geben, unter den folgenden Bedingungen:
4
+
5
+ Der obige Urheberrechtsvermerk und dieser Erlaubnisvermerk sind in allen Kopien oder Teilkopien der Software beizulegen.
6
+
7
+ DIE SOFTWARE WIRD OHNE JEDE AUSDRÜCKLICHE ODER IMPLIZIERTE GARANTIE BEREITGESTELLT, EINSCHLIESSLICH DER GARANTIE ZUR BENUTZUNG FÜR DEN VORGESEHENEN ODER EINEM BESTIMMTEN ZWECK SOWIE JEGLICHER RECHTSVERLETZUNG, JEDOCH NICHT DARAUF BESCHRÄNKT. IN KEINEM FALL SIND DIE AUTOREN ODER COPYRIGHTINHABER FÜR JEGLICHEN SCHADEN ODER SONSTIGE ANSPRÜCHE HAFTBAR ZU MACHEN, OB INFOLGE DER ERFÜLLUNG EINES VERTRAGES, EINES DELIKTES ODER ANDERS IM ZUSAMMENHANG MIT DER SOFTWARE ODER SONSTIGER VERWENDUNG DER SOFTWARE ENTSTANDEN.
data/README.md ADDED
@@ -0,0 +1,47 @@
1
+ # IO::shuten
2
+
3
+ Use databases as IO handler like you would do with files and streams.
4
+
5
+ # Motivation
6
+
7
+ One purpose for creating this project is to have an IO like interface to database storages.
8
+
9
+ With this gem you should have the possibility to use redis or mongodb as endpoints for IO related tasks like logging.
10
+
11
+ Example:
12
+
13
+ ```ruby
14
+ require "io_shuten"
15
+ require "logger"
16
+
17
+ logdev = IO_shuten::Redis.new( REDIS_INSTANCE )
18
+ logger = Logger.new(logdev)
19
+
20
+ logger.info "This message will be stored in redis."
21
+ ```
22
+
23
+ # Not for production!
24
+
25
+ This project is freshly started and currently not usable.
26
+
27
+ Everything can and maybe will change.
28
+
29
+ Feel free to contribute, write issues if you want to support me with your ideas and insights.
30
+
31
+ # git flowed
32
+
33
+ Development will happen in the `develop` branch now, master should be in a deployable state.
34
+
35
+ Read more about `git flow` and the branchin model here:
36
+
37
+ * http://nvie.com/posts/a-successful-git-branching-model/
38
+ * https://github.com/nvie/gitflow
39
+
40
+ I like this approach and try to use it whenever possible, also in one-man-development.
41
+
42
+ # License
43
+
44
+ This gem/software is licensed under MIT/X11 license. See [LICENSE](https://raw.github.com/asaaki/io_shuten/develop/LICENSE) (or [LICENSE.de](https://raw.github.com/asaaki/io_shuten/develop/LICENSE.de) for german translation).
45
+
46
+ — [Christoph 'asaaki' Grabo](https://github.com/asaaki)
47
+
data/Rakefile ADDED
@@ -0,0 +1,60 @@
1
+ # encoding: utf-8
2
+ require "bundler"
3
+ Bundler.setup
4
+ require 'jeweler'
5
+
6
+ require "rspec"
7
+ require "rspec/core/rake_task"
8
+
9
+ $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
10
+ require "io_shuten/version"
11
+
12
+
13
+
14
+ Jeweler::Tasks.new do |gem|
15
+ gem.name = "io_shuten"
16
+ gem.version = IO_shuten::VERSION
17
+ gem.platform = Gem::Platform::RUBY
18
+ gem.authors = ["Christoph Grabo"]
19
+ gem.email = ["chris@dinarrr.com"]
20
+ gem.licenses = ["MIT"]
21
+ gem.homepage = "http://github.com/asaaki/io_shuten"
22
+ gem.summary = "IO::shuten – Use databases as IO handler."
23
+ gem.description = "IO::shuten – Use databases as IO handler like you would do with files and streamgem."
24
+ end
25
+
26
+
27
+
28
+ task :gem => :build
29
+
30
+ # gem building and releasing tasks are provided by jeweler and so not needed to be implemented manually
31
+
32
+ task "gem:release" => :gem do
33
+ system "gem push pkg/io_shuten-#{IO_shuten::VERSION}.gem"
34
+ end
35
+
36
+ desc "Run all specs"
37
+ task RSpec::Core::RakeTask.new(:spec) do |t|
38
+ t.pattern = 'spec/**/*_spec.rb'
39
+ t.verbose = false
40
+ end
41
+
42
+ desc "Run all specs + code coverage"
43
+ task "spec:cov" do
44
+ ENV["COV"] = 'true'
45
+ Rake::Task["spec"].invoke
46
+ end
47
+
48
+
49
+
50
+ desc "Starts IRB with env"
51
+ task :irb do
52
+ sh "irb -I lib -r io_shuten"
53
+ end
54
+
55
+ desc "Starts PRY with env"
56
+ task :pry do
57
+ sh "pry -I lib -r io_shuten --no-pager"
58
+ end
59
+
60
+ task :default => :spec
data/io_shuten.gemspec ADDED
@@ -0,0 +1,93 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "io_shuten"
8
+ s.version = "0.0.1.dev0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Christoph Grabo"]
12
+ s.date = "2012-01-21"
13
+ s.description = "IO::shuten \u{2013} Use databases as IO handler like you would do with files and streamgem."
14
+ s.email = ["chris@dinarrr.com"]
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "LICENSE.de",
18
+ "README.md"
19
+ ]
20
+ s.files = [
21
+ ".rspec",
22
+ ".rvmrc",
23
+ ".simplecov",
24
+ "Gemfile",
25
+ "Gemfile.lock",
26
+ "LICENSE",
27
+ "LICENSE.de",
28
+ "README.md",
29
+ "Rakefile",
30
+ "io_shuten.gemspec",
31
+ "lib/io_shuten.rb",
32
+ "lib/io_shuten/base.rb",
33
+ "lib/io_shuten/mongo.rb",
34
+ "lib/io_shuten/redis.rb",
35
+ "lib/io_shuten/version.rb",
36
+ "spec/examples/logger_spec.rb",
37
+ "spec/lib/base_spec.rb",
38
+ "spec/lib/mongo_spec.rb",
39
+ "spec/lib/redis_spec.rb",
40
+ "spec/spec_helper.rb"
41
+ ]
42
+ s.homepage = "http://github.com/asaaki/io_shuten"
43
+ s.licenses = ["MIT"]
44
+ s.require_paths = ["lib"]
45
+ s.rubygems_version = "1.8.10"
46
+ s.summary = "IO::shuten \u{2013} Use databases as IO handler."
47
+
48
+ if s.respond_to? :specification_version then
49
+ s.specification_version = 3
50
+
51
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
52
+ s.add_runtime_dependency(%q<hiredis>, ["~> 0.4.4"])
53
+ s.add_runtime_dependency(%q<redis>, ["~> 2.2.2"])
54
+ s.add_runtime_dependency(%q<bson_ext>, ["~> 1.5.2"])
55
+ s.add_runtime_dependency(%q<mongo>, ["~> 1.5.2"])
56
+ s.add_development_dependency(%q<rake>, [">= 0"])
57
+ s.add_development_dependency(%q<jeweler>, [">= 0"])
58
+ s.add_development_dependency(%q<rspec>, ["~> 2.8.0"])
59
+ s.add_development_dependency(%q<simplecov>, [">= 0"])
60
+ s.add_development_dependency(%q<simplecov-rcov>, [">= 0"])
61
+ s.add_development_dependency(%q<simplecov-csv>, [">= 0"])
62
+ s.add_development_dependency(%q<pry>, [">= 0"])
63
+ s.add_development_dependency(%q<pry-doc>, [">= 0"])
64
+ else
65
+ s.add_dependency(%q<hiredis>, ["~> 0.4.4"])
66
+ s.add_dependency(%q<redis>, ["~> 2.2.2"])
67
+ s.add_dependency(%q<bson_ext>, ["~> 1.5.2"])
68
+ s.add_dependency(%q<mongo>, ["~> 1.5.2"])
69
+ s.add_dependency(%q<rake>, [">= 0"])
70
+ s.add_dependency(%q<jeweler>, [">= 0"])
71
+ s.add_dependency(%q<rspec>, ["~> 2.8.0"])
72
+ s.add_dependency(%q<simplecov>, [">= 0"])
73
+ s.add_dependency(%q<simplecov-rcov>, [">= 0"])
74
+ s.add_dependency(%q<simplecov-csv>, [">= 0"])
75
+ s.add_dependency(%q<pry>, [">= 0"])
76
+ s.add_dependency(%q<pry-doc>, [">= 0"])
77
+ end
78
+ else
79
+ s.add_dependency(%q<hiredis>, ["~> 0.4.4"])
80
+ s.add_dependency(%q<redis>, ["~> 2.2.2"])
81
+ s.add_dependency(%q<bson_ext>, ["~> 1.5.2"])
82
+ s.add_dependency(%q<mongo>, ["~> 1.5.2"])
83
+ s.add_dependency(%q<rake>, [">= 0"])
84
+ s.add_dependency(%q<jeweler>, [">= 0"])
85
+ s.add_dependency(%q<rspec>, ["~> 2.8.0"])
86
+ s.add_dependency(%q<simplecov>, [">= 0"])
87
+ s.add_dependency(%q<simplecov-rcov>, [">= 0"])
88
+ s.add_dependency(%q<simplecov-csv>, [">= 0"])
89
+ s.add_dependency(%q<pry>, [">= 0"])
90
+ s.add_dependency(%q<pry-doc>, [">= 0"])
91
+ end
92
+ end
93
+
@@ -0,0 +1,77 @@
1
+ # encoding: utf-8
2
+ module IO_shuten
3
+ class Base
4
+
5
+ class NodeNotFound < StandardError; end
6
+
7
+ attr_reader :object_name
8
+ attr :object_content, :object_content_size
9
+
10
+ def initialize(object_name = nil, *args)
11
+ @object_name = object_name
12
+ @object_content = StringIO.new("","w+")
13
+ @object_content_size = @object_content.size
14
+ end
15
+
16
+ class << self
17
+
18
+ def open object_name, *args
19
+ if Base.exists? object_name
20
+ if block_given?
21
+ base = Base.send :load, object_name
22
+ yield(base)
23
+ base.close
24
+
25
+ else
26
+ Base.send :load, object_name
27
+ end
28
+
29
+ else
30
+ raise NodeNotFound
31
+ end
32
+ end
33
+
34
+ def exists? object_name
35
+ false
36
+ end
37
+ alias_method :exist?, :exists?
38
+
39
+ private
40
+
41
+ def load object_name
42
+ obj = Base.new object_name
43
+ obj.send :set_object_content, ""
44
+ obj
45
+ end
46
+ alias_method :load_object, :load
47
+
48
+ end
49
+
50
+ def close
51
+ end
52
+
53
+ def read
54
+ end
55
+
56
+ def each
57
+ end
58
+ alias_method :each_line, :each
59
+ alias_method :lines, :each
60
+
61
+ def write str
62
+ @object_content.puts str.to_s
63
+ end
64
+
65
+ private
66
+
67
+ def set_object_content object_content
68
+ @object_content.string = object_content.to_s
69
+ @object_content_size = @object_content.size
70
+ end
71
+
72
+ def get_object_content
73
+ @object_content.string
74
+ end
75
+
76
+ end
77
+ end
@@ -0,0 +1,6 @@
1
+ # encoding: utf-8
2
+ module IO_shuten
3
+ class Mongo < IO_shuten::Base
4
+
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ # encoding: utf-8
2
+ module IO_shuten
3
+ class Redis < IO_shuten::Base
4
+
5
+ end
6
+ end
@@ -0,0 +1,4 @@
1
+ # encoding: utf-8
2
+ module IO_shuten
3
+ VERSION = [0,0,1,'dev0'].join('.')
4
+ end
data/lib/io_shuten.rb ADDED
@@ -0,0 +1,11 @@
1
+ # encoding: utf-8
2
+ module IO_shuten; end
3
+
4
+ require "io_shuten/base"
5
+ require "io_shuten/redis"
6
+ require "io_shuten/mongo"
7
+
8
+ # handy and short aliases
9
+ IOM = IO::Mongo = IO_shuten::Mongo
10
+ IOR = IO::Redis = IO_shuten::Redis
11
+
@@ -0,0 +1,10 @@
1
+ # encoding: utf-8
2
+ require File.expand_path("../../spec_helper.rb", __FILE__)
3
+ require "logger"
4
+
5
+ describe "Logger" do
6
+ it "accepts an IO_shouten::Base as logdev" do
7
+ logdev = IO_shuten::Base.new("logdev")
8
+ logger = Logger.new(logdev)
9
+ end
10
+ end
@@ -0,0 +1,110 @@
1
+ # encoding: utf-8
2
+ require File.expand_path("../../spec_helper.rb", __FILE__)
3
+
4
+ include IO_shuten
5
+ describe Base do
6
+
7
+ describe "Class Methods" do
8
+
9
+ describe :new do
10
+
11
+ context "without object_name" do
12
+ it "creates a new object with nil name" do
13
+ ios = Base.new
14
+ ios.should be_an(IO_shuten::Base)
15
+ ios.object_name.should be_nil
16
+ end
17
+ end
18
+
19
+ context "with object_name" do
20
+ it "creates a new object with given name" do
21
+ object_name = "foo bar"
22
+ ios = Base.new(object_name)
23
+ ios.should be_an(IO_shuten::Base)
24
+ ios.object_name.should == object_name
25
+ end
26
+ end
27
+
28
+ end
29
+
30
+ describe :open do
31
+
32
+ context "without any args" do
33
+ it "raises ArgumentError" do
34
+ expect { Base.open }.to raise_error(ArgumentError)
35
+ end
36
+ end
37
+
38
+ context "with name only" do
39
+
40
+ context "and object does not exist" do
41
+ it "raises NodeNotFound error" do
42
+ Base.stub(:exists?).and_return(false)
43
+ expect { Base.open("foo bar") }.to raise_error(Base::NodeNotFound)
44
+ end
45
+ end
46
+
47
+ context "and object exists" do
48
+ it "returns the requested object" do
49
+ object_name = "foo bar"
50
+ object_cont = "demo content of object"
51
+ object_mock = double(Base, :object_name => object_name, :object_content => object_cont)
52
+
53
+ Base.should_receive(:exists?).with(object_name).and_return(true)
54
+ Base.should_receive(:load).and_return(object_mock)
55
+
56
+ ios = Base.open(object_name)
57
+
58
+ ios.object_name.should == object_name
59
+ ios.object_content.should == object_cont
60
+ end
61
+ end
62
+ end
63
+
64
+ context "with name and block" do
65
+ it "opens object, yields the block and closes object" do
66
+
67
+ end
68
+ end
69
+
70
+ end # open
71
+
72
+ describe :close do
73
+ it :TODO
74
+ end
75
+
76
+ end # Class Methods
77
+
78
+ describe "Instance Methods" do
79
+
80
+ describe :each do
81
+ context "without block" do
82
+ it "creates an Enumerable for lines"
83
+ end
84
+
85
+ context "with block" do
86
+ it "iterates the lines"
87
+ end
88
+ end
89
+
90
+ describe :each_line do
91
+ it "is an alias to #each"
92
+ end
93
+
94
+ describe :lines do
95
+ it "is an alias to #each"
96
+ end
97
+
98
+ describe :each_byte do
99
+ context "without block" do
100
+ it "creates an Enumerable for bytes"
101
+ end
102
+
103
+ context "with block" do
104
+ it "iterates the bytes"
105
+ end
106
+ end
107
+
108
+ end
109
+
110
+ end
@@ -0,0 +1,7 @@
1
+ # encoding: utf-8
2
+ require File.expand_path("../../spec_helper.rb", __FILE__)
3
+
4
+ include IO_shuten
5
+ describe Mongo do
6
+ it "#TODO"
7
+ end
@@ -0,0 +1,7 @@
1
+ # encoding: utf-8
2
+ require File.expand_path("../../spec_helper.rb", __FILE__)
3
+
4
+ include IO_shuten
5
+ describe Redis do
6
+ it "#TODO"
7
+ end
@@ -0,0 +1,30 @@
1
+ # encoding: utf-8
2
+ require 'simplecov'
3
+
4
+ $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
5
+ require "io_shuten"
6
+
7
+ ### MONKEY PATCH raise
8
+
9
+ # usage: raise my_instance
10
+ # raise :foo
11
+ # raise anything_else_which_is_an_object
12
+ # raise foo.bar.baz
13
+
14
+ class Module
15
+ def alias_method_chain( target, feature )
16
+ alias_method "#{target}_without_#{feature}", target
17
+ alias_method target, "#{target}_with_#{feature}"
18
+ end
19
+ end
20
+
21
+ class Object
22
+ def raise_with_helpfulness(*args)
23
+ raise_without_helpfulness(*args)
24
+ rescue TypeError => e
25
+ raise_without_helpfulness args.first.inspect if ['exception class/object expected', 'exception object expected'].include?(e.to_s)
26
+ raise_without_helpfulness e
27
+ end
28
+ alias_method_chain :raise, :helpfulness
29
+ end
30
+
metadata ADDED
@@ -0,0 +1,205 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: io_shuten
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1.dev0
5
+ prerelease: 6
6
+ platform: ruby
7
+ authors:
8
+ - Christoph Grabo
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-01-21 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: hiredis
16
+ requirement: &20916920 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 0.4.4
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *20916920
25
+ - !ruby/object:Gem::Dependency
26
+ name: redis
27
+ requirement: &20916440 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: 2.2.2
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *20916440
36
+ - !ruby/object:Gem::Dependency
37
+ name: bson_ext
38
+ requirement: &20932340 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: 1.5.2
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *20932340
47
+ - !ruby/object:Gem::Dependency
48
+ name: mongo
49
+ requirement: &20931860 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 1.5.2
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: *20931860
58
+ - !ruby/object:Gem::Dependency
59
+ name: rake
60
+ requirement: &20931380 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *20931380
69
+ - !ruby/object:Gem::Dependency
70
+ name: jeweler
71
+ requirement: &20930900 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: *20930900
80
+ - !ruby/object:Gem::Dependency
81
+ name: rspec
82
+ requirement: &20930420 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ~>
86
+ - !ruby/object:Gem::Version
87
+ version: 2.8.0
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: *20930420
91
+ - !ruby/object:Gem::Dependency
92
+ name: simplecov
93
+ requirement: &20929940 !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ! '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ type: :development
100
+ prerelease: false
101
+ version_requirements: *20929940
102
+ - !ruby/object:Gem::Dependency
103
+ name: simplecov-rcov
104
+ requirement: &20929460 !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: *20929460
113
+ - !ruby/object:Gem::Dependency
114
+ name: simplecov-csv
115
+ requirement: &20928980 !ruby/object:Gem::Requirement
116
+ none: false
117
+ requirements:
118
+ - - ! '>='
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
121
+ type: :development
122
+ prerelease: false
123
+ version_requirements: *20928980
124
+ - !ruby/object:Gem::Dependency
125
+ name: pry
126
+ requirement: &20928500 !ruby/object:Gem::Requirement
127
+ none: false
128
+ requirements:
129
+ - - ! '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: *20928500
135
+ - !ruby/object:Gem::Dependency
136
+ name: pry-doc
137
+ requirement: &20928020 !ruby/object:Gem::Requirement
138
+ none: false
139
+ requirements:
140
+ - - ! '>='
141
+ - !ruby/object:Gem::Version
142
+ version: '0'
143
+ type: :development
144
+ prerelease: false
145
+ version_requirements: *20928020
146
+ description: IO::shuten – Use databases as IO handler like you would do with files
147
+ and streamgem.
148
+ email:
149
+ - chris@dinarrr.com
150
+ executables: []
151
+ extensions: []
152
+ extra_rdoc_files:
153
+ - LICENSE
154
+ - LICENSE.de
155
+ - README.md
156
+ files:
157
+ - .rspec
158
+ - .rvmrc
159
+ - .simplecov
160
+ - Gemfile
161
+ - Gemfile.lock
162
+ - LICENSE
163
+ - LICENSE.de
164
+ - README.md
165
+ - Rakefile
166
+ - io_shuten.gemspec
167
+ - lib/io_shuten.rb
168
+ - lib/io_shuten/base.rb
169
+ - lib/io_shuten/mongo.rb
170
+ - lib/io_shuten/redis.rb
171
+ - lib/io_shuten/version.rb
172
+ - spec/examples/logger_spec.rb
173
+ - spec/lib/base_spec.rb
174
+ - spec/lib/mongo_spec.rb
175
+ - spec/lib/redis_spec.rb
176
+ - spec/spec_helper.rb
177
+ homepage: http://github.com/asaaki/io_shuten
178
+ licenses:
179
+ - MIT
180
+ post_install_message:
181
+ rdoc_options: []
182
+ require_paths:
183
+ - lib
184
+ required_ruby_version: !ruby/object:Gem::Requirement
185
+ none: false
186
+ requirements:
187
+ - - ! '>='
188
+ - !ruby/object:Gem::Version
189
+ version: '0'
190
+ segments:
191
+ - 0
192
+ hash: 1682682368565514466
193
+ required_rubygems_version: !ruby/object:Gem::Requirement
194
+ none: false
195
+ requirements:
196
+ - - ! '>'
197
+ - !ruby/object:Gem::Version
198
+ version: 1.3.1
199
+ requirements: []
200
+ rubyforge_project:
201
+ rubygems_version: 1.8.10
202
+ signing_key:
203
+ specification_version: 3
204
+ summary: IO::shuten – Use databases as IO handler.
205
+ test_files: []