droid_services 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,4 @@
1
1
  require "droid_services/version"
2
- require "droid_services/extensions/has_logger.rb"
3
2
  require "droid_services/extensions/has_resource.rb"
4
3
  require "droid_services/extensions/has_response.rb"
5
4
  require "droid_services/extensions/has_callbacks.rb"
@@ -1,5 +1,6 @@
1
+ require 'has_active_logger'
1
2
  class DroidServices::Base
2
- include DroidServices::Extensions::HasLogger
3
+ include HasActiveLogger::Mixin
3
4
  include DroidServices::Extensions::HasResponse
4
5
 
5
6
  attr_accessor :params, :accessor
@@ -1,3 +1,4 @@
1
+ require 'active_support'
1
2
  module DroidServices::Extensions
2
3
  module HasResource
3
4
  extend ActiveSupport::Concern
@@ -1,3 +1,3 @@
1
1
  module DroidServices
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: droid_services
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,23 +12,7 @@ cert_chain: []
12
12
  date: 2013-05-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: yell
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: '0'
22
- type: :runtime
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ! '>='
28
- - !ruby/object:Gem::Version
29
- version: '0'
30
- - !ruby/object:Gem::Dependency
31
- name: json
15
+ name: activesupport
32
16
  requirement: !ruby/object:Gem::Requirement
33
17
  none: false
34
18
  requirements:
@@ -44,7 +28,7 @@ dependencies:
44
28
  - !ruby/object:Gem::Version
45
29
  version: '0'
46
30
  - !ruby/object:Gem::Dependency
47
- name: activesupport
31
+ name: has_active_logger
48
32
  requirement: !ruby/object:Gem::Requirement
49
33
  none: false
50
34
  requirements:
@@ -75,7 +59,7 @@ dependencies:
75
59
  - - ! '>='
76
60
  - !ruby/object:Gem::Version
77
61
  version: '0'
78
- description: Droid DroidServices
62
+ description: Droid Services
79
63
  email:
80
64
  executables: []
81
65
  extensions: []
@@ -87,7 +71,6 @@ files:
87
71
  - lib/droid_services/decorator.rb
88
72
  - lib/droid_services/extensions/has_callbacks.rb
89
73
  - lib/droid_services/extensions/has_decorator.rb
90
- - lib/droid_services/extensions/has_logger.rb
91
74
  - lib/droid_services/extensions/has_resource.rb
92
75
  - lib/droid_services/extensions/has_response.rb
93
76
  - lib/droid_services/extensions/has_service.rb
@@ -103,7 +86,6 @@ files:
103
86
  - spec/services/decorator_spec.rb
104
87
  - spec/services/extensions/has_callbacks_spec.rb
105
88
  - spec/services/extensions/has_decorator_spec.rb
106
- - spec/services/extensions/has_logger_spec.rb
107
89
  - spec/services/extensions/has_resource_spec.rb
108
90
  - spec/services/extensions/has_response_spec.rb
109
91
  - spec/services/response_spec.rb
@@ -132,7 +114,7 @@ rubyforge_project:
132
114
  rubygems_version: 1.8.25
133
115
  signing_key:
134
116
  specification_version: 3
135
- summary: Droid DroidServices
117
+ summary: Droid Services
136
118
  test_files:
137
119
  - spec/services/base_resource_spec.rb
138
120
  - spec/services/base_spec.rb
@@ -140,7 +122,6 @@ test_files:
140
122
  - spec/services/decorator_spec.rb
141
123
  - spec/services/extensions/has_callbacks_spec.rb
142
124
  - spec/services/extensions/has_decorator_spec.rb
143
- - spec/services/extensions/has_logger_spec.rb
144
125
  - spec/services/extensions/has_resource_spec.rb
145
126
  - spec/services/extensions/has_response_spec.rb
146
127
  - spec/services/response_spec.rb
@@ -1,60 +0,0 @@
1
- require 'yell'
2
- require 'active_support'
3
- require 'active_support/core_ext/kernel/reporting'
4
- require 'active_support/inflector'
5
- require 'json'
6
-
7
- module DroidServices::Extensions
8
- module HasLogger
9
- extend ActiveSupport::Concern
10
-
11
- silence_warnings do
12
- Yell::Formatter::PatternRegexp = /([^%]*)(%\d*)?(#{Yell::Formatter::PatternTable.keys.join('|')})?(.*)/m
13
- end
14
-
15
- included do
16
- class << self
17
- def logger
18
- @logger ||= Yell.new do |l|
19
- l.adapter :datefile, log_file,
20
- level: (:debug..:fatal),
21
- format: Yell.format( "%d [%5L] #%M at %F:%n\n%m\n\n", "%H:%M:%S" ),
22
- date_pattern: "%Y-week-%V",
23
- symlink_original_filename: true,
24
- keep: 4
25
- end
26
- end
27
-
28
- def format_message(message)
29
- case message
30
- when String
31
- message
32
- when Hash, Array
33
- JSON::pretty_generate message
34
- else message.inspect
35
- end
36
- end
37
-
38
- private
39
- def log_file
40
- path = File.join(rails_log_path, "#{self.name.underscore}.log")
41
- FileUtils.mkdir_p File.dirname(path)
42
- path.to_s
43
- end
44
-
45
- def rails_log_path
46
- File.join(Rails.root, 'log', Rails.env)
47
- end
48
- end
49
-
50
- def logger
51
- self.class.logger
52
- end
53
-
54
- def format_message(message)
55
- self.class.format_message(message)
56
- end
57
- end
58
-
59
- end
60
- end
@@ -1,41 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module DroidServices
4
- describe DroidServices::Extensions::HasLogger do
5
- include DroidServices::Extensions::HasLogger
6
-
7
- before { self.class.stub!(:rails_log_path).and_return('./log') }
8
-
9
- describe '#logger' do
10
- it { logger.should be_kind_of(Yell::Logger) }
11
- end
12
-
13
- describe '#format_message' do
14
- context 'when String' do
15
- let(:message) { 'Some test' }
16
- it { format_message(message).should be_kind_of(String) }
17
- it { format_message(message).should eq('Some test')}
18
- end
19
-
20
- context 'when Hash' do
21
- let(:message) { {'dog' => 'canine', 'cat' => 'feline', 12 => 'number', user: {nick: 'Guru', 'name' => 'User'}} }
22
- it { format_message(message).should be_kind_of(String) }
23
- it { format_message(message).should eq("{\n \"dog\": \"canine\",\n \"cat\": \"feline\",\n \"12\": \"number\",\n \"user\": {\n \"nick\": \"Guru\",\n \"name\": \"User\"\n }\n}") }
24
- end
25
-
26
- context 'when Array' do
27
- let(:message) { ['dog', 'cat', 'number'] }
28
- it { format_message(message).should be_kind_of(String) }
29
- it { format_message(message).should eq("[\n \"dog\",\n \"cat\",\n \"number\"\n]") }
30
- end
31
-
32
- context 'when some object' do
33
- let(:message) { mock }
34
- it 'should inspect object' do
35
- message.should_receive(:inspect)
36
- format_message(message)
37
- end
38
- end
39
- end
40
- end
41
- end