infraruby-base 3.7.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 761c5238d43953a57269b64ce03bd32250739963
4
+ data.tar.gz: 61b090c080d819e42831b5e2b499efb6be488282
5
+ SHA512:
6
+ metadata.gz: 660fc882cbcf9914b22b138aacf1c275f3ed684f7f45ba8bc88d57579fea2f7edb2d894f485ac9f468b654e8796edaa3cc71e3d084454e357761f818c2137d5d
7
+ data.tar.gz: 3b3319590eec7e45a1966de64f906a402732e0a22cea9ba1b007e373eb436064948ff2db846d8c2e4bc94f665da4c66d2e24d8f54fda69e801412659f600f80a
@@ -0,0 +1,19 @@
1
+ Copyright (C) 2011-2015 InfraRuby Vision
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a
4
+ copy of this software and associated documentation files (the "Software"),
5
+ to deal in the Software without restriction, including without limitation
6
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
7
+ and/or sell copies of the Software, and to permit persons to whom the
8
+ Software is furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
19
+ DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,23 @@
1
+ InfraRuby base for Ruby interpreters
2
+ ====================================
3
+
4
+ This gem provides the InfraRuby base for Ruby interpreters.
5
+
6
+
7
+ Example
8
+ -------
9
+
10
+ require "infraruby-base"
11
+
12
+ InfraRuby.load_parent_library(__dir__)
13
+
14
+
15
+ Support
16
+ -------
17
+
18
+ InfraRuby Vision
19
+ rubygems@infraruby.com
20
+
21
+ http://infraruby.com/
22
+ https://github.com/InfraRuby
23
+ https://twitter.com/InfraRuby
@@ -0,0 +1,14 @@
1
+ Gem::Specification.new do |s|
2
+ s.platform = "ruby"
3
+ s.name = "infraruby-base"
4
+ s.version = "3.7.1"
5
+ s.licenses = ["MIT"]
6
+ s.author = "InfraRuby Vision"
7
+ s.email = "rubygems@infraruby.com"
8
+ s.homepage = "http://infraruby.com/"
9
+ s.summary = "InfraRuby base for Ruby interpreters"
10
+ s.description = "InfraRuby base for Ruby interpreters"
11
+ s.files = Dir["**/*"]
12
+ s.add_development_dependency "infraruby-task", "~> 3.7"
13
+ s.add_development_dependency "rspec", "~> 3.0"
14
+ end
@@ -0,0 +1,115 @@
1
+ module Kernel
2
+ def __dir__
3
+ filename = caller[0][/^(.*):/, 1]
4
+ return File.expand_path(File.dirname(filename))
5
+ end
6
+ end
7
+
8
+ module InfraRuby
9
+ class << self
10
+ def if(c)
11
+ yield if c
12
+ return
13
+ end
14
+ end
15
+
16
+ class << self
17
+ def system!(command, *args)
18
+ success = Kernel.system(command, *args)
19
+ if success.nil?
20
+ raise RuntimeError, "command not found: #{command}"
21
+ end
22
+ return success
23
+ end
24
+ end
25
+
26
+ class << self
27
+ def load_gemspec
28
+ files = Dir["*.gemspec"]
29
+ case files.size
30
+ when 0
31
+ return nil
32
+ when 1
33
+ return Gem::Specification.load(files.first)
34
+ else
35
+ raise Gem::LoadError, "multiple gemspecs in current directory"
36
+ end
37
+ end
38
+
39
+ def gemspec_name
40
+ spec = load_gemspec
41
+ if spec.nil?
42
+ return nil
43
+ end
44
+ return spec.name
45
+ end
46
+
47
+ def with_clean_env(&block)
48
+ if defined?(Bundler)
49
+ Bundler.with_clean_env(&block)
50
+ else
51
+ block.call
52
+ end
53
+ return
54
+ end
55
+ end
56
+
57
+ class << self
58
+ def each_library_name(dir)
59
+ path = File.join(dir, "manifest.txt")
60
+ begin
61
+ data = File.read(path)
62
+ rescue Errno::ENOENT
63
+ yield "**/*.rb"
64
+ return
65
+ end
66
+ data.each_line do |line|
67
+ yield line.strip
68
+ end
69
+ return
70
+ end
71
+
72
+ def each_library_glob(dir)
73
+ each_library_name(dir) do |name|
74
+ yield File.join(dir, "meta-", name)
75
+ yield File.join(dir, "ruby", name)
76
+ yield File.join(dir, "meta+", name)
77
+ end
78
+ return
79
+ end
80
+
81
+ def each_library_path(dir)
82
+ each_library_glob(dir) do |glob|
83
+ paths = Dir.glob(glob)
84
+ paths.sort!
85
+ paths.each do |path|
86
+ yield path
87
+ end
88
+ end
89
+ return
90
+ end
91
+
92
+ def library_paths(dir)
93
+ paths = []
94
+ each_library_path(dir) do |path|
95
+ paths.push(path)
96
+ end
97
+ paths.uniq!
98
+ return paths
99
+ end
100
+
101
+ def load_library(dir)
102
+ library_paths(dir).each do |path|
103
+ load(path) if File.exists?(path)
104
+ end
105
+ return
106
+ end
107
+
108
+ def load_parent_library(dir)
109
+ load_library(File.dirname(dir))
110
+ return
111
+ end
112
+ end
113
+ end
114
+
115
+ InfraRuby.load_parent_library(__dir__)
@@ -0,0 +1,3 @@
1
+ class Class
2
+ alias_method :__new__, :new
3
+ end
@@ -0,0 +1,33 @@
1
+ class Object
2
+ NIX = Object.new
3
+
4
+ def nix
5
+ return NIX
6
+ end
7
+
8
+ def nix?
9
+ return equal?(NIX)
10
+ end
11
+
12
+ def not_nix?
13
+ return !nix?
14
+ end
15
+
16
+ def is_a!(c)
17
+ unless is_a?(c)
18
+ raise TypeError
19
+ end
20
+ return self
21
+ end
22
+
23
+ def not_nil!
24
+ if nil?
25
+ raise TypeError
26
+ end
27
+ return self
28
+ end
29
+
30
+ def not_nil?
31
+ return !nil?
32
+ end
33
+ end
metadata ADDED
@@ -0,0 +1,77 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: infraruby-base
3
+ version: !ruby/object:Gem::Version
4
+ version: 3.7.1
5
+ platform: ruby
6
+ authors:
7
+ - InfraRuby Vision
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-06-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: infraruby-task
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.0'
41
+ description: InfraRuby base for Ruby interpreters
42
+ email: rubygems@infraruby.com
43
+ executables: []
44
+ extensions: []
45
+ extra_rdoc_files: []
46
+ files:
47
+ - MIT-LICENSE
48
+ - README.md
49
+ - infraruby-base.gemspec
50
+ - lib/infraruby-base.rb
51
+ - ruby/Class.rb
52
+ - ruby/Object.rb
53
+ homepage: http://infraruby.com/
54
+ licenses:
55
+ - MIT
56
+ metadata: {}
57
+ post_install_message:
58
+ rdoc_options: []
59
+ require_paths:
60
+ - lib
61
+ required_ruby_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ requirements: []
72
+ rubyforge_project:
73
+ rubygems_version: 2.2.2
74
+ signing_key:
75
+ specification_version: 4
76
+ summary: InfraRuby base for Ruby interpreters
77
+ test_files: []