logworm 0.7.5 → 0.7.6
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.
- data/CHANGELOG +3 -0
- data/Manifest +2 -0
- data/Rakefile +1 -1
- data/lib/base/config.rb +10 -5
- data/lib/base/query_builder.rb +3 -1
- data/logworm.gemspec +3 -3
- data/spec/builder_spec.rb +26 -0
- data/spec/config_spec.rb +36 -0
- metadata +5 -3
data/CHANGELOG
CHANGED
data/Manifest
CHANGED
data/Rakefile
CHANGED
data/lib/base/config.rb
CHANGED
@@ -7,19 +7,24 @@ module Logworm
|
|
7
7
|
|
8
8
|
include ::Singleton
|
9
9
|
|
10
|
-
FILENAME = "
|
10
|
+
FILENAME = ".logworm"
|
11
11
|
|
12
12
|
def initialize
|
13
|
+
read
|
14
|
+
end
|
15
|
+
|
16
|
+
def read
|
13
17
|
@file_found = false
|
14
18
|
@url = nil
|
15
19
|
begin
|
16
|
-
f = File.new(FILENAME, 'r')
|
20
|
+
f = File.new("./" + FILENAME, 'r')
|
17
21
|
@url = f.readline.strip
|
18
22
|
@file_found = true
|
19
23
|
rescue Errno::ENOENT => e
|
20
24
|
end
|
25
|
+
self
|
21
26
|
end
|
22
|
-
|
27
|
+
|
23
28
|
def url
|
24
29
|
@url
|
25
30
|
end
|
@@ -29,10 +34,10 @@ module Logworm
|
|
29
34
|
end
|
30
35
|
|
31
36
|
def save(url)
|
32
|
-
File.open(FILENAME, 'w') do |f|
|
37
|
+
File.open("./" + FILENAME, 'w') do |f|
|
33
38
|
f.puts url
|
34
39
|
end rescue Exception
|
35
|
-
%x[echo
|
40
|
+
%x[echo #{FILENAME} >> .gitignore]
|
36
41
|
end
|
37
42
|
|
38
43
|
end
|
data/lib/base/query_builder.rb
CHANGED
@@ -70,7 +70,9 @@ module Logworm
|
|
70
70
|
###
|
71
71
|
@tf = {}
|
72
72
|
@tf[:start] = unquote(@options[:start]).to_s if is_set?(@options[:start]) or is_set?(@options[:start], Integer, 0)
|
73
|
-
@tf[:
|
73
|
+
@tf[:start] = unquote(@options[:start].strftime("%Y-%m-%dT%H:%M:%SZ")).to_s if is_set?(@options[:start], Time)
|
74
|
+
@tf[:end] = unquote(@options[:end]).to_s if is_set?(@options[:end]) or is_set?(@options[:end], Integer, 0)
|
75
|
+
@tf[:end] = unquote(@options[:end].strftime("%Y-%m-%dT%H:%M:%SZ")).to_s if is_set?(@options[:end], Time)
|
74
76
|
query_opts << '"timeframe":' + @tf.to_json if @tf.keys.size > 0
|
75
77
|
|
76
78
|
###
|
data/logworm.gemspec
CHANGED
@@ -2,15 +2,15 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{logworm}
|
5
|
-
s.version = "0.7.
|
5
|
+
s.version = "0.7.6"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Pomelo, LLC"]
|
9
|
-
s.date = %q{2010-04-
|
9
|
+
s.date = %q{2010-04-26}
|
10
10
|
s.description = %q{logworm logging tool}
|
11
11
|
s.email = %q{schapira@pomelollc.com}
|
12
12
|
s.extra_rdoc_files = ["CHANGELOG", "README", "lib/base/config.rb", "lib/base/db.rb", "lib/base/query_builder.rb", "lib/logworm.rb"]
|
13
|
-
s.files = ["CHANGELOG", "Manifest", "README", "Rakefile", "lib/base/config.rb", "lib/base/db.rb", "lib/base/query_builder.rb", "lib/logworm.rb", "spec/base_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "tests/builder_test.rb", "logworm.gemspec"]
|
13
|
+
s.files = ["CHANGELOG", "Manifest", "README", "Rakefile", "lib/base/config.rb", "lib/base/db.rb", "lib/base/query_builder.rb", "lib/logworm.rb", "spec/base_spec.rb", "spec/builder_spec.rb", "spec/config_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "tests/builder_test.rb", "logworm.gemspec"]
|
14
14
|
s.homepage = %q{http://www.logworm.com}
|
15
15
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Logworm", "--main", "README"]
|
16
16
|
s.require_paths = ["lib"]
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
|
3
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
4
|
+
|
5
|
+
$: << File.dirname(__FILE__) + '/../lib'
|
6
|
+
require 'logworm.rb'
|
7
|
+
|
8
|
+
describe Logworm::QueryBuilder, " timeframes" do
|
9
|
+
|
10
|
+
it " should accept Strings as time" do
|
11
|
+
Logworm::QueryBuilder.new(:start => "2010-01-01").to_json.should == '{"timeframe":{"start":"2010-01-01"}}'
|
12
|
+
Logworm::QueryBuilder.new(:end => "2010-01-01").to_json.should == '{"timeframe":{"end":"2010-01-01"}}'
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should accept an Integer as time, to mean the year" do
|
16
|
+
Logworm::QueryBuilder.new(:start => 2010).to_json.should == '{"timeframe":{"start":"2010"}}'
|
17
|
+
Logworm::QueryBuilder.new(:end => 2010).to_json.should == '{"timeframe":{"end":"2010"}}'
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should accept a Time object" do
|
21
|
+
ts = Time.now
|
22
|
+
Logworm::QueryBuilder.new(:start => ts).to_json.should == '{"timeframe":{"start":"' + ts.strftime("%Y-%m-%dT%H:%M:%SZ") + '"}}'
|
23
|
+
Logworm::QueryBuilder.new(:end => ts).to_json.should == '{"timeframe":{"end":"' + ts.strftime("%Y-%m-%dT%H:%M:%SZ") + '"}}'
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
data/spec/config_spec.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'webmock'
|
3
|
+
|
4
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
5
|
+
|
6
|
+
$: << File.dirname(__FILE__) + '/../lib'
|
7
|
+
require 'logworm.rb'
|
8
|
+
|
9
|
+
describe Logworm::Config, " initialization" do
|
10
|
+
|
11
|
+
before do
|
12
|
+
%x[rm .logworm]
|
13
|
+
%x[mv .gitignore .gitignore_old]
|
14
|
+
end
|
15
|
+
|
16
|
+
after do
|
17
|
+
%x[mv .gitignore_old .gitignore]
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should create a new .logworm file on save" do
|
21
|
+
url = "xxx"
|
22
|
+
File.should_not exist(".logworm")
|
23
|
+
Logworm::Config.instance.save(url)
|
24
|
+
File.should exist(".logworm")
|
25
|
+
Logworm::Config.instance.read.should be_file_found
|
26
|
+
Logworm::Config.instance.url.should == url
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should add .logworm to .gitignore" do
|
30
|
+
File.should_not exist(".gitignore")
|
31
|
+
Logworm::Config.instance.save("xxx")
|
32
|
+
File.should exist(".gitignore")
|
33
|
+
File.open('.gitignore').readline.strip.should == ".logworm"
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 7
|
8
|
-
-
|
9
|
-
version: 0.7.
|
8
|
+
- 6
|
9
|
+
version: 0.7.6
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Pomelo, LLC
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-04-
|
17
|
+
date: 2010-04-26 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -136,6 +136,8 @@ files:
|
|
136
136
|
- lib/base/query_builder.rb
|
137
137
|
- lib/logworm.rb
|
138
138
|
- spec/base_spec.rb
|
139
|
+
- spec/builder_spec.rb
|
140
|
+
- spec/config_spec.rb
|
139
141
|
- spec/spec.opts
|
140
142
|
- spec/spec_helper.rb
|
141
143
|
- tests/builder_test.rb
|