rend-core 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +26 -0
- data/README.md +27 -0
- data/Rakefile +9 -0
- data/ZEND_FRAMEWORK_LICENSE.txt +27 -0
- data/lib/rend/core/exception.rb +6 -0
- data/lib/rend/core/helpers/php.rb +29 -0
- data/lib/rend/core/version.rb +7 -0
- data/lib/rend/core.rb +13 -0
- data/rend-core.gemspec +24 -0
- metadata +95 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
Copyright (c) 1999 - 2013, Daniel Doezema All rights reserved.
|
2
|
+
|
3
|
+
Redistribution and use in source and binary forms, with or without modification,
|
4
|
+
are permitted provided that the following conditions are met:
|
5
|
+
|
6
|
+
* Redistributions of source code must retain the above copyright notice, this
|
7
|
+
list of conditions and the following disclaimer.
|
8
|
+
|
9
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
10
|
+
this list of conditions and the following disclaimer in the documentation
|
11
|
+
and/or other materials provided with the distribution.
|
12
|
+
|
13
|
+
* The names of the contributors and/or copyright holder may not be used to
|
14
|
+
endorse or promote products derived from this software without specific
|
15
|
+
prior written permission.
|
16
|
+
|
17
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND
|
18
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
19
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
20
|
+
DISCLAIMED. IN NO EVENT SHALL DANIEL DOEZEMA BE LIABLE FOR ANY DIRECT, INDIRECT,
|
21
|
+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
22
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
23
|
+
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
24
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
25
|
+
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
26
|
+
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.md
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# Rend Core
|
2
|
+
|
3
|
+
Rend-Core is required by all `rend-*` gems. It contains namespacing, helpers, exceptions, and other classes/modules that are shared across dependent gems.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
gem install rend # for rend-core and all rspec-* gems
|
8
|
+
gem install rend-core # for rend-core gem only
|
9
|
+
|
10
|
+
|
11
|
+
## Contributing
|
12
|
+
|
13
|
+
1. Fork it
|
14
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
15
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
16
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
17
|
+
5. Create new Pull Request
|
18
|
+
|
19
|
+
## Licensing
|
20
|
+
|
21
|
+
* All ported Ruby code and assoicated 'Rend' gems are under a simple [New-BSD License](http://dan.doezema.com/licenses/new-bsd).
|
22
|
+
* Original PHP code is licensed under [Zend's New-BSD License](http://framework.zend.com/license/).
|
23
|
+
* This license can be found in `./ZEND_FRAMEWORK_LICENSE.txt`
|
24
|
+
|
25
|
+
## Acknowledgements
|
26
|
+
* This project is **not** associated with, or endorsed by, Zend Technologies USA, Inc., nor any of its contributors.
|
27
|
+
* Rend's modular design was heavily influced by [RSpec](https://github.com/rspec/rspec) approach.
|
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
New BSD License
|
2
|
+
Copyright (c) 2005-2013, Zend Technologies USA, Inc. All rights reserved.
|
3
|
+
|
4
|
+
Redistribution and use in source and binary forms, with or without modification,
|
5
|
+
are permitted provided that the following conditions are met:
|
6
|
+
|
7
|
+
* Redistributions of source code must retain the above copyright notice, this
|
8
|
+
list of conditions and the following disclaimer.
|
9
|
+
|
10
|
+
* Redistributions in binary form must reproduce the above copyright notice, this
|
11
|
+
list of conditions and the following disclaimer in the documentation and/or
|
12
|
+
other materials provided with the distribution.
|
13
|
+
|
14
|
+
* Neither the name of Zend Technologies USA, Inc. nor the names of its
|
15
|
+
contributors may be used to endorse or promote products derived from this
|
16
|
+
software without specific prior written permission.
|
17
|
+
|
18
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
19
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
20
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
21
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
22
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
23
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
24
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
25
|
+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
26
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
27
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Rend
|
2
|
+
module Core
|
3
|
+
module Helpers
|
4
|
+
module Php
|
5
|
+
|
6
|
+
# Replicate PHP Type Hinting
|
7
|
+
#
|
8
|
+
# function juice(Fruit $orange, PulpType $pulp = nil)
|
9
|
+
#
|
10
|
+
# => Can not we written as...
|
11
|
+
#
|
12
|
+
# def juice(orange, pulp)
|
13
|
+
# type_hint! Fruit, orange, :is_required => true
|
14
|
+
# type_hint! PulpType, pulp
|
15
|
+
# end
|
16
|
+
def type_hint!(klass, obj, options = {})
|
17
|
+
is_required = options.fetch(:is_required, false)
|
18
|
+
return nil if !is_required && obj.nil?
|
19
|
+
# Should throw exception up the chain from the class it's mixed into.
|
20
|
+
exception = self.class.const_defined?("Exception") ? self.class.const_get("Exception") : Rend::Core::Exception
|
21
|
+
unless obj.class <= klass
|
22
|
+
raise exception, "PHP TypeHint: #{obj.class.name} is not an instance of #{klass.name}"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/rend/core.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require_rend = if defined?(require_relative)
|
2
|
+
lambda { |path| require_relative path }
|
3
|
+
else
|
4
|
+
lambda { |path| require "rend/#{path}" }
|
5
|
+
end
|
6
|
+
|
7
|
+
require_rend['core/exception']
|
8
|
+
require_rend['core/helpers/php']
|
9
|
+
|
10
|
+
module Rend
|
11
|
+
module Core
|
12
|
+
end
|
13
|
+
end
|
data/rend-core.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'rend/core/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "rend-core"
|
8
|
+
spec.version = Rend::Core::Version::STRING
|
9
|
+
spec.authors = ["Daniel Doezema"]
|
10
|
+
spec.email = ["daniel.doezema@gmail.com"]
|
11
|
+
spec.description = "Zend Framework components ported to Ruby -- Core Gem."
|
12
|
+
spec.summary = "rend-core-#{Rend::Core::Version::STRING}"
|
13
|
+
spec.homepage = "https://github.com/veloper/rend-core"
|
14
|
+
spec.license = "New-BSD"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.files += ["LICENSE.txt", "ZEND_FRAMEWORK_LICENSE.txt"]
|
18
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
23
|
+
spec.add_development_dependency "rake"
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rend-core
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Daniel Doezema
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-05-31 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.3'
|
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: '1.3'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rake
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
description: Zend Framework components ported to Ruby -- Core Gem.
|
47
|
+
email:
|
48
|
+
- daniel.doezema@gmail.com
|
49
|
+
executables: []
|
50
|
+
extensions: []
|
51
|
+
extra_rdoc_files: []
|
52
|
+
files:
|
53
|
+
- .gitignore
|
54
|
+
- Gemfile
|
55
|
+
- LICENSE.txt
|
56
|
+
- README.md
|
57
|
+
- Rakefile
|
58
|
+
- ZEND_FRAMEWORK_LICENSE.txt
|
59
|
+
- lib/rend/core.rb
|
60
|
+
- lib/rend/core/exception.rb
|
61
|
+
- lib/rend/core/helpers/php.rb
|
62
|
+
- lib/rend/core/version.rb
|
63
|
+
- rend-core.gemspec
|
64
|
+
homepage: https://github.com/veloper/rend-core
|
65
|
+
licenses:
|
66
|
+
- New-BSD
|
67
|
+
post_install_message:
|
68
|
+
rdoc_options: []
|
69
|
+
require_paths:
|
70
|
+
- lib
|
71
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
segments:
|
78
|
+
- 0
|
79
|
+
hash: -3314242463834356054
|
80
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
segments:
|
87
|
+
- 0
|
88
|
+
hash: -3314242463834356054
|
89
|
+
requirements: []
|
90
|
+
rubyforge_project:
|
91
|
+
rubygems_version: 1.8.25
|
92
|
+
signing_key:
|
93
|
+
specification_version: 3
|
94
|
+
summary: rend-core-0.0.1
|
95
|
+
test_files: []
|