alki-support 0.5.0
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 +7 -0
- data/.gitignore +53 -0
- data/alki-support.gemspec +19 -0
- data/lib/alki/support.rb +55 -0
- data/lib/alki/support/version.rb +5 -0
- metadata +48 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2154479b101fa45965a285e34f6b6e363e4e8e77
|
4
|
+
data.tar.gz: 4777bd20087b31974d40e14358710ec5d8deb285
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0aed4bac3d7fd8df1e9098a1d2021ac50f97fbc9146def685eac94ca78b7a45dcda7ff5313861829fd4db2d3191669696e1a1ba2b476916a7e36907c6976db4c
|
7
|
+
data.tar.gz: 59ed3f0b2a30ea02455faf812b58c08d55368d38205140213d0c83e9e4fa83ca69161aed0122a369efac86d4d5607881dc5ab9599c2d6f805b7ea0954ae5eb0d
|
data/.gitignore
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# Created by .ignore support plugin (hsz.mobi)
|
2
|
+
### Ruby template
|
3
|
+
*.gem
|
4
|
+
*.rbc
|
5
|
+
/.config
|
6
|
+
/coverage/
|
7
|
+
/InstalledFiles
|
8
|
+
/pkg/
|
9
|
+
/spec/reports/
|
10
|
+
/spec/examples.txt
|
11
|
+
/test/tmp/
|
12
|
+
/test/version_tmp/
|
13
|
+
/tmp/
|
14
|
+
|
15
|
+
# Used by dotenv library to load environment variables.
|
16
|
+
# .env
|
17
|
+
|
18
|
+
## Specific to RubyMotion:
|
19
|
+
.dat*
|
20
|
+
.repl_history
|
21
|
+
build/
|
22
|
+
*.bridgesupport
|
23
|
+
build-iPhoneOS/
|
24
|
+
build-iPhoneSimulator/
|
25
|
+
|
26
|
+
## Specific to RubyMotion (use of CocoaPods):
|
27
|
+
#
|
28
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
29
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
30
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
31
|
+
#
|
32
|
+
# vendor/Pods/
|
33
|
+
|
34
|
+
## Documentation cache and generated files:
|
35
|
+
/.yardoc/
|
36
|
+
/_yardoc/
|
37
|
+
/doc/
|
38
|
+
/rdoc/
|
39
|
+
|
40
|
+
## Environment normalization:
|
41
|
+
/.bundle/
|
42
|
+
/vendor/bundle
|
43
|
+
/lib/bundler/man/
|
44
|
+
|
45
|
+
# for a library or gem, you might want to ignore these files since the code is
|
46
|
+
# intended to run in multiple environments; otherwise, check them in:
|
47
|
+
# Gemfile.lock
|
48
|
+
# .ruby-version
|
49
|
+
# .ruby-gemset
|
50
|
+
|
51
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
52
|
+
.rvmrc
|
53
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require_relative 'lib/alki/support/version'
|
3
|
+
|
4
|
+
Gem::Specification.new do |spec|
|
5
|
+
spec.name = "alki-support"
|
6
|
+
spec.version = Alki::Support::VERSION
|
7
|
+
spec.authors = ["Matt Edlefsen"]
|
8
|
+
spec.email = ["matt.edlefsen@gmail.com"]
|
9
|
+
spec.summary = %q{Alki support methods}
|
10
|
+
spec.description = %q{Various helper methods for Alki}
|
11
|
+
spec.homepage = "https://github.com/medlefsen/alki-support"
|
12
|
+
spec.license = "MIT"
|
13
|
+
|
14
|
+
spec.files = `git ls-files -z`.split("\x0")
|
15
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
16
|
+
spec.bindir = 'exe'
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
end
|
data/lib/alki/support.rb
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'alki/support/version'
|
2
|
+
|
3
|
+
module Alki
|
4
|
+
module Support
|
5
|
+
def self.load_class(klass)
|
6
|
+
if klass.is_a?(String)
|
7
|
+
name = klass
|
8
|
+
class_name = classify klass
|
9
|
+
klass = constantize class_name
|
10
|
+
unless klass
|
11
|
+
require name
|
12
|
+
klass = constantize class_name
|
13
|
+
end
|
14
|
+
end
|
15
|
+
klass
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.classify(str)
|
19
|
+
str.split('/').map do |c|
|
20
|
+
c.split('_').map{|n| n.capitalize }.join('')
|
21
|
+
end.join('::')
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.constantize(name)
|
25
|
+
name.split('::').inject(Object) do |obj,el|
|
26
|
+
return nil unless obj.const_defined? el, false
|
27
|
+
obj.const_get el, false
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.caller_path(root,caller_depth: 1)
|
32
|
+
path = caller_locations(caller_depth+1,1)[0].absolute_path
|
33
|
+
path_name path, root
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.path_name(path,root=File.dirname(path))
|
37
|
+
root = File.join(root,'')
|
38
|
+
if path.start_with?(root) && path.end_with?('.rb')
|
39
|
+
path[root.size..-4]
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.find_root(path)
|
44
|
+
old_dir = File.absolute_path(path)
|
45
|
+
dir = File.dirname(old_dir)
|
46
|
+
until dir == old_dir || yield(dir)
|
47
|
+
old_dir = dir
|
48
|
+
dir = File.dirname(old_dir)
|
49
|
+
end
|
50
|
+
if dir != old_dir
|
51
|
+
dir
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
metadata
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: alki-support
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.5.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Matt Edlefsen
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-12-02 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Various helper methods for Alki
|
14
|
+
email:
|
15
|
+
- matt.edlefsen@gmail.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- ".gitignore"
|
21
|
+
- alki-support.gemspec
|
22
|
+
- lib/alki/support.rb
|
23
|
+
- lib/alki/support/version.rb
|
24
|
+
homepage: https://github.com/medlefsen/alki-support
|
25
|
+
licenses:
|
26
|
+
- MIT
|
27
|
+
metadata: {}
|
28
|
+
post_install_message:
|
29
|
+
rdoc_options: []
|
30
|
+
require_paths:
|
31
|
+
- lib
|
32
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '0'
|
37
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
requirements: []
|
43
|
+
rubyforge_project:
|
44
|
+
rubygems_version: 2.5.1
|
45
|
+
signing_key:
|
46
|
+
specification_version: 4
|
47
|
+
summary: Alki support methods
|
48
|
+
test_files: []
|