verning 0.0.2

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 92808fc502189d69f6e19fbd1aa55d3d7b591c47
4
+ data.tar.gz: a103f175629a9a7a07e5bb833851c6a081aef0c0
5
+ SHA512:
6
+ metadata.gz: f6cc9da0edf49fe79dcbb7c1a4e54d72b230fc01f84c6459e2d3c8a6c63ef4a318a5c17fccecb7727d22091b5a65f37804e48ac64d0a6ea2897fdcd061cc3377
7
+ data.tar.gz: c44a3128031486c8268c5031edcd49ecef9e7c19019ddcdd1edac0a617c4e58ac4dea5460e909488dfa792499d0a670649d2d83eee0946c9f0ae9d937b1caae8
data/.gitignore ADDED
@@ -0,0 +1,21 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ coverage
6
+ InstalledFiles
7
+ lib/bundler/man
8
+ pkg
9
+ rdoc
10
+ spec/reports
11
+ test/tmp
12
+ test/version_tmp
13
+ tmp
14
+ vendor
15
+ .ruby-version
16
+ .ruby-gemset
17
+
18
+ # YARD artifacts
19
+ .yardoc
20
+ _yardoc
21
+ doc/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format documentation
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+
5
+ script: bundle exec rspec spec
6
+
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,35 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ verning (0.0.2)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ coderay (1.1.0)
10
+ diff-lcs (1.2.5)
11
+ method_source (0.8.2)
12
+ pry (0.9.12.6)
13
+ coderay (~> 1.0)
14
+ method_source (~> 0.8)
15
+ slop (~> 3.4)
16
+ rake (0.9.6)
17
+ rspec (2.14.1)
18
+ rspec-core (~> 2.14.0)
19
+ rspec-expectations (~> 2.14.0)
20
+ rspec-mocks (~> 2.14.0)
21
+ rspec-core (2.14.8)
22
+ rspec-expectations (2.14.5)
23
+ diff-lcs (>= 1.1.3, < 2.0)
24
+ rspec-mocks (2.14.6)
25
+ slop (3.5.0)
26
+
27
+ PLATFORMS
28
+ ruby
29
+
30
+ DEPENDENCIES
31
+ bundler (~> 1.3)
32
+ pry (~> 0.9)
33
+ rake (~> 0.9)
34
+ rspec (~> 2.14)
35
+ verning!
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 eccyan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,38 @@
1
+ Verning
2
+ =========
3
+ Versioning for methods, modules or classes
4
+
5
+ [![Build Status](https://travis-ci.org/eccyan/versioned.svg?branch=master)](https://travis-ci.org/eccyan/versioned)
6
+
7
+ ## Install
8
+ ```sh
9
+ gem install vernign
10
+ ```
11
+
12
+ ## Reference
13
+ ### versioned_method
14
+ Select a method that matches the conditions given with block.
15
+ ```ruby
16
+ require "verning"
17
+
18
+ class Klass
19
+ RELEASE_DATE = Date.parse("2014-3-26")
20
+
21
+ def foo
22
+ :foo
23
+ end
24
+
25
+ def foo_fearture
26
+ :foo_feature
27
+ end
28
+
29
+ versioned_method :foo, :foo_feature do
30
+ Date.today >= RELEASE_DATE
31
+ end
32
+ end
33
+ ```
34
+
35
+ # License
36
+ Verning is released under the MIT license:
37
+
38
+ www.opensource.org/licenses/MIT
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/lib/verning.rb ADDED
@@ -0,0 +1,6 @@
1
+ require "verning/version"
2
+ require "verning/core_ext"
3
+
4
+ module Verning
5
+ # Your code goes here...
6
+ end
@@ -0,0 +1,4 @@
1
+ Dir["#{File.dirname(__FILE__)}/core_ext/*.rb"].sort.each do |path|
2
+ next if File.basename(path, '.rb') == 'logger'
3
+ require "verning/core_ext/#{File.basename(path, '.rb')}"
4
+ end
@@ -0,0 +1 @@
1
+ require "verning/core_ext/module/versioned_method"
@@ -0,0 +1,14 @@
1
+
2
+ class Module
3
+ # Select a method that matches the conditions given with block.
4
+ #
5
+ # versioned_method :downed, :upped do
6
+ # Time.now > "2013-04-01"
7
+ # end
8
+ #
9
+ def versioned_method(downed, upped, key = nil)
10
+ return if block_given? && yield.!
11
+
12
+ alias_method downed, upped
13
+ end
14
+ end
@@ -0,0 +1,3 @@
1
+ module Verning
2
+ VERSION = "0.0.2"
3
+ end
@@ -0,0 +1,28 @@
1
+ require 'spec_helper'
2
+
3
+ describe Module do
4
+ class TestClass
5
+ def upped; :upped end
6
+ def downed; :downed end
7
+ end
8
+
9
+ before do
10
+ TestClass.send(:versioned_method, :downed, :upped) do condition end
11
+ end
12
+
13
+ describe "when not matches the conditions"do
14
+ let(:condition) { false }
15
+
16
+ it "not aliased target method" do
17
+ expect(TestClass.new.downed).to eq(:downed)
18
+ end
19
+ end
20
+
21
+ describe "when matches the conditions"do
22
+ let(:condition) { true }
23
+
24
+ it "aliased target method" do
25
+ expect(TestClass.new.downed).to eq(:upped)
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,8 @@
1
+ require 'bundler/setup'
2
+ Bundler.setup
3
+
4
+ require 'pry'
5
+ require 'verning'
6
+
7
+ RSpec.configure do |config|
8
+ end
data/verning.gemspec ADDED
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'verning/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "verning"
8
+ spec.version = Verning::VERSION
9
+ spec.authors = ["eccyan"]
10
+ spec.email = ["g00.eccyan@gmail.com"]
11
+ spec.description = %q{versioning for methods, modules or classes}
12
+ spec.summary = %q{versioning helper}
13
+ spec.homepage = "https://github.com/eccyan/verning"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake", "~> 0.9"
23
+ spec.add_development_dependency "pry", "~> 0.9"
24
+ spec.add_development_dependency "rspec", "~> 2.14"
25
+ end
metadata ADDED
@@ -0,0 +1,118 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: verning
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - eccyan
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-03-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '0.9'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '0.9'
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '0.9'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '0.9'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '2.14'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '2.14'
69
+ description: versioning for methods, modules or classes
70
+ email:
71
+ - g00.eccyan@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - .gitignore
77
+ - .rspec
78
+ - .travis.yml
79
+ - Gemfile
80
+ - Gemfile.lock
81
+ - LICENSE
82
+ - README.md
83
+ - Rakefile
84
+ - lib/verning.rb
85
+ - lib/verning/core_ext.rb
86
+ - lib/verning/core_ext/module.rb
87
+ - lib/verning/core_ext/module/versioned_method.rb
88
+ - lib/verning/version.rb
89
+ - spec/core_ext/module/versioned_method_spec.rb
90
+ - spec/spec_helper.rb
91
+ - verning.gemspec
92
+ homepage: https://github.com/eccyan/verning
93
+ licenses:
94
+ - MIT
95
+ metadata: {}
96
+ post_install_message:
97
+ rdoc_options: []
98
+ require_paths:
99
+ - lib
100
+ required_ruby_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - '>='
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ required_rubygems_version: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ requirements: []
111
+ rubyforge_project:
112
+ rubygems_version: 2.2.2
113
+ signing_key:
114
+ specification_version: 4
115
+ summary: versioning helper
116
+ test_files:
117
+ - spec/core_ext/module/versioned_method_spec.rb
118
+ - spec/spec_helper.rb