gratan 0.1.3 → 0.1.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 22b16a0819678637c70a910cc85b7a450853239d
4
- data.tar.gz: 0eb1f57a76e0140c4f70aa53f906f38ecf8cc65d
3
+ metadata.gz: 2c3510ebf4368b03f36389baa49df8f7e85c1b86
4
+ data.tar.gz: 79e2f1a39804c36d0fcd0d7d7baf87c70dec0d44
5
5
  SHA512:
6
- metadata.gz: 537ea65c2251efe9ff66072c97afdcb296cd3f006ea7880c502d3b589a84a6508b8a6852c2ba1ddae7c3ce994a5658bf813415c42093e50ed7c7828207c45cd0
7
- data.tar.gz: 784f2b1e29012d458e16293bdbc0e4ba5e5d43fd115cff6cb1725514464cd333c2cd8281246b6beedb8aa5da25e29bae9de8a366d5e4f2d3ebfc8f885ac6edca
6
+ metadata.gz: 571d09776900638414956154e14cc65055262092958e52af3524b772f8b3479bbc8ea1071030a781f181a8c9066446062ef36c4b0fd08b2422c491b0f47ac92e
7
+ data.tar.gz: 4ff0f03f09744d1e2ae66d3cc440c445f66bce0dcb9023e1b599fd54daeb96ea89a19a43cfcc358e3fb13d89d7c8e486efbea6da3bcf763345fe37797b094857
@@ -132,17 +132,17 @@ class Gratan::Driver
132
132
  private
133
133
 
134
134
  def query(sql)
135
- log(:debug, sql)
135
+ log(:debug, sql, :dry_run => false)
136
136
  @client.query(sql)
137
137
  end
138
138
 
139
139
  def update(sql)
140
- log(:info, sql, :green)
140
+ log(:info, sql, :color => :green)
141
141
  @client.query(sql) unless @options[:dry_run]
142
142
  end
143
143
 
144
144
  def delete(sql)
145
- log(:info, sql, :red)
145
+ log(:info, sql, :color => :red)
146
146
  @client.query(sql) unless @options[:dry_run]
147
147
  end
148
148
 
@@ -44,7 +44,7 @@ class Gratan::DSL::Context
44
44
  expired = Time.parse(expired)
45
45
 
46
46
  if Time.new >= expired
47
- log(:warn, "User `#{name}@#{host}` has expired", :yellow)
47
+ log(:warn, "User `#{name}@#{host}` has expired", :color => :yellow)
48
48
  return
49
49
  end
50
50
  end
@@ -17,7 +17,7 @@ class Gratan::Identifier::CSV
17
17
  password = @passwords[user_host]
18
18
 
19
19
  unless password
20
- log(:warn, "password for `#{user_host}` can not be found", :yellow)
20
+ log(:warn, "password for `#{user_host}` can not be found", :color => :yellow)
21
21
  end
22
22
 
23
23
  password
@@ -16,12 +16,16 @@ class Gratan::Logger < ::Logger
16
16
  end
17
17
 
18
18
  module Helper
19
- def log(level, message, color = nil)
20
- options = @options || {}
19
+ def log(level, message, options = {})
20
+ global_options = @options || {}
21
21
  message = "[#{level.to_s.upcase}] #{message}" unless level == :info
22
- message << ' (dry-run)' if options[:dry_run]
23
- message = message.send(color) if color
24
- logger = options[:logger] || Gratan::Logger.instance
22
+
23
+ if global_options[:dry_run] and options[:dry_run] != false
24
+ message << ' (dry-run)' if global_options[:dry_run]
25
+ end
26
+
27
+ message = message.send(options[:color]) if options[:color]
28
+ logger = global_options[:logger] || Gratan::Logger.instance
25
29
  logger.send(level, message)
26
30
  end
27
31
  end
@@ -1,3 +1,3 @@
1
1
  module Gratan
2
- VERSION = '0.1.3'
2
+ VERSION = '0.1.4'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gratan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara