wherever-positions 0.4.6 → 0.4.7
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -0
- data/Gemfile.lock +2 -0
- data/VERSION +1 -1
- data/lib/method_logging.rb +4 -2
- data/lib/wherever/wherever/accessors.rb +1 -1
- data/spec/method_logging_spec.rb +4 -2
- data/spec/spec_helper.rb +1 -0
- data/wherever-positions.gemspec +4 -1
- metadata +17 -3
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.7
|
data/lib/method_logging.rb
CHANGED
@@ -12,7 +12,7 @@ module MethodLogging
|
|
12
12
|
klass.send :alias_method, :"#{method}_without_logging", method
|
13
13
|
klass.class_eval <<-END
|
14
14
|
def #{method}_with_logging(*args)
|
15
|
-
MethodLogging.log("Called: #{method}(\#{MethodLogging.strify(*args)})")
|
15
|
+
MethodLogging.log("Called #{Time.now}: #{method}(\#{MethodLogging.strify(*args)})")
|
16
16
|
#{method}_without_logging(*args)
|
17
17
|
end
|
18
18
|
END
|
@@ -20,7 +20,9 @@ module MethodLogging
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def log(string)
|
23
|
-
File.
|
23
|
+
path = Class.constants.include?('RAILS_ROOT') ? RAILS_ROOT : File.expand_path(File.dirname(__FILE__) + '/..')
|
24
|
+
FileUtils.mkdir_p("#{path}/log") if File.exists?("#{path}/log")
|
25
|
+
File.open("#{path}/log/method.log", 'a') do |f|
|
24
26
|
f.puts string
|
25
27
|
end
|
26
28
|
end
|
data/spec/method_logging_spec.rb
CHANGED
@@ -8,11 +8,13 @@ describe "Wherever", 'method logging' do
|
|
8
8
|
let(:file) { mock(:file_io) }
|
9
9
|
before do
|
10
10
|
MethodLogging.stub(:log => true)
|
11
|
+
Timecop.travel(Time.now)
|
11
12
|
end
|
13
|
+
after { Timecop.return }
|
12
14
|
context 'the add method' do
|
13
15
|
|
14
16
|
it 'is logged to file' do
|
15
|
-
call_string = %Q{Called: add({"unsettled" => 0, "settled" => 100}, {"keys" => {"fund_id" => 2}, "unique" => {"trade_id" => 12, "version" => 1}})}
|
17
|
+
call_string = %Q{Called #{Time.now}: add({"unsettled" => 0, "settled" => 100}, {"keys" => {"fund_id" => 2}, "unique" => {"trade_id" => 12, "version" => 1}})}
|
16
18
|
MethodLogging.should_receive(:log).with(call_string)
|
17
19
|
wherever.add({"settled" => 100, "unsettled" => 0}, options)
|
18
20
|
end
|
@@ -20,7 +22,7 @@ describe "Wherever", 'method logging' do
|
|
20
22
|
|
21
23
|
context 'the get key method' do
|
22
24
|
it 'is logged to file' do
|
23
|
-
call_string = %Q{Called: get_key_store("identifier")}
|
25
|
+
call_string = %Q{Called #{Time.now}: get_key_store("identifier")}
|
24
26
|
MethodLogging.should_receive(:log).with(call_string)
|
25
27
|
wherever.get_key_store("identifier").datasets.all
|
26
28
|
end
|
data/spec/spec_helper.rb
CHANGED
data/wherever-positions.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{wherever-positions}
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.7"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["David Henry"]
|
@@ -76,6 +76,7 @@ Gem::Specification.new do |s|
|
|
76
76
|
s.add_development_dependency(%q<rcov>, [">= 0"])
|
77
77
|
s.add_development_dependency(%q<ruby-debug>, [">= 0"])
|
78
78
|
s.add_development_dependency(%q<database_cleaner>, [">= 0"])
|
79
|
+
s.add_development_dependency(%q<timecop>, [">= 0"])
|
79
80
|
else
|
80
81
|
s.add_dependency(%q<bson_ext>, [">= 0"])
|
81
82
|
s.add_dependency(%q<mongoid>, [">= 0"])
|
@@ -86,6 +87,7 @@ Gem::Specification.new do |s|
|
|
86
87
|
s.add_dependency(%q<rcov>, [">= 0"])
|
87
88
|
s.add_dependency(%q<ruby-debug>, [">= 0"])
|
88
89
|
s.add_dependency(%q<database_cleaner>, [">= 0"])
|
90
|
+
s.add_dependency(%q<timecop>, [">= 0"])
|
89
91
|
end
|
90
92
|
else
|
91
93
|
s.add_dependency(%q<bson_ext>, [">= 0"])
|
@@ -97,6 +99,7 @@ Gem::Specification.new do |s|
|
|
97
99
|
s.add_dependency(%q<rcov>, [">= 0"])
|
98
100
|
s.add_dependency(%q<ruby-debug>, [">= 0"])
|
99
101
|
s.add_dependency(%q<database_cleaner>, [">= 0"])
|
102
|
+
s.add_dependency(%q<timecop>, [">= 0"])
|
100
103
|
end
|
101
104
|
end
|
102
105
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wherever-positions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 1
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 7
|
10
|
+
version: 0.4.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- David Henry
|
@@ -150,6 +150,20 @@ dependencies:
|
|
150
150
|
prerelease: false
|
151
151
|
type: :development
|
152
152
|
requirement: *id009
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: timecop
|
155
|
+
version_requirements: &id010 !ruby/object:Gem::Requirement
|
156
|
+
none: false
|
157
|
+
requirements:
|
158
|
+
- - ">="
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
hash: 3
|
161
|
+
segments:
|
162
|
+
- 0
|
163
|
+
version: "0"
|
164
|
+
prerelease: false
|
165
|
+
type: :development
|
166
|
+
requirement: *id010
|
153
167
|
description: Allow Store of positions by multiple keys with teh option to mark specific points in time for use later
|
154
168
|
email: dw_henry@yahoo.com.au
|
155
169
|
executables: []
|