cowtech-rails 2.6.0.2 → 2.7.0.0
Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,47 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# This file is part of the cowtech-rails gem. Copyright (C) 2011 and above Shogun <shogun_panda@me.com>.
|
4
|
+
# Licensed under the MIT license, which can be found at http://www.opensource.org/licenses/mit-license.php.
|
5
|
+
#
|
6
|
+
|
7
|
+
module Cowtech
|
8
|
+
module RubyOnRails
|
9
|
+
module Helpers
|
10
|
+
module DebugHelper
|
11
|
+
attr_reader :debug_msg
|
12
|
+
|
13
|
+
def debug_timestamp
|
14
|
+
"[" + Time.now.strftime("%F %T.%L %z") + "]"
|
15
|
+
end
|
16
|
+
|
17
|
+
def debug_file
|
18
|
+
@debug_file ||= Logger.new(Rails.root + "log/debug.log")
|
19
|
+
end
|
20
|
+
|
21
|
+
def debug_msgs
|
22
|
+
@debug_msgs ||= []
|
23
|
+
end
|
24
|
+
|
25
|
+
def debug_dump_object(object, target = nil, method = :to_yaml)
|
26
|
+
self.debug_log("OBJECT DUMP", object.send(method).ensure_string, target)
|
27
|
+
end
|
28
|
+
|
29
|
+
def debug_log(tags, msg, target = nil, no_timestamp = false)
|
30
|
+
tags = tags.ensure_array if tags.present?
|
31
|
+
|
32
|
+
final_msg = []
|
33
|
+
final_msg << self.debug_timestamp if !no_timestamp
|
34
|
+
tags.collect {|tag| "[" + tag + "]" }.each { |tag| final_msg << tag } if tags.present?
|
35
|
+
final_msg << msg
|
36
|
+
final_msg = final_msg.join(" ")
|
37
|
+
|
38
|
+
if !target.nil? && target.respond_to?(:debug) then
|
39
|
+
self.debug_file.debug(final_msg)
|
40
|
+
else
|
41
|
+
self.debug_msgs << final_msg
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
data/lib/cowtech/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cowtech-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.7.0.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2012-01-04 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: cowtech-extensions
|
16
|
-
requirement: &
|
16
|
+
requirement: &70308162700160 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70308162700160
|
25
25
|
description: A general purpose Rails utility plugin.
|
26
26
|
email: shogun_panda@me.com
|
27
27
|
executables: []
|
@@ -32,6 +32,7 @@ files:
|
|
32
32
|
- app/helpers/cowtech/ruby_on_rails/helpers/application_helper.rb
|
33
33
|
- app/helpers/cowtech/ruby_on_rails/helpers/ar_crud_helper.rb
|
34
34
|
- app/helpers/cowtech/ruby_on_rails/helpers/browser_helper.rb
|
35
|
+
- app/helpers/cowtech/ruby_on_rails/helpers/debug_helper.rb
|
35
36
|
- app/helpers/cowtech/ruby_on_rails/helpers/format_helper.rb
|
36
37
|
- app/helpers/cowtech/ruby_on_rails/helpers/mongoid_crud_helper.rb
|
37
38
|
- app/helpers/cowtech/ruby_on_rails/helpers/validation_helper.rb
|