dmorrill10-utils 1.0.0 → 1.1.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.
data/README.md CHANGED
@@ -23,3 +23,9 @@ Or install it yourself as:
23
23
  3. Commit your changes (`git commit -am 'Added some feature'`)
24
24
  4. Push to the branch (`git push origin my-new-feature`)
25
25
  5. Create new Pull Request
26
+
27
+ ## Versioning
28
+ The version number will change according to the following scheme:
29
+ - The major number will be incremented on non-backwards compatible updates.
30
+ - The minor number will be incremented on backwards compatible strict API extensions.
31
+ - The patch number will be incremented on backwards compatible changes that do not effect the API
@@ -5,6 +5,8 @@ require 'dmorrill10-utils/enumerable'
5
5
  require 'dmorrill10-utils/integer'
6
6
  require 'dmorrill10-utils/string_form_manipulation'
7
7
  require 'dmorrill10-utils/process_runner'
8
+ require 'dmorrill10-utils/singleton_logger'
9
+ require 'dmorrill10-utils/debug_hash'
8
10
 
9
11
  module Dmorrill10
10
12
  module Utils
@@ -0,0 +1,12 @@
1
+ require 'delegate'
2
+ require 'awesome_print'
3
+
4
+ class DebugHash < DelegateClass(Hash)
5
+ def initialize(hash)
6
+ @value = hash
7
+
8
+ super @value
9
+ end
10
+ alias_method :to_s, :awesome_inspect
11
+ alias_method :inspect, :awesome_inspect
12
+ end
@@ -0,0 +1,36 @@
1
+ require 'logger'
2
+
3
+ class SingletonLogger < Logger
4
+ @@log = Logger.new(STDOUT)
5
+
6
+ def self.instance
7
+ @@log
8
+ end
9
+
10
+ # @param [IO] file Log target file.
11
+ def self.set_log_file!(file)
12
+ @@log = Logger.new(file)
13
+
14
+ self
15
+ end
16
+
17
+ def self.set_log_to_stdout!
18
+ set_log_file!(STDOUT)
19
+ end
20
+
21
+ def self.set_log_to_stderr!
22
+ set_log_file!(STDERR)
23
+ end
24
+
25
+ def self.respond_to_missing?(name, include_private=false)
26
+ @@log.respond_to?(name, include_private) or super
27
+ end
28
+
29
+ private_class_method :new
30
+
31
+ private
32
+
33
+ def self.method_missing(method, *args, &block)
34
+ @@log.send(method, *args, &block)
35
+ end
36
+ end
@@ -1,5 +1,5 @@
1
1
  module Dmorrill10
2
2
  module Utils
3
- VERSION = "1.0.0"
3
+ VERSION = "1.1.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dmorrill10-utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-14 00:00:00.000000000 Z
12
+ date: 2013-01-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mocha
@@ -73,9 +73,11 @@ files:
73
73
  - dmorrill10-utils.gemspec
74
74
  - lib/dmorrill10-utils.rb
75
75
  - lib/dmorrill10-utils/class.rb
76
+ - lib/dmorrill10-utils/debug_hash.rb
76
77
  - lib/dmorrill10-utils/enumerable.rb
77
78
  - lib/dmorrill10-utils/integer.rb
78
79
  - lib/dmorrill10-utils/process_runner.rb
80
+ - lib/dmorrill10-utils/singleton_logger.rb
79
81
  - lib/dmorrill10-utils/string_form_manipulation.rb
80
82
  - lib/dmorrill10-utils/version.rb
81
83
  - spec/process_runner_spec.rb