rails-flog-disable-sql-format 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 763adb63decf8b5269fad0515ba76be6c49a08c2
4
+ data.tar.gz: d44cbfb856211723478f4925a3d780b3a478fb22
5
+ SHA512:
6
+ metadata.gz: 44db81471dc2cd45f24864bf3affd9d43b316704c5fd4f1996a964c22a3823638dbf9f884ca061a1f456d5d0932f623083e77c21458587a1d5098cf3f78324d3
7
+ data.tar.gz: c60cf438c7815711fedb64d8a79319bb085c226afee3d428819980fbd906c7075bfa799e59db5b2d5e0aa4df8e33c7eb4db6d9f7adb591b6aa297de4089caf7c
@@ -0,0 +1 @@
1
+ service_name: travis-ci
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ vendor/bundle
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ # - 2.1.0
6
+ gemfile:
7
+ - gemfiles/rails_3_2_x.gemfile
8
+ - gemfiles/rails_4_0_x.gemfile
9
+ # - gemfiles/rails_4_1_x.gemfile
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rails-flog.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 pinzolo
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,111 @@
1
+ # rails-flog
2
+
3
+ [![Build Status](https://secure.travis-ci.org/pinzolo/rails-flog.png)](http://travis-ci.org/pinzolo/rails-flog)
4
+ [![Coverage Status](https://coveralls.io/repos/pinzolo/rails-flog/badge.png)](https://coveralls.io/r/pinzolo/rails-flog)
5
+
6
+ rails-flog provides feature that formats parameters Hash and SQL in Rails log file.
7
+
8
+ ## Before and after (Sampla app: Redmine)
9
+
10
+ ### Before (Default)
11
+
12
+ ```
13
+ # Parameters
14
+ Processing by IssuesController#create as HTML
15
+ Parameters: {"utf8"=>"✓", "authenticity_token"=>"VYCWAsE+aAN+zSZq2H3ONNqaU8rlyfbnXLfbwDY1i10=", "issue"=>{"is_private"=>"0", "tracker_id"=>"1", "subject"=>"test ticket", "description"=>"test ticket description", "status_id"=>"1", "priority_id"=>"2", "assigned_to_id"=>"1", "parent_issue_id"=>"", "start_date"=>"2013-11-28", "due_date"=>"2013-11-29", "estimated_hours"=>"5", "done_ratio"=>"10"}, "commit"=>"Create", "project_id"=>"test"}
16
+
17
+ # SQL
18
+ IssueCustomField Load (0.0ms) SELECT "custom_fields".* FROM "custom_fields" WHERE "custom_fields"."type" IN ('IssueCustomField') AND (is_for_all = 't' OR id IN (SELECT DISTINCT cfp.custom_field_id FROM custom_fields_projects cfp WHERE cfp.project_id = 1)) ORDER BY custom_fields.position ASC
19
+ ```
20
+
21
+ ### After (Use rails-flog)
22
+
23
+ ```
24
+ # Parameters
25
+ Processing by IssuesController#create as HTML
26
+ Parameters:
27
+ {
28
+ "utf8" => "✓",
29
+ "authenticity_token" => "VYCWAsE+aAN+zSZq2H3ONNqaU8rlyfbnXLfbwDY1i10=",
30
+ "issue" => {
31
+ "is_private" => "0",
32
+ "tracker_id" => "1",
33
+ "subject" => "test ticket",
34
+ "description" => "test ticket description",
35
+ "status_id" => "1",
36
+ "priority_id" => "2",
37
+ "assigned_to_id" => "1",
38
+ "parent_issue_id" => "",
39
+ "start_date" => "2013-11-28",
40
+ "due_date" => "2013-11-29",
41
+ "estimated_hours" => "5",
42
+ "done_ratio" => "10"
43
+ },
44
+ "commit" => "Create",
45
+ "project_id" => "test"
46
+ }
47
+
48
+ # SQL
49
+ IssueCustomField Load (0.0ms)
50
+ SELECT
51
+ "custom_fields" . *
52
+ FROM
53
+ "custom_fields"
54
+ WHERE
55
+ "custom_fields" . "type" IN ('IssueCustomField')
56
+ AND (
57
+ is_for_all = 't'
58
+ OR id IN (
59
+ SELECT
60
+ DISTINCT cfp.custom_field_id
61
+ FROM
62
+ custom_fields_projects cfp
63
+ WHERE
64
+ cfp.project_id = 1
65
+ )
66
+ )
67
+ ORDER BY
68
+ custom_fields.position ASC
69
+ ```
70
+
71
+ ## Installation
72
+
73
+ Add this line to your application's Gemfile:
74
+ (Recommendation: use only `:development` and `:test` enviroment)
75
+
76
+ gem 'rails-flog', :require => "flog"
77
+
78
+ And then execute:
79
+
80
+ $ bundle
81
+
82
+ Or install it yourself as:
83
+
84
+ $ gem install rails-flog
85
+
86
+ ## Usage
87
+
88
+ Just install.
89
+
90
+ ## Disable temporary
91
+
92
+ If you put a file named `no-flog.txt` to `<rails_app>/tmp` direcotry, `rails-flog` will disable format.
93
+
94
+ ## Supported versions
95
+
96
+ - Ruby: 1.9.3, 2.0.0
97
+ - Rails: 3.2.x, 4.0.x
98
+
99
+ ## Contributing
100
+
101
+ 1. Fork it
102
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
103
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
104
+ 4. Push to the branch (`git push origin my-new-feature`)
105
+ 5. Create new Pull Request
106
+
107
+ ## Changelog
108
+
109
+ - v1.0.0 (2013-11-28 JST): First release
110
+ - v1.1.0 (2013-12-02 JST): Add feature that disables format by no-flog.txt
111
+ - v1.1.1 (2013-12-06 JST): Change to alias_method_change from alias for method aliasing
@@ -0,0 +1,8 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+ task :default => :test
4
+
5
+ Rake::TestTask.new do |t|
6
+ t.libs << "test"
7
+ t.test_files = Dir.glob("test/unit/*_test.rb")
8
+ end
@@ -0,0 +1,7 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "rails", "~>3.2.0"
4
+ gem "anbt-sql-formatter"
5
+ gem "awesome_print"
6
+
7
+ gemspec :path => "../"
@@ -0,0 +1,7 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "rails", "~>4.0.0"
4
+ gem "anbt-sql-formatter"
5
+ gem "awesome_print"
6
+
7
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "rails", "~>4.1.0"
4
+ gem "anbt-sql-formatter"
5
+ gem "awesome_print"
6
+
7
+ gemspec :path => "../"
8
+
@@ -0,0 +1,6 @@
1
+ # coding: utf-8
2
+ require "flog/version"
3
+ require "flog/status"
4
+ # require "flog/sql_formattable"
5
+ require "flog/params_formattable"
6
+
@@ -0,0 +1,41 @@
1
+ # coding: utf-8
2
+ require "action_controller/log_subscriber"
3
+ require "awesome_print"
4
+ require "flog/payload_value_shuntable"
5
+ require "flog/status"
6
+
7
+ class ActionController::LogSubscriber
8
+ include Flog::PayloadValueShuntable
9
+
10
+ def start_processing_with_flog(event)
11
+ return start_processing_without_flog(event) unless Flog::Status.enabled?
12
+
13
+ replaced = replace_params(event.payload[:params])
14
+
15
+ shunt_payload_value(event.payload, :params, replaced) do
16
+ start_processing_without_flog(event)
17
+ end
18
+ end
19
+ alias_method_chain :start_processing, :flog
20
+
21
+ private
22
+ def replace_params(params)
23
+ return params if params.empty? || !params.respond_to?(:ai)
24
+
25
+ replaced = params.dup
26
+ class << replaced
27
+ alias :original_except :except
28
+
29
+ def except(*keys)
30
+ excepted = original_except(*keys)
31
+ class << excepted
32
+ def inspect
33
+ "\n#{ai(plain: !ActionController::LogSubscriber.colorize_logging)}"
34
+ end
35
+ end
36
+ excepted
37
+ end
38
+ end
39
+ replaced
40
+ end
41
+ end
@@ -0,0 +1,21 @@
1
+ # coding: utf-8
2
+ module Flog
3
+ module PayloadValueShuntable
4
+ def shunt_payload_value(payload, key, temp_value, &block)
5
+ return unless block
6
+
7
+ key_exists = payload.key?(key)
8
+ base_value = payload[key]
9
+ begin
10
+ payload[key] = temp_value
11
+ block.call
12
+ ensure
13
+ if key_exists
14
+ payload[key] = base_value
15
+ else
16
+ payload.delete(key)
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,32 @@
1
+ # coding: utf-8
2
+ require "active_record/log_subscriber"
3
+ require "flog/payload_value_shuntable"
4
+
5
+ class ActiveRecord::LogSubscriber
6
+ include Flog::PayloadValueShuntable
7
+
8
+ def sql_with_flog(event)
9
+ return sql_without_flog(event) unless Flog::Status.enabled?
10
+
11
+ formatted = format_sql(event.payload[:sql])
12
+
13
+ shunt_payload_value(event.payload, :sql, "\n\t#{formatted}") do
14
+ sql_without_flog(event)
15
+ end
16
+ end
17
+ alias_method_chain :sql, :flog
18
+
19
+ private
20
+ def format_sql(sql)
21
+ return sql if sql.blank?
22
+
23
+ require "anbt-sql-formatter/formatter"
24
+ rule = AnbtSql::Rule.new
25
+ rule.keyword = AnbtSql::Rule::KEYWORD_UPPER_CASE
26
+ %w(count sum).each do |function_name|
27
+ rule.function_names << function_name
28
+ end
29
+ rule.indent_string = "\t"
30
+ AnbtSql::Formatter.new(rule).format(sql.squeeze(" "))
31
+ end
32
+ end
@@ -0,0 +1,14 @@
1
+ # coding: utf-8
2
+ require "rails"
3
+
4
+ module Flog
5
+ class Status
6
+ SWITCH_FILE_NAME = "no-flog.txt"
7
+
8
+ def self.enabled?
9
+ !File.exist?(Rails.root.join("tmp", SWITCH_FILE_NAME).to_s)
10
+ rescue
11
+ true
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,4 @@
1
+ # coding: utf-8
2
+ module Flog
3
+ VERSION = "1.1.2"
4
+ end
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'flog/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "rails-flog-disable-sql-format"
8
+ spec.version = Flog::VERSION
9
+ spec.authors = ["shu0115"]
10
+ spec.email = ["s.matsumoto0115@gmail.com"]
11
+ spec.description = %q{This formats parameters and sql in rails log.}
12
+ spec.summary = %q{Rails log formatter for parameters and sql}
13
+ spec.homepage = "https://github.com/shu0115/rails-flog-disable-sql-format"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "sqlite3"
24
+ spec.add_development_dependency "coveralls"
25
+ spec.add_development_dependency "mocha"
26
+
27
+ spec.add_dependency "rails", ">=3.2.0"
28
+ spec.add_dependency "anbt-sql-formatter"
29
+ spec.add_dependency "awesome_print"
30
+ end
@@ -0,0 +1,43 @@
1
+ # coding: utf-8
2
+ require "coveralls"
3
+ require "simplecov"
4
+ SimpleCov.formatter = Coveralls::SimpleCov::Formatter
5
+ SimpleCov.start do
6
+ add_filter '/test/'
7
+ add_filter '/bundle/'
8
+ end
9
+
10
+ Bundler.require
11
+ require "flog"
12
+ require "test/unit"
13
+ require "mocha/setup"
14
+
15
+ class TestLogger
16
+ attr_accessor :debugs, :infos, :errors
17
+
18
+ def initialize
19
+ @debugs = []
20
+ @infos = []
21
+ @errors = []
22
+ end
23
+
24
+ def debug?
25
+ true
26
+ end
27
+
28
+ def info?
29
+ true
30
+ end
31
+
32
+ def debug(message)
33
+ @debugs += message.split("\n")
34
+ end
35
+
36
+ def info(message)
37
+ @infos += message.split("\n")
38
+ end
39
+
40
+ def error(message)
41
+ @errors += message.split("\n")
42
+ end
43
+ end
@@ -0,0 +1,80 @@
1
+ # coding: utf-8
2
+ require "action_controller"
3
+ require "test_helper"
4
+
5
+ class TestController < ActionController::Base
6
+ def initialize(routes)
7
+ @routes = routes
8
+ end
9
+
10
+ def _routes
11
+ @routes
12
+ end
13
+
14
+ def show
15
+ render nothing: true
16
+ end
17
+ end
18
+
19
+ class ParamsFormattableTest < ActionController::TestCase
20
+ def setup
21
+ @old_logger = ActionController::Base.logger
22
+ ActiveSupport::LogSubscriber.colorize_logging = false
23
+ @routes = ActionDispatch::Routing::RouteSet.new
24
+ @routes.draw do
25
+ get "test/show", to: "test#show"
26
+ end
27
+ @controller = TestController.new(@routes)
28
+ super
29
+ ActionController::Base.logger = TestLogger.new
30
+ end
31
+
32
+ def teardown
33
+ super
34
+ ActionController::Base.logger = @old_logger
35
+ end
36
+
37
+ def test_parameters_log_is_formatted
38
+ get :show, foo: "foo_value", bar: "bar_value"
39
+ assert_logger do |logger|
40
+ logs = logger.infos.map { |log| log.gsub(/\e\[(\d+;)*\d+m/, "") }
41
+ assert_equal %( Parameters: ) , logs[1]
42
+ assert_equal %({) , logs[2]
43
+ assert_equal %( "foo" => "foo_value",), logs[3]
44
+ assert_equal %( "bar" => "bar_value") , logs[4]
45
+ assert_equal %(}) , logs[5]
46
+ end
47
+ end
48
+
49
+ def test_colorized_on_colorize_loggin_is_true
50
+ ActiveSupport::LogSubscriber.colorize_logging = true
51
+ get :show, foo: "foo_value", bar: "bar_value"
52
+ assert_logger do |logger|
53
+ assert /\e\[(\d+;)*\d+m/.match(logger.infos.join())
54
+ end
55
+ end
56
+
57
+ def test_not_colorized_on_colorize_loggin_is_false
58
+ get :show, foo: "foo_value", bar: "bar_value"
59
+ assert_logger do |logger|
60
+ assert_nil /\e\[(\d+;)*\d+m/.match(logger.infos.join())
61
+ end
62
+ end
63
+
64
+ def test_parameters_log_is_not_formatted_when_enabled_is_false
65
+ Flog::Status.expects(:enabled?).returns(false)
66
+ get :show, foo: "foo_value", bar: "bar_value"
67
+ assert_logger do |logger|
68
+ assert logger.infos[1].include?(%(Parameters: {"foo"=>"foo_value", "bar"=>"bar_value"}))
69
+ end
70
+ end
71
+
72
+ private
73
+ def assert_logger(&block)
74
+ if ActionController::Base.logger.errors.present?
75
+ fail ActionController::Base.logger.errors.first
76
+ else
77
+ block.call(ActionController::Base.logger)
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,57 @@
1
+ # coding: utf-8
2
+ require "test_helper"
3
+
4
+ class TestClass
5
+ include Flog::PayloadValueShuntable
6
+ end
7
+
8
+ class PayloadValueShuntableTest < ActiveSupport::TestCase
9
+ def setup
10
+ @tester = TestClass.new
11
+ @payload = { foo: "foo_value", bar: "bar_value" }
12
+ end
13
+
14
+ def test_shunt_payload_value
15
+ @tester.shunt_payload_value(@payload, :foo, "new_value") do
16
+ assert_equal "new_value", @payload[:foo]
17
+ end
18
+ end
19
+
20
+ def test_value_of_other_key_is_not_changed
21
+ @tester.shunt_payload_value(@payload, :foo, "new_value") do
22
+ assert_equal "bar_value", @payload[:bar]
23
+ end
24
+ end
25
+
26
+ def test_restoration
27
+ @tester.shunt_payload_value(@payload, :foo, "new_value") do
28
+ assert_equal "new_value", @payload[:foo]
29
+ end
30
+ assert_equal "foo_value", @payload[:foo]
31
+ end
32
+
33
+ def test_ensure_restoration_on_error_raised_in_block
34
+ error_raised = false
35
+ begin
36
+ @tester.shunt_payload_value(@payload, :foo, "new_value") do
37
+ raise "error"
38
+ end
39
+ rescue => ex
40
+ error_raised = true
41
+ end
42
+ assert error_raised
43
+ assert_equal "foo_value", @payload[:foo]
44
+ end
45
+
46
+ def test_without_block
47
+ @tester.shunt_payload_value(@payload, :foo, "new_value")
48
+ assert_equal "foo_value", @payload[:foo]
49
+ end
50
+
51
+ def test_key_removed_when_give_not_exist_key
52
+ @tester.shunt_payload_value(@payload, :baz, "new_value") do
53
+ assert_equal "new_value", @payload[:baz]
54
+ end
55
+ assert_equal false, @payload.key?(:baz)
56
+ end
57
+ end
@@ -0,0 +1,71 @@
1
+ # coding: utf-8
2
+ require "active_record"
3
+ require "test_helper"
4
+
5
+ ActiveRecord::Base.establish_connection(adapter: "sqlite3", database: ":memory:")
6
+
7
+ ActiveRecord::Schema.define version: 0 do
8
+ create_table :books, force: true do |t|
9
+ t.string :name
10
+ t.string :category
11
+ end
12
+ end
13
+
14
+ class Book < ActiveRecord::Base; end
15
+
16
+ class SqlFormattableTest < ActiveSupport::TestCase
17
+ def setup
18
+ @old_logger = ActiveRecord::Base.logger
19
+ ActiveSupport::LogSubscriber.colorize_logging = false
20
+ ActiveRecord::Base.logger = TestLogger.new
21
+ end
22
+
23
+ def teardown
24
+ ActiveRecord::Base.logger = @old_logger
25
+ end
26
+
27
+ def test_sql_is_formatted
28
+ Book.where(category: "comics").to_a
29
+ assert_logger do |logger|
30
+ logs = logger.debugs.map { |log| log.gsub("\t", " ") }
31
+ assert_equal %{ SELECT} , logs[1]
32
+ assert_equal %{ "books" . *} , logs[2]
33
+ assert_equal %{ FROM} , logs[3]
34
+ assert_equal %{ "books"} , logs[4]
35
+ assert_equal %{ WHERE} , logs[5]
36
+ assert_equal %{ "books" . "category" = 'comics'}, logs[6]
37
+ end
38
+ end
39
+
40
+ def test_colorized_on_colorize_loggin_is_true
41
+ ActiveSupport::LogSubscriber.colorize_logging = true
42
+ Book.where(category: "comics").to_a
43
+ assert_logger do |logger|
44
+ assert /\e\[(\d+;)*\d+m/.match(logger.debugs.join())
45
+ end
46
+ end
47
+
48
+ def test_not_colorized_on_colorize_loggin_is_false
49
+ Book.where(category: "comics").to_a
50
+ assert_logger do |logger|
51
+ assert_nil /\e\[(\d+;)*\d+m/.match(logger.debugs.join())
52
+ end
53
+ end
54
+
55
+ def test_sql_is_not_formatted_when_enabled_is_false
56
+ Flog::Status.expects(:enabled?).returns(false)
57
+ Book.where(category: "comics").to_a
58
+ assert_logger do |logger|
59
+ assert logger.debugs.first.include?(%(SELECT "books".* FROM "books" WHERE "books"."category" = 'comics'))
60
+ end
61
+ end
62
+
63
+ private
64
+ def assert_logger(&block)
65
+ if ActiveRecord::Base.logger.errors.present?
66
+ fail ActiveRecord::Base.logger.errors.first
67
+ else
68
+ block.call(ActiveRecord::Base.logger)
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,41 @@
1
+ # coding: utf-8
2
+ require "rails"
3
+
4
+ class StatusTest < ActiveSupport::TestCase
5
+ def setup
6
+ @test_root = Pathname.new(File.expand_path(File.dirname(__FILE__) + "../../"))
7
+ @switch_file_path = @test_root.join("tmp", Flog::Status::SWITCH_FILE_NAME)
8
+ end
9
+
10
+ def teardown
11
+ delete_switch_file
12
+ end
13
+
14
+ def test_enabled_is_true_when_switch_file_does_not_exist
15
+ delete_switch_file
16
+ assert Flog::Status.enabled?
17
+ end
18
+
19
+ def test_enabled_is_false_when_switch_file_exists
20
+ Rails.expects(:root).returns(@test_root)
21
+ create_switch_file
22
+ assert_equal false, Flog::Status.enabled?
23
+ end
24
+
25
+ def test_enabled_is_true_when_error_is_raised_in_process
26
+ Rails.expects(:root).returns(nil) # For raise NoMethodError
27
+ create_switch_file
28
+ assert Flog::Status.enabled?
29
+ end
30
+
31
+ private
32
+ def create_switch_file
33
+ File.open(@switch_file_path, "w").close
34
+ end
35
+
36
+ def delete_switch_file
37
+ if File.exist?(@switch_file_path)
38
+ File.delete(@switch_file_path)
39
+ end
40
+ end
41
+ end
metadata ADDED
@@ -0,0 +1,185 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rails-flog-disable-sql-format
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.2
5
+ platform: ruby
6
+ authors:
7
+ - shu0115
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-01-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: sqlite3
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: coveralls
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: mocha
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rails
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: 3.2.0
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: 3.2.0
97
+ - !ruby/object:Gem::Dependency
98
+ name: anbt-sql-formatter
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: awesome_print
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ description: This formats parameters and sql in rails log.
126
+ email:
127
+ - s.matsumoto0115@gmail.com
128
+ executables: []
129
+ extensions: []
130
+ extra_rdoc_files: []
131
+ files:
132
+ - ".coveralls.yml"
133
+ - ".gitignore"
134
+ - ".travis.yml"
135
+ - Gemfile
136
+ - LICENSE.txt
137
+ - README.md
138
+ - Rakefile
139
+ - gemfiles/rails_3_2_x.gemfile
140
+ - gemfiles/rails_4_0_x.gemfile
141
+ - gemfiles/rails_4_1_x.gemfile
142
+ - lib/flog.rb
143
+ - lib/flog/params_formattable.rb
144
+ - lib/flog/payload_value_shuntable.rb
145
+ - lib/flog/sql_formattable.rb
146
+ - lib/flog/status.rb
147
+ - lib/flog/version.rb
148
+ - rails-flog.gemspec
149
+ - test/test_helper.rb
150
+ - test/tmp/.gitkeep
151
+ - test/unit/params_formattable_test.rb
152
+ - test/unit/payload_value_shuntable_test.rb
153
+ - test/unit/sql_formattable_test.rb
154
+ - test/unit/status_test.rb
155
+ homepage: https://github.com/shu0115/rails-flog-disable-sql-format
156
+ licenses:
157
+ - MIT
158
+ metadata: {}
159
+ post_install_message:
160
+ rdoc_options: []
161
+ require_paths:
162
+ - lib
163
+ required_ruby_version: !ruby/object:Gem::Requirement
164
+ requirements:
165
+ - - ">="
166
+ - !ruby/object:Gem::Version
167
+ version: '0'
168
+ required_rubygems_version: !ruby/object:Gem::Requirement
169
+ requirements:
170
+ - - ">="
171
+ - !ruby/object:Gem::Version
172
+ version: '0'
173
+ requirements: []
174
+ rubyforge_project:
175
+ rubygems_version: 2.2.0
176
+ signing_key:
177
+ specification_version: 4
178
+ summary: Rails log formatter for parameters and sql
179
+ test_files:
180
+ - test/test_helper.rb
181
+ - test/tmp/.gitkeep
182
+ - test/unit/params_formattable_test.rb
183
+ - test/unit/payload_value_shuntable_test.rb
184
+ - test/unit/sql_formattable_test.rb
185
+ - test/unit/status_test.rb