itsf_services 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dc9a40a936a12bef4474e68c09d5327d99939c1f
4
- data.tar.gz: dc2b96dc8172bc2db4b3cede262dd0ac1aee9bb6
3
+ metadata.gz: 74a981c75c7e8955def845fd9454ad0e691c6157
4
+ data.tar.gz: cc70b2a7599f0c6f6a9aee654a3f8473a7d52eb2
5
5
  SHA512:
6
- metadata.gz: b8c666882f0f0cd413bc5b14a266d90b7640a27e0dc53aee2f64dd578fb1dcb2816cdef0ddce107e57fa5423fda13774630ef374115ef328ef2a40ba2e611673
7
- data.tar.gz: 3f4cc137a9cf6ce993d914219f8d06bdd9e0f4c443073cbc9d2c04e982ecf8cae836c8069a37c6e1ca061713b19d31d088256a5b3f47703d0006839417b9ac05
6
+ metadata.gz: 98c588ef74c47c494ac42d3d946a00067fc13a13cf1991e2a878354f4bb13caf31a0430927d45481eb3f8b33659c676af40dbae665d527a0e991c569680d2a71
7
+ data.tar.gz: ca180903df9fe060c284679ff38261301536fe271927d5efe4dccc28e6e5b496f827b017cc2a89860961c97938746a7abe9da86600c5257ebda3f3b89785252f
@@ -0,0 +1,15 @@
1
+ module Itsf
2
+ module Services
3
+ module Generators
4
+ class InstallGenerator < Rails::Generators::Base
5
+ desc 'Generates the initializer'
6
+
7
+ source_root File.expand_path('../templates', __FILE__)
8
+
9
+ def generate_initializer
10
+ copy_file 'initializer.rb', 'config/initializers/itsf_services.rb'
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,19 @@
1
+ Itsf::Services.configure do |config|
2
+ # Set verbosity level by environment and level.
3
+ #
4
+ # Listed verbosity levels will be silenced and don't generate output.
5
+ #
6
+ # Default:
7
+ #
8
+ # config.silenced_levels = {
9
+ # test: [],
10
+ # development: [],
11
+ # production: []
12
+ # }
13
+ #
14
+ config.silenced_levels = {
15
+ test: [],
16
+ development: [],
17
+ production: []
18
+ }
19
+ end
data/lib/itsf/services.rb CHANGED
@@ -1,4 +1,7 @@
1
+ require 'itsf/services/configuration'
2
+
1
3
  module Itsf
2
4
  module Services
5
+ extend Configuration
3
6
  end
4
- end
7
+ end
@@ -0,0 +1,25 @@
1
+ require 'active_support/core_ext/module/delegation'
2
+ require 'active_support/core_ext/module/attribute_accessors'
3
+ require 'active_support/hash_with_indifferent_access'
4
+
5
+ module Itsf
6
+ module Services
7
+ module Configuration
8
+ def configure
9
+ yield self
10
+ end
11
+
12
+ mattr_accessor :silenced_levels do
13
+ {
14
+ test: [],
15
+ development: [],
16
+ production: []
17
+ }
18
+ end
19
+
20
+ def silenced_levels=(silenced_levels)
21
+ @@silenced_levels = silenced_levels.with_indifferent_access
22
+ end
23
+ end
24
+ end
25
+ end
@@ -74,7 +74,7 @@ module Itsf
74
74
  indent = options.delete(:indent)
75
75
  level = options.delete(:level)
76
76
  formatted_message = "[#{self.class.name}]: #{' ' * indent}#{message}"
77
- puts formatted_message
77
+ puts formatted_message unless Itsf::Services.silenced_levels[Rails.env].include?(level)
78
78
  @_messages << Services::V2::Message::Base.new(service_class: self.class, message: message, level: level, indent: indent)
79
79
  true
80
80
  end
@@ -1,5 +1,5 @@
1
1
  module Itsf
2
2
  module Services
3
- VERSION = '0.2.1'
3
+ VERSION = '0.3.0'
4
4
  end
5
5
  end
data/lib/itsf_services.rb CHANGED
@@ -3,4 +3,4 @@ require 'itsf/services/v2/service/base'
3
3
  require 'itsf/services/v2/response/base'
4
4
 
5
5
  require 'itsf/services'
6
- require 'itsf/services/engine'
6
+ require 'itsf/services/engine'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: itsf_services
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roberto Vasquez Angel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-28 00:00:00.000000000 Z
11
+ date: 2017-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -54,7 +54,10 @@ files:
54
54
  - app/helpers/itsf/services/application_helper.rb
55
55
  - app/views/layouts/itsf/services/application.html.erb
56
56
  - config/routes.rb
57
+ - lib/generators/itsf/services/install/install_generator.rb
58
+ - lib/generators/itsf/services/install/templates/initializer.rb
57
59
  - lib/itsf/services.rb
60
+ - lib/itsf/services/configuration.rb
58
61
  - lib/itsf/services/engine.rb
59
62
  - lib/itsf/services/v2/message/base.rb
60
63
  - lib/itsf/services/v2/response/base.rb