kabuki 0.0.1

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 ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in kabuki.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 TODO: Write your name
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Kabuki
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'kabuki'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install kabuki
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/kabuki.gemspec ADDED
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'kabuki/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "kabuki"
8
+ gem.version = Kabuki::VERSION
9
+ gem.authors = ["Valery Kvon"]
10
+ gem.email = ["addagger@gmail.com"]
11
+ gem.homepage = %q{http://vkvon.ru/projects/kabuki}
12
+ gem.description = %q{Customized dump solution for URL purposes}
13
+ gem.summary = %q{Dump and encrypt arrays, strings, symbols, hashes and other Ruby objects}
14
+
15
+ gem.rubyforge_project = "kabuki"
16
+
17
+ gem.add_development_dependency "activesupport"
18
+
19
+ gem.files = `git ls-files`.split($/)
20
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
21
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
22
+ gem.require_paths = ["lib"]
23
+ gem.licenses = ['MIT']
24
+ end
@@ -0,0 +1,16 @@
1
+ module Kabuki
2
+ class Bundle
3
+ end
4
+ end
5
+
6
+ class Object
7
+ def kabuki
8
+ Base64.strict_encode64(self.kabuki_dump.kabuki_zip.kabuki_encrypt)
9
+ end
10
+ end
11
+
12
+ class String
13
+ def kabuki
14
+ Base64.strict_decode64(self).kabuki_decrypt.kabuki_unzip.kabuki_load
15
+ end
16
+ end
@@ -0,0 +1,36 @@
1
+ module Kabuki
2
+ class Crypt
3
+ def initialize(string, key = nil)
4
+ @key = key||Digest::SHA1.hexdigest("yourpass")
5
+ @string = string
6
+ end
7
+
8
+ def encode
9
+ c = OpenSSL::Cipher::Cipher.new("aes-256-cbc")
10
+ c.encrypt
11
+ c.key = @key
12
+ e = c.update(@string)
13
+ e << c.final
14
+ e
15
+ end
16
+
17
+ def decode
18
+ c = OpenSSL::Cipher::Cipher.new("aes-256-cbc")
19
+ c.decrypt
20
+ c.key = @key
21
+ d = c.update(@string)
22
+ d << c.final
23
+ d
24
+ end
25
+ end
26
+ end
27
+
28
+ class String
29
+ def kabuki_encrypt
30
+ Kabuki::Crypt.new(self).encode
31
+ end
32
+
33
+ def kabuki_decrypt
34
+ Kabuki::Crypt.new(self).decode
35
+ end
36
+ end
@@ -0,0 +1,6 @@
1
+ module Kabuki
2
+ module Extender
3
+ module Array
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module Kabuki
2
+ module Extender
3
+ module Class
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module Kabuki
2
+ module Extender
3
+ module Hash
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module Kabuki
2
+ module Extender
3
+ module Object
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module Kabuki
2
+ module Extender
3
+ module Set
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module Kabuki
2
+ module Extender
3
+ module String
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module Kabuki
2
+ module Extender
3
+ module Symbol
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,31 @@
1
+ require 'kabuki/dump/object'
2
+ require 'kabuki/dump/string'
3
+ require 'kabuki/dump/symbol'
4
+ require 'kabuki/dump/hash'
5
+ require 'kabuki/dump/array'
6
+ require 'kabuki/dump/set'
7
+ require 'kabuki/dump/class'
8
+
9
+ module Kabuki
10
+ class Dump
11
+ def self.encode(object)
12
+ Marshal.dump(object)
13
+ end
14
+
15
+ def self.decode(string)
16
+ Marshal.load(string)
17
+ end
18
+ end
19
+ end
20
+
21
+ class Object
22
+ def kabuki_dump
23
+ Kabuki::Dump.encode(self)
24
+ end
25
+ end
26
+
27
+ class String
28
+ def kabuki_load
29
+ Kabuki::Dump.decode(self)
30
+ end
31
+ end
@@ -0,0 +1,4 @@
1
+ module Kabuki #:nodoc:
2
+ class Engine < ::Rails::Engine #:nodoc:
3
+ end
4
+ end
@@ -0,0 +1,17 @@
1
+ require 'rails'
2
+
3
+ module Kabuki
4
+ class Railtie < ::Rails::Railtie
5
+ config.before_initialize do
6
+ require 'kabuki/dump'
7
+ require 'kabuki/zip'
8
+ require 'kabuki/crypt'
9
+ require 'kabuki/bundle'
10
+ ActiveSupport.on_load :active_record do
11
+ end
12
+ ActiveSupport.on_load :action_view do
13
+ end
14
+ end
15
+
16
+ end
17
+ end
@@ -0,0 +1,3 @@
1
+ module Kabuki
2
+ VERSION = "0.0.1"
3
+ end
data/lib/kabuki/zip.rb ADDED
@@ -0,0 +1,32 @@
1
+ module Kabuki
2
+ class Zip
3
+ def initialize(string)
4
+ @string = string
5
+ end
6
+
7
+ def compress(level=3)
8
+ z = Zlib::Deflate.new(level)
9
+ dst = z.deflate(@string, Zlib::FINISH)
10
+ z.close
11
+ dst
12
+ end
13
+
14
+ def decompress
15
+ zstream = Zlib::Inflate.new
16
+ buf = zstream.inflate(@string)
17
+ zstream.finish
18
+ zstream.close
19
+ buf
20
+ end
21
+ end
22
+ end
23
+
24
+ class String
25
+ def kabuki_zip
26
+ Kabuki::Zip.new(self).compress
27
+ end
28
+
29
+ def kabuki_unzip
30
+ Kabuki::Zip.new(self).decompress
31
+ end
32
+ end
data/lib/kabuki.rb ADDED
@@ -0,0 +1,10 @@
1
+ require "kabuki/version"
2
+
3
+ module Kabuki
4
+ def self.load!
5
+ require 'kabuki/engine'
6
+ require 'kabuki/railtie'
7
+ end
8
+ end
9
+
10
+ Kabuki.load!
metadata ADDED
@@ -0,0 +1,83 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: kabuki
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Valery Kvon
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-01-10 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: activesupport
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ description: Customized dump solution for URL purposes
31
+ email:
32
+ - addagger@gmail.com
33
+ executables: []
34
+ extensions: []
35
+ extra_rdoc_files: []
36
+ files:
37
+ - .gitignore
38
+ - Gemfile
39
+ - LICENSE.txt
40
+ - README.md
41
+ - Rakefile
42
+ - kabuki.gemspec
43
+ - lib/kabuki.rb
44
+ - lib/kabuki/bundle.rb
45
+ - lib/kabuki/crypt.rb
46
+ - lib/kabuki/dump.rb
47
+ - lib/kabuki/dump/array.rb
48
+ - lib/kabuki/dump/class.rb
49
+ - lib/kabuki/dump/hash.rb
50
+ - lib/kabuki/dump/object.rb
51
+ - lib/kabuki/dump/set.rb
52
+ - lib/kabuki/dump/string.rb
53
+ - lib/kabuki/dump/symbol.rb
54
+ - lib/kabuki/engine.rb
55
+ - lib/kabuki/railtie.rb
56
+ - lib/kabuki/version.rb
57
+ - lib/kabuki/zip.rb
58
+ homepage: http://vkvon.ru/projects/kabuki
59
+ licenses:
60
+ - MIT
61
+ post_install_message:
62
+ rdoc_options: []
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ requirements: []
78
+ rubyforge_project: kabuki
79
+ rubygems_version: 1.8.24
80
+ signing_key:
81
+ specification_version: 3
82
+ summary: Dump and encrypt arrays, strings, symbols, hashes and other Ruby objects
83
+ test_files: []