clog 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +21 -0
- data/LICENSE +20 -0
- data/README.rdoc +17 -0
- data/Rakefile +48 -0
- data/VERSION +1 -0
- data/init.rb +5 -0
- data/lib/clog.rb +145 -0
- data/self.gemspec +101 -0
- data/test/common/functional/public_controller_test.rb +11 -0
- data/test/common/migrate/20100821014956_create_users.rb +13 -0
- data/test/common/public_controller.rb +11 -0
- data/test/common/unit/helpers/public_helper_test.rb +4 -0
- data/test/common/unit/user_test.rb +17 -0
- data/test/common/user.rb +2 -0
- data/test/helper.rb +9 -0
- data/test/rails2x_root.tar.gz +0 -0
- data/test/rails2x_root/README +243 -0
- data/test/rails2x_root/Rakefile +10 -0
- data/test/rails2x_root/app/controllers/application_controller.rb +10 -0
- data/test/rails2x_root/app/controllers/public_controller.rb +11 -0
- data/test/rails2x_root/app/helpers/application_helper.rb +3 -0
- data/test/rails2x_root/app/helpers/public_helper.rb +2 -0
- data/test/rails2x_root/app/models/user.rb +2 -0
- data/test/rails2x_root/config/boot.rb +110 -0
- data/test/rails2x_root/config/database.yml +22 -0
- data/test/rails2x_root/config/environment.rb +23 -0
- data/test/rails2x_root/config/environments/development.rb +17 -0
- data/test/rails2x_root/config/environments/production.rb +28 -0
- data/test/rails2x_root/config/environments/test.rb +28 -0
- data/test/rails2x_root/config/initializers/backtrace_silencers.rb +7 -0
- data/test/rails2x_root/config/initializers/cookie_verification_secret.rb +7 -0
- data/test/rails2x_root/config/initializers/inflections.rb +10 -0
- data/test/rails2x_root/config/initializers/mime_types.rb +5 -0
- data/test/rails2x_root/config/initializers/new_rails_defaults.rb +21 -0
- data/test/rails2x_root/config/initializers/session_store.rb +15 -0
- data/test/rails2x_root/config/locales/en.yml +5 -0
- data/test/rails2x_root/config/routes.rb +43 -0
- data/test/rails2x_root/db/development.sqlite3 +0 -0
- data/test/rails2x_root/db/schema.rb +21 -0
- data/test/rails2x_root/db/seeds.rb +7 -0
- data/test/rails2x_root/db/test.sqlite3 +0 -0
- data/test/rails2x_root/public/404.html +30 -0
- data/test/rails2x_root/public/422.html +30 -0
- data/test/rails2x_root/public/500.html +30 -0
- data/test/rails2x_root/public/favicon.ico +0 -0
- data/test/rails2x_root/public/images/rails.png +0 -0
- data/test/rails2x_root/public/javascripts/application.js +2 -0
- data/test/rails2x_root/public/javascripts/controls.js +963 -0
- data/test/rails2x_root/public/javascripts/dragdrop.js +973 -0
- data/test/rails2x_root/public/javascripts/effects.js +1128 -0
- data/test/rails2x_root/public/javascripts/prototype.js +4320 -0
- data/test/rails2x_root/public/robots.txt +5 -0
- data/test/rails2x_root/script/about +4 -0
- data/test/rails2x_root/script/console +3 -0
- data/test/rails2x_root/script/dbconsole +3 -0
- data/test/rails2x_root/script/destroy +3 -0
- data/test/rails2x_root/script/generate +3 -0
- data/test/rails2x_root/script/performance/benchmarker +3 -0
- data/test/rails2x_root/script/performance/profiler +3 -0
- data/test/rails2x_root/script/plugin +3 -0
- data/test/rails2x_root/script/runner +3 -0
- data/test/rails2x_root/script/server +3 -0
- data/test/rails2x_root/test/fixtures/users.yml +11 -0
- data/test/rails2x_root/test/performance/browsing_test.rb +9 -0
- data/test/rails2x_root/test/test_helper.rb +39 -0
- data/test/rails3x_root/.gitignore +4 -0
- data/test/rails3x_root/Gemfile +32 -0
- data/test/rails3x_root/Gemfile.lock +81 -0
- data/test/rails3x_root/README +256 -0
- data/test/rails3x_root/Rakefile +7 -0
- data/test/rails3x_root/app/controllers/application_controller.rb +3 -0
- data/test/rails3x_root/app/controllers/public_controller.rb +11 -0
- data/test/rails3x_root/app/helpers/application_helper.rb +2 -0
- data/test/rails3x_root/app/helpers/public_helper.rb +2 -0
- data/test/rails3x_root/app/models/user.rb +2 -0
- data/test/rails3x_root/app/views/layouts/application.html.erb +14 -0
- data/test/rails3x_root/config.ru +4 -0
- data/test/rails3x_root/config/application.rb +42 -0
- data/test/rails3x_root/config/boot.rb +13 -0
- data/test/rails3x_root/config/database.yml +22 -0
- data/test/rails3x_root/config/environment.rb +5 -0
- data/test/rails3x_root/config/environments/development.rb +22 -0
- data/test/rails3x_root/config/environments/production.rb +49 -0
- data/test/rails3x_root/config/environments/test.rb +35 -0
- data/test/rails3x_root/config/initializers/backtrace_silencers.rb +7 -0
- data/test/rails3x_root/config/initializers/inflections.rb +10 -0
- data/test/rails3x_root/config/initializers/mime_types.rb +5 -0
- data/test/rails3x_root/config/initializers/secret_token.rb +7 -0
- data/test/rails3x_root/config/initializers/session_store.rb +8 -0
- data/test/rails3x_root/config/locales/en.yml +5 -0
- data/test/rails3x_root/config/routes.rb +58 -0
- data/test/rails3x_root/db/schema.rb +22 -0
- data/test/rails3x_root/db/seeds.rb +7 -0
- data/test/rails3x_root/lib/tasks/.gitkeep +0 -0
- data/test/rails3x_root/public/404.html +26 -0
- data/test/rails3x_root/public/422.html +26 -0
- data/test/rails3x_root/public/500.html +26 -0
- data/test/rails3x_root/public/favicon.ico +0 -0
- data/test/rails3x_root/public/images/rails.png +0 -0
- data/test/rails3x_root/public/javascripts/application.js +2 -0
- data/test/rails3x_root/public/javascripts/controls.js +965 -0
- data/test/rails3x_root/public/javascripts/dragdrop.js +974 -0
- data/test/rails3x_root/public/javascripts/effects.js +1123 -0
- data/test/rails3x_root/public/javascripts/prototype.js +6001 -0
- data/test/rails3x_root/public/javascripts/rails.js +175 -0
- data/test/rails3x_root/public/robots.txt +5 -0
- data/test/rails3x_root/public/stylesheets/.gitkeep +0 -0
- data/test/rails3x_root/script/rails +6 -0
- data/test/rails3x_root/test/fixtures/users.yml +11 -0
- data/test/rails3x_root/test/functional.tar.gz +0 -0
- data/test/rails3x_root/test/performance/browsing_test.rb +9 -0
- data/test/rails3x_root/test/test_helper.rb +13 -0
- data/test/rails3x_root/test/unit.tar.gz +0 -0
- data/test/test_clog.rb +60 -0
- metadata +244 -0
data/.document
ADDED
data/.gitignore
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Kevin Swope
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
= clog
|
2
|
+
|
3
|
+
Description goes here.
|
4
|
+
|
5
|
+
== Note on Patches/Pull Requests
|
6
|
+
|
7
|
+
* Fork the project.
|
8
|
+
* Make your feature addition or bug fix.
|
9
|
+
* Add tests for it. This is important so I don't break it in a
|
10
|
+
future version unintentionally.
|
11
|
+
* Commit, do not mess with rakefile, version, or history.
|
12
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
13
|
+
* Send me a pull request. Bonus points for topic branches.
|
14
|
+
|
15
|
+
== Copyright
|
16
|
+
|
17
|
+
Copyright (c) 2010 Kevin Swope. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
summary = "Little rails debugging gem for writing colorized output to log file"
|
8
|
+
gem.name = "clog"
|
9
|
+
gem.summary = summary
|
10
|
+
gem.description = summary
|
11
|
+
gem.email = "gems-kevdev@snkmail.com"
|
12
|
+
gem.homepage = "http://github.com/kswope/clog"
|
13
|
+
gem.authors = ["Kevin Swope"]
|
14
|
+
gem.add_dependency('term-ansicolor')
|
15
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
16
|
+
end
|
17
|
+
Jeweler::GemcutterTasks.new
|
18
|
+
rescue LoadError
|
19
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
20
|
+
end
|
21
|
+
|
22
|
+
desc "build README.html from README.doc (for previewing in browser)"
|
23
|
+
task :readme do
|
24
|
+
system "rdoc README.rdoc --one-file > README.html"
|
25
|
+
end
|
26
|
+
|
27
|
+
task :default => :test
|
28
|
+
task :test => [:test_default, :test_rails2x, :test_rails3x]
|
29
|
+
|
30
|
+
require 'rake/testtask'
|
31
|
+
Rake::TestTask.new(:test_default) do |test|
|
32
|
+
test.libs << 'lib' << 'test'
|
33
|
+
test.pattern = 'test/test_clog.rb'
|
34
|
+
test.verbose = true
|
35
|
+
end
|
36
|
+
|
37
|
+
task :test_rails2x do |t|
|
38
|
+
chdir "test/rails2x_root" do
|
39
|
+
system "rake"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
task :test_rails3x do |t|
|
44
|
+
chdir "test/rails3x_root" do
|
45
|
+
system "rake"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/init.rb
ADDED
data/lib/clog.rb
ADDED
@@ -0,0 +1,145 @@
|
|
1
|
+
require 'term/ansicolor'
|
2
|
+
|
3
|
+
class Clog
|
4
|
+
|
5
|
+
@@foreground = :white
|
6
|
+
@@background = :red
|
7
|
+
@@maxwidth = 100 # max length before putting caller location on next line
|
8
|
+
|
9
|
+
#### change default color
|
10
|
+
def self.colors(bg, fg=nil)
|
11
|
+
@@background = bg
|
12
|
+
@@foreground = fg if fg
|
13
|
+
end
|
14
|
+
|
15
|
+
#### change default maxwidth
|
16
|
+
def self.maxwidth(max)
|
17
|
+
@@maxwidth = max
|
18
|
+
end
|
19
|
+
|
20
|
+
class << self
|
21
|
+
|
22
|
+
def clog(*args)
|
23
|
+
|
24
|
+
# write to appopriate stream
|
25
|
+
if defined?(Rails.logger)
|
26
|
+
Rails.logger.debug(message(*args))
|
27
|
+
else # probably just for testing
|
28
|
+
puts message(*args)
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
#### Generate string to be logged
|
34
|
+
def message(*args)
|
35
|
+
|
36
|
+
if args.size == 0 # flag
|
37
|
+
flag + leftloc
|
38
|
+
elsif args.size == 1 # single argument
|
39
|
+
if too_long_for_leftloc(args, leftloc)
|
40
|
+
"#{args[0].inspect}\n#{uploc}"
|
41
|
+
else
|
42
|
+
"#{args[0].inspect}#{leftloc}"
|
43
|
+
end
|
44
|
+
elsif args.size == 2 && args[0].class == Symbol # symbol + single argument
|
45
|
+
#symbol = colorize(args[0].to_s + ':')
|
46
|
+
if too_long_for_leftloc(args, leftloc)
|
47
|
+
"#{args[0]}: #{args[1].inspect}\n#{uploc}"
|
48
|
+
else
|
49
|
+
"#{args[0]}: #{args[1].inspect}#{leftloc}"
|
50
|
+
end
|
51
|
+
else # multiple args, each gets its own line
|
52
|
+
str = args.inject(''){|str, x| str << "#{x.inspect}\n"}
|
53
|
+
"#{str}#{uploc}"
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
private # ~*~*~*~*~
|
59
|
+
|
60
|
+
include Term::ANSIColor
|
61
|
+
|
62
|
+
#### Decide which loc is best
|
63
|
+
def too_long_for_leftloc(args, lloc)
|
64
|
+
|
65
|
+
# figure out length sum of arguments
|
66
|
+
length = args.inject(0) {|sum,x| sum+= x.inspect.length }
|
67
|
+
|
68
|
+
# hello there, kludge - have to strip off color escape codes to size lloc
|
69
|
+
lloc = lloc.gsub(/\e\[(?:[34][0-7]|[0-9])?m/, '')
|
70
|
+
|
71
|
+
length += lloc.length
|
72
|
+
|
73
|
+
length > @@maxwidth
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
#### colored get_caller_str preceeded with "\n^^^"
|
78
|
+
def uploc
|
79
|
+
colorize("^^^ " + get_caller_str)
|
80
|
+
end
|
81
|
+
|
82
|
+
#### colored get_caller_str preceeded with "<---"
|
83
|
+
def leftloc
|
84
|
+
" " + colorize(" <--- " + get_caller_str)
|
85
|
+
end
|
86
|
+
|
87
|
+
#### Munged Kernel#caller output
|
88
|
+
def get_caller_str
|
89
|
+
|
90
|
+
#(caller(2)[0])[/\/app\/(.*$)/, 1]
|
91
|
+
call = caller(5).first
|
92
|
+
|
93
|
+
# Don't like the format of Kernel#caller, lets parse and reassemble
|
94
|
+
# output (the hexcodes are here because the characters messed up my
|
95
|
+
# editors colors)
|
96
|
+
match = call.match /^(.*?):(\d+):in \x60(.*)\x27/
|
97
|
+
|
98
|
+
path = match[1]
|
99
|
+
line = match[2]
|
100
|
+
func = match[3]
|
101
|
+
|
102
|
+
# try to remove Rails.root from path
|
103
|
+
#path[Rails.root.to_s] = "" if defined?(Rails.root)
|
104
|
+
path.gsub!(/#{Rails.root}\//, '') if defined?(Rails.root)
|
105
|
+
|
106
|
+
#path.gsub!(/#{RAILS_ROOT}\//, '') if defined? RAILS_ROOT
|
107
|
+
|
108
|
+
"#{path}:#{line} #{func}()"
|
109
|
+
|
110
|
+
end
|
111
|
+
|
112
|
+
#### Note: bolded black forground looks greyish, white background looks
|
113
|
+
#### greyish, but everything else bolded looks good - that is why this
|
114
|
+
#### method has conditionals
|
115
|
+
def colorize(txt)
|
116
|
+
str = ""
|
117
|
+
str << bold unless @@foreground == :black
|
118
|
+
str << send("on_#{@@background}") unless @@background == :white
|
119
|
+
str << send(@@foreground)
|
120
|
+
str << txt
|
121
|
+
str << reset
|
122
|
+
end
|
123
|
+
|
124
|
+
#### Oh, say can you see...
|
125
|
+
def flag
|
126
|
+
flag = ""
|
127
|
+
flag << "#{bold}#{on_blue}#{white}*#{reset}" * 3
|
128
|
+
flag << "#{bold}#{on_red}#{white}=#{reset}" * 6
|
129
|
+
end
|
130
|
+
|
131
|
+
end # class << self
|
132
|
+
|
133
|
+
end # class
|
134
|
+
|
135
|
+
|
136
|
+
class Object
|
137
|
+
|
138
|
+
private # make private so clog can only be called naked
|
139
|
+
|
140
|
+
def clog(*args)
|
141
|
+
Clog.clog(*args)
|
142
|
+
end
|
143
|
+
|
144
|
+
end
|
145
|
+
|
data/self.gemspec
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{clog}
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Kevin Swope"]
|
12
|
+
s.date = %q{2010-08-22}
|
13
|
+
s.description = %q{Little rails debugging gem for writing colorized output to log file}
|
14
|
+
s.email = %q{gems-kevdev@snkmail.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".gitignore",
|
22
|
+
"LICENSE",
|
23
|
+
"README.rdoc",
|
24
|
+
"Rakefile",
|
25
|
+
"VERSION",
|
26
|
+
"lib/clog.rb",
|
27
|
+
"test/helper.rb",
|
28
|
+
"test/test_clog.rb"
|
29
|
+
]
|
30
|
+
s.homepage = %q{http://github.com/kswope/clog}
|
31
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
32
|
+
s.require_paths = ["lib"]
|
33
|
+
s.rubygems_version = %q{1.3.7}
|
34
|
+
s.summary = %q{Little rails debugging gem for writing colorized output to log file}
|
35
|
+
s.test_files = [
|
36
|
+
"test/common/functional/public_controller_test.rb",
|
37
|
+
"test/common/migrate/20100821014956_create_users.rb",
|
38
|
+
"test/common/public_controller.rb",
|
39
|
+
"test/common/unit/helpers/public_helper_test.rb",
|
40
|
+
"test/common/unit/user_test.rb",
|
41
|
+
"test/common/user.rb",
|
42
|
+
"test/helper.rb",
|
43
|
+
"test/rails2x_root/app/controllers/application_controller.rb",
|
44
|
+
"test/rails2x_root/app/controllers/public_controller.rb",
|
45
|
+
"test/rails2x_root/app/helpers/application_helper.rb",
|
46
|
+
"test/rails2x_root/app/helpers/public_helper.rb",
|
47
|
+
"test/rails2x_root/app/models/user.rb",
|
48
|
+
"test/rails2x_root/config/boot.rb",
|
49
|
+
"test/rails2x_root/config/environment.rb",
|
50
|
+
"test/rails2x_root/config/environments/development.rb",
|
51
|
+
"test/rails2x_root/config/environments/production.rb",
|
52
|
+
"test/rails2x_root/config/environments/test.rb",
|
53
|
+
"test/rails2x_root/config/initializers/backtrace_silencers.rb",
|
54
|
+
"test/rails2x_root/config/initializers/cookie_verification_secret.rb",
|
55
|
+
"test/rails2x_root/config/initializers/inflections.rb",
|
56
|
+
"test/rails2x_root/config/initializers/mime_types.rb",
|
57
|
+
"test/rails2x_root/config/initializers/new_rails_defaults.rb",
|
58
|
+
"test/rails2x_root/config/initializers/session_store.rb",
|
59
|
+
"test/rails2x_root/config/routes.rb",
|
60
|
+
"test/rails2x_root/db/schema.rb",
|
61
|
+
"test/rails2x_root/db/seeds.rb",
|
62
|
+
"test/rails2x_root/test/performance/browsing_test.rb",
|
63
|
+
"test/rails2x_root/test/test_helper.rb",
|
64
|
+
"test/rails3x_root/app/controllers/application_controller.rb",
|
65
|
+
"test/rails3x_root/app/controllers/public_controller.rb",
|
66
|
+
"test/rails3x_root/app/helpers/application_helper.rb",
|
67
|
+
"test/rails3x_root/app/helpers/public_helper.rb",
|
68
|
+
"test/rails3x_root/app/models/user.rb",
|
69
|
+
"test/rails3x_root/config/application.rb",
|
70
|
+
"test/rails3x_root/config/boot.rb",
|
71
|
+
"test/rails3x_root/config/environment.rb",
|
72
|
+
"test/rails3x_root/config/environments/development.rb",
|
73
|
+
"test/rails3x_root/config/environments/production.rb",
|
74
|
+
"test/rails3x_root/config/environments/test.rb",
|
75
|
+
"test/rails3x_root/config/initializers/backtrace_silencers.rb",
|
76
|
+
"test/rails3x_root/config/initializers/inflections.rb",
|
77
|
+
"test/rails3x_root/config/initializers/mime_types.rb",
|
78
|
+
"test/rails3x_root/config/initializers/secret_token.rb",
|
79
|
+
"test/rails3x_root/config/initializers/session_store.rb",
|
80
|
+
"test/rails3x_root/config/routes.rb",
|
81
|
+
"test/rails3x_root/db/schema.rb",
|
82
|
+
"test/rails3x_root/db/seeds.rb",
|
83
|
+
"test/rails3x_root/test/performance/browsing_test.rb",
|
84
|
+
"test/rails3x_root/test/test_helper.rb",
|
85
|
+
"test/test_clog.rb"
|
86
|
+
]
|
87
|
+
|
88
|
+
if s.respond_to? :specification_version then
|
89
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
90
|
+
s.specification_version = 3
|
91
|
+
|
92
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
93
|
+
s.add_runtime_dependency(%q<term-ansicolor>, [">= 0"])
|
94
|
+
else
|
95
|
+
s.add_dependency(%q<term-ansicolor>, [">= 0"])
|
96
|
+
end
|
97
|
+
else
|
98
|
+
s.add_dependency(%q<term-ansicolor>, [">= 0"])
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class PublicController < ApplicationController
|
2
|
+
|
3
|
+
def index
|
4
|
+
render :text => "Hello, just doing some logging"
|
5
|
+
clog "Hello log!"
|
6
|
+
clog "Hello log! Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua"
|
7
|
+
clog :message, "hello log!"
|
8
|
+
clog Rails.root, Object.new, Kernel, RUBY_VERSION, :a_symbol
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class UserTest < ActiveSupport::TestCase
|
4
|
+
|
5
|
+
|
6
|
+
#### not much of a test, all the good testing is done at the gem level, this
|
7
|
+
#### just tests if it blows up in rails
|
8
|
+
test "nothing blows up in rails model" do
|
9
|
+
|
10
|
+
user = User.new
|
11
|
+
clog user.email = "test@example.com"
|
12
|
+
clog user.password = "not encrypted"
|
13
|
+
clog user
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
data/test/common/user.rb
ADDED