dohutil 0.2.11 → 0.2.12
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/{doh → dohutil}/app/cli.rb +0 -0
- data/lib/{doh → dohutil}/app/init_from_prog.rb +0 -0
- data/lib/{doh → dohutil}/app/init_from_pwd.rb +0 -0
- data/lib/{doh → dohutil}/app/origin.rb +0 -0
- data/lib/dohutil/app/util.rb +17 -0
- data/lib/{doh → dohutil}/array_to_hash.rb +0 -0
- data/lib/{doh → dohutil}/class_basename.rb +0 -0
- data/lib/{doh → dohutil}/config.rb +6 -5
- data/lib/{doh → dohutil}/core_ext/bigdecimal.rb +0 -0
- data/lib/{doh → dohutil}/core_ext/boolean.rb +0 -0
- data/lib/{doh → dohutil}/core_ext/date.rb +0 -0
- data/lib/{doh → dohutil}/core_ext/datewithtime.rb +0 -0
- data/lib/{doh → dohutil}/core_ext/dir.rb +0 -0
- data/lib/{doh → dohutil}/core_ext/force_deep_copy.rb +0 -0
- data/lib/{doh → dohutil}/core_ext/hash.rb +0 -0
- data/lib/{doh → dohutil}/core_ext/inspect.rb +0 -0
- data/lib/{doh → dohutil}/core_ext/string.rb +0 -0
- data/lib/{doh → dohutil}/current_date.rb +8 -8
- data/lib/{doh → dohutil}/env.rb +0 -0
- data/lib/{doh → dohutil}/password_helper.rb +0 -0
- data/lib/{doh → dohutil}/to_display.rb +5 -4
- data/test/core_ext/bigdecimal.dt.rb +1 -1
- data/test/core_ext/date.dt.rb +1 -1
- data/test/core_ext/datewithtime.dt.rb +1 -1
- data/test/core_ext/force_deep_copy.dt.rb +1 -1
- data/test/core_ext/string.dt.rb +1 -1
- metadata +28 -28
- data/lib/doh/app/util.rb +0 -16
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'dohroot'
|
2
|
+
|
3
|
+
module DohApp
|
4
|
+
extend self
|
5
|
+
|
6
|
+
def require_custom_config
|
7
|
+
raise Doh::DohRootNotFoundException if !Doh.root
|
8
|
+
path = File.expand_path(File.join(Doh.root, 'config/dohapp.rb'))
|
9
|
+
require(path) if File.exist?(path)
|
10
|
+
end
|
11
|
+
|
12
|
+
def init_from_file(filepath)
|
13
|
+
Doh.find_root_from_file(filepath)
|
14
|
+
DohApp.require_custom_config
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
File without changes
|
File without changes
|
@@ -1,19 +1,20 @@
|
|
1
|
-
require '
|
1
|
+
require 'dohroot'
|
2
2
|
|
3
3
|
module Doh
|
4
|
+
extend self
|
4
5
|
|
5
|
-
def
|
6
|
-
path = File.join(Doh
|
6
|
+
def load_config_file(name)
|
7
|
+
path = File.join(Doh.root, 'config', name) + '.rb'
|
7
8
|
return false unless File.exist?(path)
|
8
9
|
require(path)
|
9
10
|
true
|
10
11
|
end
|
11
12
|
|
12
|
-
def
|
13
|
+
def config
|
13
14
|
@config ||= {}
|
14
15
|
end
|
15
16
|
|
16
|
-
def
|
17
|
+
def get_required_config_value(value, desc)
|
17
18
|
raise "Attempt to get configuration value: #{value.inspect}, but none exists. #{desc}" if !config.key?(value)
|
18
19
|
config[value]
|
19
20
|
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,34 +1,34 @@
|
|
1
|
-
require '
|
1
|
+
require 'dohutil/core_ext/datewithtime'
|
2
2
|
|
3
3
|
module Doh
|
4
|
-
|
4
|
+
extend self
|
5
5
|
@current_date_stack = []
|
6
6
|
|
7
|
-
def
|
7
|
+
def current_date(dflt = Date.today)
|
8
8
|
return dflt if @current_date_stack.empty?
|
9
9
|
@current_date_stack.last.to_date
|
10
10
|
end
|
11
11
|
|
12
|
-
def
|
12
|
+
def current_datetime(dflt = DateTime.zow)
|
13
13
|
return dflt if @current_date_stack.empty?
|
14
14
|
cdo = @current_date_stack.last
|
15
15
|
return cdo if cdo.respond_to?(:hour)
|
16
16
|
DateTime.new(cdo.year, cdo.month, cdo.day, dflt.hour, dflt.min, dflt.sec, dflt.zone)
|
17
17
|
end
|
18
18
|
|
19
|
-
def
|
19
|
+
def push_current_date(date_obj)
|
20
20
|
@current_date_stack.push(date_obj)
|
21
21
|
end
|
22
22
|
|
23
|
-
def
|
23
|
+
def pop_current_date
|
24
24
|
@current_date_stack.pop
|
25
25
|
end
|
26
26
|
|
27
|
-
def
|
27
|
+
def clear_current_date
|
28
28
|
@current_date_stack.clear
|
29
29
|
end
|
30
30
|
|
31
|
-
def
|
31
|
+
def date_as(date_obj)
|
32
32
|
push_current_date(date_obj)
|
33
33
|
begin
|
34
34
|
retval = yield
|
data/lib/{doh → dohutil}/env.rb
RENAMED
File without changes
|
File without changes
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'dohutil/core_ext/bigdecimal'
|
2
2
|
|
3
3
|
class Object
|
4
4
|
def to_display
|
@@ -43,8 +43,9 @@ class BigDecimal
|
|
43
43
|
end
|
44
44
|
|
45
45
|
module Doh
|
46
|
+
extend self
|
46
47
|
|
47
|
-
def
|
48
|
+
def display_phone(str, html_format = false)
|
48
49
|
return str unless str.to_s.size == 10
|
49
50
|
formatted = "#{str[0..2]}-#{str[3..5]}-#{str[6..9]}"
|
50
51
|
if html_format
|
@@ -54,12 +55,12 @@ def self.display_phone(str, html_format = false)
|
|
54
55
|
end
|
55
56
|
end
|
56
57
|
|
57
|
-
def
|
58
|
+
def display_postal(str)
|
58
59
|
return str unless str.to_s.size == 9
|
59
60
|
return str[0..4] + '-' + str[5..8]
|
60
61
|
end
|
61
62
|
|
62
|
-
def
|
63
|
+
def display_ssn(str)
|
63
64
|
return str unless str.to_s.size == 9
|
64
65
|
str[0..2] + '-' + str[3..4] + '-' + str[5..8]
|
65
66
|
end
|
data/test/core_ext/date.dt.rb
CHANGED
data/test/core_ext/string.dt.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dohutil
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.12
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-05-
|
13
|
+
date: 2013-05-22 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: dohroot
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.1.
|
22
|
+
version: 0.1.2
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -27,7 +27,7 @@ dependencies:
|
|
27
27
|
requirements:
|
28
28
|
- - ! '>='
|
29
29
|
- !ruby/object:Gem::Version
|
30
|
-
version: 0.1.
|
30
|
+
version: 0.1.2
|
31
31
|
- !ruby/object:Gem::Dependency
|
32
32
|
name: highline
|
33
33
|
requirement: !ruby/object:Gem::Requirement
|
@@ -51,7 +51,7 @@ dependencies:
|
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.1.
|
54
|
+
version: 0.1.19
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
57
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -59,7 +59,7 @@ dependencies:
|
|
59
59
|
requirements:
|
60
60
|
- - ! '>='
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: 0.1.
|
62
|
+
version: 0.1.19
|
63
63
|
description: Tiny utilities, packaged together so they don't each have their own gem.
|
64
64
|
email:
|
65
65
|
- devinfo@atpsoft.com
|
@@ -68,27 +68,27 @@ extensions: []
|
|
68
68
|
extra_rdoc_files:
|
69
69
|
- MIT-LICENSE
|
70
70
|
files:
|
71
|
-
- lib/
|
72
|
-
- lib/
|
73
|
-
- lib/
|
74
|
-
- lib/
|
75
|
-
- lib/
|
76
|
-
- lib/
|
77
|
-
- lib/
|
78
|
-
- lib/
|
79
|
-
- lib/
|
80
|
-
- lib/
|
81
|
-
- lib/
|
82
|
-
- lib/
|
83
|
-
- lib/
|
84
|
-
- lib/
|
85
|
-
- lib/
|
86
|
-
- lib/
|
87
|
-
- lib/
|
88
|
-
- lib/
|
89
|
-
- lib/
|
90
|
-
- lib/
|
91
|
-
- lib/
|
71
|
+
- lib/dohutil/app/cli.rb
|
72
|
+
- lib/dohutil/app/init_from_prog.rb
|
73
|
+
- lib/dohutil/app/init_from_pwd.rb
|
74
|
+
- lib/dohutil/app/origin.rb
|
75
|
+
- lib/dohutil/app/util.rb
|
76
|
+
- lib/dohutil/array_to_hash.rb
|
77
|
+
- lib/dohutil/class_basename.rb
|
78
|
+
- lib/dohutil/config.rb
|
79
|
+
- lib/dohutil/core_ext/bigdecimal.rb
|
80
|
+
- lib/dohutil/core_ext/boolean.rb
|
81
|
+
- lib/dohutil/core_ext/date.rb
|
82
|
+
- lib/dohutil/core_ext/datewithtime.rb
|
83
|
+
- lib/dohutil/core_ext/dir.rb
|
84
|
+
- lib/dohutil/core_ext/force_deep_copy.rb
|
85
|
+
- lib/dohutil/core_ext/hash.rb
|
86
|
+
- lib/dohutil/core_ext/inspect.rb
|
87
|
+
- lib/dohutil/core_ext/string.rb
|
88
|
+
- lib/dohutil/current_date.rb
|
89
|
+
- lib/dohutil/env.rb
|
90
|
+
- lib/dohutil/password_helper.rb
|
91
|
+
- lib/dohutil/to_display.rb
|
92
92
|
- test/core_ext/bigdecimal.dt.rb
|
93
93
|
- test/core_ext/date.dt.rb
|
94
94
|
- test/core_ext/datewithtime.dt.rb
|
@@ -107,7 +107,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
107
107
|
requirements:
|
108
108
|
- - ! '>='
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 1.9.
|
110
|
+
version: 1.9.3
|
111
111
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
112
|
none: false
|
113
113
|
requirements:
|
data/lib/doh/app/util.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'doh/root'
|
2
|
-
|
3
|
-
module DohApp
|
4
|
-
|
5
|
-
def self.require_custom_config
|
6
|
-
raise Doh::DohRootNotFoundException if !Doh::root
|
7
|
-
path = File.expand_path(File::join(Doh::root, 'config/dohapp.rb'))
|
8
|
-
require(path) if File.exist?(path)
|
9
|
-
end
|
10
|
-
|
11
|
-
def self.init_from_file(filepath)
|
12
|
-
Doh::find_root_from_file(filepath)
|
13
|
-
DohApp::require_custom_config
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|