tcravit_ruby_lib 0.0.4 → 0.0.6
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/CHANGELOG.md
CHANGED
data/lib/tcravit_ruby_lib.rb
CHANGED
@@ -0,0 +1,17 @@
|
|
1
|
+
###########################################################################
|
2
|
+
# A bit of ruby hackery to enable the script to be run directly
|
3
|
+
# from the command line, as well as included into other code.
|
4
|
+
# (Courtesy of elliottcable).
|
5
|
+
#
|
6
|
+
# Not autoloaded by the Gem; require 'tcravit_ruby_lib/on_execute' to pull
|
7
|
+
# it in.
|
8
|
+
###########################################################################
|
9
|
+
|
10
|
+
module Kernel
|
11
|
+
def on_execute
|
12
|
+
calling_file = caller.first.split(':').first
|
13
|
+
if File.expand_path(calling_file) == File.expand_path($0)
|
14
|
+
yield
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module TcravitRubyLib
|
2
|
+
module Utility
|
3
|
+
extend self
|
4
|
+
|
5
|
+
def random_alphanumeric(size=16)
|
6
|
+
alphanumerics = [('0'..'9'),('A'..'Z'),('a'..'z')].map {|range| range.to_a}.flatten
|
7
|
+
(0...size).map { alphanumerics[Kernel.rand(alphanumerics.size)] }.join
|
8
|
+
end
|
9
|
+
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
describe "TcravitRubyLib::Utility" do
|
2
|
+
it "random_alphanumeric() should return a random string of the correct length" do
|
3
|
+
s = TcravitRubyLib::Utility.random_alphanumeric(16)
|
4
|
+
s.should_not be_nil
|
5
|
+
s.length.should == 16
|
6
|
+
s.should match(/^[A-Za-z0-9]+$/)
|
7
|
+
end
|
8
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tcravit_ruby_lib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-12-03 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70166954625060 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70166954625060
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &70166954623600 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70166954623600
|
36
36
|
description:
|
37
37
|
email:
|
38
38
|
- tcravit@taylored-software.com
|
@@ -49,10 +49,13 @@ files:
|
|
49
49
|
- lib/tcravit_ruby_lib.rb
|
50
50
|
- lib/tcravit_ruby_lib/app_config.rb
|
51
51
|
- lib/tcravit_ruby_lib/config_searcher.rb
|
52
|
+
- lib/tcravit_ruby_lib/on_execute.rb
|
53
|
+
- lib/tcravit_ruby_lib/utility.rb
|
52
54
|
- lib/tcravit_ruby_lib/version.rb
|
53
55
|
- spec/spec_helper.rb
|
54
56
|
- spec/tcravit_ruby_lib/app_config_spec.rb
|
55
57
|
- spec/tcravit_ruby_lib/config_searcher_spec.rb
|
58
|
+
- spec/tcravit_ruby_lib/utility_spec.rb
|
56
59
|
- tcravit_ruby_lib.gemspec
|
57
60
|
homepage: ''
|
58
61
|
licenses: []
|
@@ -82,4 +85,5 @@ test_files:
|
|
82
85
|
- spec/spec_helper.rb
|
83
86
|
- spec/tcravit_ruby_lib/app_config_spec.rb
|
84
87
|
- spec/tcravit_ruby_lib/config_searcher_spec.rb
|
88
|
+
- spec/tcravit_ruby_lib/utility_spec.rb
|
85
89
|
has_rdoc:
|