file_series 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/Rakefile +10 -24
- data/lib/file_series.rb +5 -5
- data/lib/file_series/version.rb +3 -0
- data/spec/file_series_spec.rb +41 -44
- data/spec/spec_helper.rb +2 -2
- metadata +11 -90
- data/.autotest +0 -5
- data/.document +0 -5
- data/.rspec +0 -1
- data/.ruby-gemset +0 -1
- data/.ruby-version +0 -1
- data/Gemfile +0 -14
- data/Gemfile.lock +0 -68
- data/README.rdoc +0 -37
- data/VERSION +0 -1
- data/file_series.gemspec +0 -67
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
NmFmYTNhYzczMGUwMzAzNGYzZWE4MDhiMTJhNmJiZDA5NjNlYzNjNA==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9f1a5a93427184170db98687e6227ddb2723499b
|
4
|
+
data.tar.gz: 04bfa36aeac8518fc8d7d04bb25ea11e2079c9d7
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
MTVhZTgyMzcxMTI2ODRkMmIyZTJiMjI2OGRmNmIwNmYyMjlhYmQwMTk2Mzcx
|
11
|
-
ZWMxZTRmNmRlYzE1NzA2ZDk2NjRkZWQwOTU5NzVmMjY3MTBiYzM=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
YWEwMmY4OWNmNTZlOTI2ZjE1NGNjZTlmYzc2MjQ3MWEyYmQ2MDYxNmM3ODgx
|
14
|
-
M2QwYTM5ZjU2ZWRiOWEzMDU0MTU0Mzc5NDk0ZGY5MjViNTAyMGZhMDc4N2Jh
|
15
|
-
MzU3NWY1MTRhNmFkMWY4ZmQ1NTVmZDhiNTRiMzdhZGUwMWM5NmU=
|
6
|
+
metadata.gz: 1e1e85d3da163f0d5fb2c58f5eab4f9eb258f996454a13b754d7f15e69999a0b207f8981a7165c8cb3260e29970569839cf8ca684468253d08d3294bf4f521b5
|
7
|
+
data.tar.gz: 753f5982f453772960c5108f2b4905257313d8312f269536c170620db10b2ab9065d593f7ed2ac35d3ce236f39438f75f9bfc807d10d53b8db2dc5dc0abd95fb
|
data/Rakefile
CHANGED
@@ -1,29 +1,10 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'rubygems'
|
4
|
-
require 'bundler'
|
5
1
|
begin
|
6
|
-
|
7
|
-
rescue
|
8
|
-
|
9
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
-
exit e.status_code
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
11
5
|
end
|
12
|
-
require 'rake'
|
13
6
|
|
14
|
-
|
15
|
-
Jeweler::Tasks.new do |gem|
|
16
|
-
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
-
gem.name = "file_series"
|
18
|
-
gem.homepage = "http://github.com/tedconf/file_series"
|
19
|
-
gem.license = "MIT"
|
20
|
-
gem.summary = "Write to a series of time-based files."
|
21
|
-
gem.description = "Automatically start writing to a new file every X seconds without any locking or file moving/renaming."
|
22
|
-
gem.email = "alex@crackpot.org"
|
23
|
-
gem.authors = ["Alex Dean"]
|
24
|
-
# dependencies defined in Gemfile
|
25
|
-
end
|
26
|
-
Jeweler::RubygemsDotOrgTasks.new
|
7
|
+
Bundler::GemHelper.install_tasks
|
27
8
|
|
28
9
|
require 'rspec/core'
|
29
10
|
require 'rspec/core/rake_task'
|
@@ -36,7 +17,12 @@ RSpec::Core::RakeTask.new(:rcov) do |spec|
|
|
36
17
|
spec.rcov = true
|
37
18
|
end
|
38
19
|
|
39
|
-
|
20
|
+
if ENV['COVERAGE']
|
21
|
+
require 'ci/reporter/rake/rspec'
|
22
|
+
task spec: 'ci:setup:rspec'
|
23
|
+
end
|
24
|
+
|
25
|
+
task default: :spec
|
40
26
|
|
41
27
|
require 'rdoc/task'
|
42
28
|
Rake::RDocTask.new do |rdoc|
|
data/lib/file_series.rb
CHANGED
@@ -18,6 +18,7 @@ require 'time'
|
|
18
18
|
# :separator - string. Appended to each write. Defaults to \n. Use something else in :binary mode.
|
19
19
|
#
|
20
20
|
|
21
|
+
# FileSeries rubocop loves comments
|
21
22
|
class FileSeries
|
22
23
|
DEFAULT_DIR = '.'
|
23
24
|
DEFAULT_PREFIX = 'log'
|
@@ -29,7 +30,7 @@ class FileSeries
|
|
29
30
|
attr_accessor :file
|
30
31
|
attr_accessor :current_ts
|
31
32
|
|
32
|
-
def initialize(options={})
|
33
|
+
def initialize(options = {})
|
33
34
|
@dir = options[:dir] || DEFAULT_DIR
|
34
35
|
@file = nil
|
35
36
|
@current_ts = nil
|
@@ -65,7 +66,7 @@ class FileSeries
|
|
65
66
|
|
66
67
|
# close current file handle and open a new one for a new logging period.
|
67
68
|
# ts defaults to the current time period.
|
68
|
-
def rotate(ts=nil)
|
69
|
+
def rotate(ts = nil)
|
69
70
|
ts ||= this_period
|
70
71
|
@file.close if @file
|
71
72
|
@file = File.open(filename(ts), "a#{'b' if @binary_mode}")
|
@@ -77,7 +78,7 @@ class FileSeries
|
|
77
78
|
# defaults to current time period.
|
78
79
|
#
|
79
80
|
# changes to filename structure must be matched by changes to parse_filename
|
80
|
-
def filename(ts=nil)
|
81
|
+
def filename(ts = nil)
|
81
82
|
ts ||= this_period
|
82
83
|
File.join(@dir, "#{@filename_prefix}-#{Time.at(ts).utc.strftime('%Y%m%d-%H%M%SZ')}-#{@rotate_freq}.log")
|
83
84
|
end
|
@@ -116,10 +117,9 @@ class FileSeries
|
|
116
117
|
# enumerate over all the writes in a series, across all files.
|
117
118
|
def each
|
118
119
|
complete_files.sort.each do |file|
|
119
|
-
File.open(file,"r#{'b' if @binary_mode}").each_line(@separator) do |raw|
|
120
|
+
File.open(file, "r#{'b' if @binary_mode}").each_line(@separator) do |raw|
|
120
121
|
yield raw
|
121
122
|
end
|
122
123
|
end
|
123
124
|
end
|
124
|
-
|
125
125
|
end
|
data/spec/file_series_spec.rb
CHANGED
@@ -21,21 +21,21 @@ describe "FileSeries" do
|
|
21
21
|
it "should write to a new file if we are in a new time period" do
|
22
22
|
|
23
23
|
Timecop.freeze(Time.parse('1970-01-01 00:01:00Z'))
|
24
|
-
fs = FileSeries.new(:
|
24
|
+
fs = FileSeries.new(dir: test_dir, rotate_every: 10)
|
25
25
|
fs.write('foo')
|
26
26
|
|
27
|
-
name = File.join(test_dir,'log-19700101-000100Z-10.log')
|
28
|
-
File.exist?(name).
|
27
|
+
name = File.join(test_dir, 'log-19700101-000100Z-10.log')
|
28
|
+
expect(File.exist?(name)).to eq true
|
29
29
|
fs.file.flush
|
30
|
-
IO.read(name).
|
30
|
+
expect(IO.read(name)).to eq "foo\n"
|
31
31
|
|
32
32
|
Timecop.freeze(Time.parse('1970-01-01 00:01:15Z'))
|
33
33
|
fs.write('foo again')
|
34
34
|
|
35
|
-
name = File.join(test_dir,'log-19700101-000110Z-10.log')
|
36
|
-
File.exist?(name).
|
35
|
+
name = File.join(test_dir, 'log-19700101-000110Z-10.log')
|
36
|
+
expect(File.exist?(name)).to eq true
|
37
37
|
fs.file.flush
|
38
|
-
IO.read(name).
|
38
|
+
expect(IO.read(name)).to eq("foo again\n")
|
39
39
|
|
40
40
|
end
|
41
41
|
|
@@ -54,30 +54,29 @@ describe "FileSeries" do
|
|
54
54
|
it "should set sync to false by default" do
|
55
55
|
fs = FileSeries.new(dir: test_dir)
|
56
56
|
fs.write 'blah'
|
57
|
-
fs.file.sync.
|
57
|
+
expect(fs.file.sync).to eq false
|
58
58
|
end
|
59
59
|
|
60
60
|
it "should allow control of sync behavior" do
|
61
61
|
fs = FileSeries.new(sync: true, dir: test_dir)
|
62
62
|
fs.write 'blah'
|
63
|
-
fs.file.sync.
|
63
|
+
expect(fs.file.sync).to eq true
|
64
64
|
|
65
65
|
fs = FileSeries.new(sync: false, dir: test_dir)
|
66
66
|
fs.write 'blah'
|
67
|
-
fs.file.sync.
|
67
|
+
expect(fs.file.sync).to eq false
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
|
-
|
72
71
|
describe "#write" do
|
73
72
|
it "should call log_file.write with message and separator" do
|
74
|
-
fs = FileSeries.new(:
|
73
|
+
fs = FileSeries.new(separator: '...')
|
75
74
|
|
76
|
-
fs.
|
75
|
+
expect(fs).to receive(:log_file) do
|
77
76
|
d = double('log_file')
|
78
|
-
d.
|
77
|
+
expect(d).to receive(:write).with("foo...")
|
79
78
|
d
|
80
|
-
|
79
|
+
end
|
81
80
|
|
82
81
|
fs.write('foo')
|
83
82
|
end
|
@@ -86,30 +85,30 @@ describe "FileSeries" do
|
|
86
85
|
describe "#log_file" do
|
87
86
|
it "should call rotate if no file is open" do
|
88
87
|
fs = FileSeries.new
|
89
|
-
fs.
|
88
|
+
expect(fs).to receive(:rotate)
|
90
89
|
fs.log_file
|
91
90
|
end
|
92
91
|
end
|
93
92
|
|
94
93
|
describe "#this_period" do
|
95
94
|
it "should floor timestamp to the beginning of the current period" do
|
96
|
-
fs = FileSeries.new(
|
95
|
+
fs = FileSeries.new(rotate_every: 20)
|
97
96
|
now = Time.now.to_i
|
98
97
|
|
99
|
-
fs.this_period.
|
98
|
+
expect(fs.this_period).to eq(now - (now % 20))
|
100
99
|
end
|
101
100
|
end
|
102
101
|
|
103
102
|
describe "#filename" do
|
104
103
|
it "should accept a timestamp argument" do
|
105
|
-
fs = FileSeries.new(:
|
106
|
-
fs.filename(Time.parse('1970-01-01 00:20:34Z').to_i).
|
104
|
+
fs = FileSeries.new(dir: '/tmp', prefix: 'test', rotate_every: 60)
|
105
|
+
expect(fs.filename(Time.parse('1970-01-01 00:20:34Z').to_i)).to eq "/tmp/test-19700101-002034Z-60.log"
|
107
106
|
end
|
108
107
|
|
109
108
|
it "should use this_period when no timestamp is supplied" do
|
110
|
-
fs = FileSeries.new(:
|
111
|
-
fs.
|
112
|
-
fs.filename.
|
109
|
+
fs = FileSeries.new(dir: '/tmp', prefix: 'test', rotate_every: 3600)
|
110
|
+
expect(fs).to receive(:this_period) { Time.parse('1970-01-01 00:20:00Z').to_i }
|
111
|
+
expect(fs.filename).to eq("/tmp/test-19700101-002000Z-3600.log")
|
113
112
|
end
|
114
113
|
end
|
115
114
|
|
@@ -117,28 +116,28 @@ describe "FileSeries" do
|
|
117
116
|
it "should return a hash of information about a filename" do
|
118
117
|
data = FileSeries.parse_filename("/tmp/test-19700101-002000Z-3600.log")
|
119
118
|
|
120
|
-
data[:prefix].
|
121
|
-
data[:start_time].
|
122
|
-
data[:duration].
|
119
|
+
expect(data[:prefix]).to eq 'test'
|
120
|
+
expect(data[:start_time]).to eq Time.parse('1970-01-01T00:20:00Z')
|
121
|
+
expect(data[:duration]).to eq 3600
|
123
122
|
end
|
124
123
|
|
125
124
|
it "should have an instance version also" do
|
126
125
|
filename = "/tmp/test-19700101-002000Z-3600.log"
|
127
126
|
data1 = FileSeries.parse_filename(filename)
|
128
127
|
|
129
|
-
fs = FileSeries.new(:
|
128
|
+
fs = FileSeries.new(dir: '/tmp', prefix: 'test', rotate_every: 3600)
|
130
129
|
data2 = fs.parse_filename(filename)
|
131
130
|
|
132
|
-
data2.
|
131
|
+
expect(data2).to eq data1
|
133
132
|
end
|
134
133
|
|
135
134
|
end
|
136
135
|
|
137
136
|
describe "#path" do
|
138
137
|
it "should act like #filename with no arguments" do
|
139
|
-
fs = FileSeries.new(
|
140
|
-
fs.
|
141
|
-
fs.path.
|
138
|
+
fs = FileSeries.new(dir: '/tmp', prefix: 'test', rotate_every: 3600)
|
139
|
+
expect(fs).to receive(:this_period) { Time.parse('1970-01-01 00:20:00Z').to_i }
|
140
|
+
expect(fs.path).to eq("/tmp/test-19700101-002000Z-3600.log")
|
142
141
|
end
|
143
142
|
end
|
144
143
|
|
@@ -151,18 +150,18 @@ describe "FileSeries" do
|
|
151
150
|
'/tmp/prefix-19700101-000500Z-60.log',
|
152
151
|
]
|
153
152
|
|
154
|
-
Dir.
|
153
|
+
expect(Dir).to receive(:glob).with('/tmp/prefix-*-60.log').and_return(list)
|
155
154
|
|
156
155
|
Timecop.freeze(Time.parse('1970-01-01 00:05:05Z')) do
|
157
|
-
fs = FileSeries.new(:
|
158
|
-
fs.complete_files.
|
156
|
+
fs = FileSeries.new(dir: '/tmp', prefix: 'prefix', rotate_every: 60)
|
157
|
+
expect(fs.complete_files).to eq(list - ['/tmp/prefix-19700101-000500Z-60.log'])
|
159
158
|
end
|
160
159
|
end
|
161
160
|
end
|
162
161
|
|
163
162
|
describe "#each" do
|
164
163
|
it "should enumerate all lines in all files in a series" do
|
165
|
-
fs = FileSeries.new(:
|
164
|
+
fs = FileSeries.new(dir: test_dir, rotate_every: 60, prefix: 'events')
|
166
165
|
|
167
166
|
# write 3 files with consecutive integers.
|
168
167
|
Timecop.freeze(Time.parse('1970-01-01 01:00:00')) do
|
@@ -187,16 +186,16 @@ describe "FileSeries" do
|
|
187
186
|
out << line
|
188
187
|
end
|
189
188
|
|
190
|
-
out.
|
189
|
+
expect(out).to eq((0..29).to_a.map { |i| i.to_s + "\n" })
|
191
190
|
end
|
192
191
|
|
193
192
|
it "should enumerate all entries in a binary file series" do
|
194
193
|
fs = FileSeries.new(
|
195
|
-
:
|
196
|
-
:
|
197
|
-
:
|
198
|
-
:
|
199
|
-
:
|
194
|
+
binary: true,
|
195
|
+
separator: '!~!~!',
|
196
|
+
dir: test_dir,
|
197
|
+
prefix: 'bin',
|
198
|
+
rotate_every: 60
|
200
199
|
)
|
201
200
|
|
202
201
|
Timecop.freeze(Time.parse('1970-01-01 01:00:00')) do
|
@@ -222,9 +221,7 @@ describe "FileSeries" do
|
|
222
221
|
end
|
223
222
|
|
224
223
|
# note that we don't get the separator, and they're Fixnum not String
|
225
|
-
out.
|
226
|
-
|
224
|
+
expect(out).to eq((0..29).to_a.map { |i| i })
|
227
225
|
end
|
228
226
|
end
|
229
|
-
|
230
227
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -5,8 +5,8 @@ require 'file_series'
|
|
5
5
|
|
6
6
|
# Requires supporting files with custom matchers and macros, etc,
|
7
7
|
# in ./support/ and its subdirectories.
|
8
|
-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
8
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
9
9
|
|
10
10
|
RSpec.configure do |config|
|
11
|
-
|
11
|
+
|
12
12
|
end
|
metadata
CHANGED
@@ -1,107 +1,26 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: file_series
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Dean
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: rspec
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ~>
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 2.8.0
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ~>
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 2.8.0
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rdoc
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ~>
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '3.12'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ~>
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '3.12'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: bundler
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ~>
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: 1.6.0
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ~>
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: 1.6.0
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: jeweler
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ! '>='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ! '>='
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: timecop
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - '='
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: 0.3.5
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - '='
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: 0.3.5
|
11
|
+
date: 2016-05-13 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
83
13
|
description: Automatically start writing to a new file every X seconds without any
|
84
14
|
locking or file moving/renaming.
|
85
15
|
email: alex@crackpot.org
|
86
16
|
executables: []
|
87
17
|
extensions: []
|
88
|
-
extra_rdoc_files:
|
89
|
-
- LICENSE.txt
|
90
|
-
- README.rdoc
|
18
|
+
extra_rdoc_files: []
|
91
19
|
files:
|
92
|
-
- .autotest
|
93
|
-
- .document
|
94
|
-
- .rspec
|
95
|
-
- .ruby-gemset
|
96
|
-
- .ruby-version
|
97
|
-
- Gemfile
|
98
|
-
- Gemfile.lock
|
99
20
|
- LICENSE.txt
|
100
|
-
- README.rdoc
|
101
21
|
- Rakefile
|
102
|
-
- VERSION
|
103
|
-
- file_series.gemspec
|
104
22
|
- lib/file_series.rb
|
23
|
+
- lib/file_series/version.rb
|
105
24
|
- spec/file_series_spec.rb
|
106
25
|
- spec/spec_helper.rb
|
107
26
|
homepage: http://github.com/tedconf/file_series
|
@@ -114,18 +33,20 @@ require_paths:
|
|
114
33
|
- lib
|
115
34
|
required_ruby_version: !ruby/object:Gem::Requirement
|
116
35
|
requirements:
|
117
|
-
- -
|
36
|
+
- - ">="
|
118
37
|
- !ruby/object:Gem::Version
|
119
38
|
version: '0'
|
120
39
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
40
|
requirements:
|
122
|
-
- -
|
41
|
+
- - ">="
|
123
42
|
- !ruby/object:Gem::Version
|
124
43
|
version: '0'
|
125
44
|
requirements: []
|
126
45
|
rubyforge_project:
|
127
|
-
rubygems_version: 2.
|
46
|
+
rubygems_version: 2.5.2
|
128
47
|
signing_key:
|
129
48
|
specification_version: 4
|
130
49
|
summary: Write to a series of time-based files.
|
131
|
-
test_files:
|
50
|
+
test_files:
|
51
|
+
- spec/spec_helper.rb
|
52
|
+
- spec/file_series_spec.rb
|
data/.autotest
DELETED
data/.document
DELETED
data/.rspec
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--color
|
data/.ruby-gemset
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
file_series
|
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
1.9.3-p194
|
data/Gemfile
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
source "http://rubygems.org"
|
2
|
-
# Add dependencies required to use your gem here.
|
3
|
-
# Example:
|
4
|
-
# gem "activesupport", ">= 2.3.5"
|
5
|
-
|
6
|
-
# Add dependencies to develop your gem here.
|
7
|
-
# Include everything needed to run rake, tests, features, etc.
|
8
|
-
group :development do
|
9
|
-
gem "rspec", "~> 2.8.0"
|
10
|
-
gem "rdoc", "~> 3.12"
|
11
|
-
gem "bundler", "~> 1.6.0"
|
12
|
-
gem "jeweler"
|
13
|
-
gem "timecop", "0.3.5"
|
14
|
-
end
|
data/Gemfile.lock
DELETED
@@ -1,68 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: http://rubygems.org/
|
3
|
-
specs:
|
4
|
-
addressable (2.3.6)
|
5
|
-
builder (3.2.2)
|
6
|
-
descendants_tracker (0.0.4)
|
7
|
-
thread_safe (~> 0.3, >= 0.3.1)
|
8
|
-
diff-lcs (1.1.3)
|
9
|
-
faraday (0.9.0)
|
10
|
-
multipart-post (>= 1.2, < 3)
|
11
|
-
git (1.2.6)
|
12
|
-
github_api (0.11.3)
|
13
|
-
addressable (~> 2.3)
|
14
|
-
descendants_tracker (~> 0.0.1)
|
15
|
-
faraday (~> 0.8, < 0.10)
|
16
|
-
hashie (>= 1.2)
|
17
|
-
multi_json (>= 1.7.5, < 2.0)
|
18
|
-
nokogiri (~> 1.6.0)
|
19
|
-
oauth2
|
20
|
-
hashie (3.0.0)
|
21
|
-
highline (1.6.21)
|
22
|
-
jeweler (2.0.1)
|
23
|
-
builder
|
24
|
-
bundler (>= 1.0)
|
25
|
-
git (>= 1.2.5)
|
26
|
-
github_api
|
27
|
-
highline (>= 1.6.15)
|
28
|
-
nokogiri (>= 1.5.10)
|
29
|
-
rake
|
30
|
-
rdoc
|
31
|
-
json (1.8.1)
|
32
|
-
jwt (1.0.0)
|
33
|
-
mini_portile (0.6.0)
|
34
|
-
multi_json (1.10.1)
|
35
|
-
multi_xml (0.5.5)
|
36
|
-
multipart-post (2.0.0)
|
37
|
-
nokogiri (1.6.2.1)
|
38
|
-
mini_portile (= 0.6.0)
|
39
|
-
oauth2 (0.9.4)
|
40
|
-
faraday (>= 0.8, < 0.10)
|
41
|
-
jwt (~> 1.0)
|
42
|
-
multi_json (~> 1.3)
|
43
|
-
multi_xml (~> 0.5)
|
44
|
-
rack (~> 1.2)
|
45
|
-
rack (1.5.2)
|
46
|
-
rake (10.3.2)
|
47
|
-
rdoc (3.12.2)
|
48
|
-
json (~> 1.4)
|
49
|
-
rspec (2.8.0)
|
50
|
-
rspec-core (~> 2.8.0)
|
51
|
-
rspec-expectations (~> 2.8.0)
|
52
|
-
rspec-mocks (~> 2.8.0)
|
53
|
-
rspec-core (2.8.0)
|
54
|
-
rspec-expectations (2.8.0)
|
55
|
-
diff-lcs (~> 1.1.2)
|
56
|
-
rspec-mocks (2.8.0)
|
57
|
-
thread_safe (0.3.4)
|
58
|
-
timecop (0.3.5)
|
59
|
-
|
60
|
-
PLATFORMS
|
61
|
-
ruby
|
62
|
-
|
63
|
-
DEPENDENCIES
|
64
|
-
bundler (~> 1.6.0)
|
65
|
-
jeweler
|
66
|
-
rdoc (~> 3.12)
|
67
|
-
rspec (~> 2.8.0)
|
68
|
-
timecop (= 0.3.5)
|
data/README.rdoc
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
= file_series
|
2
|
-
|
3
|
-
FileSeries is a Ruby library for writing to a group of files.
|
4
|
-
|
5
|
-
Writes will be directed to new files at a configurable frequency.
|
6
|
-
|
7
|
-
=> logger = FileSeries.new('.', :prefix=>'test', :rotate_every=>60)
|
8
|
-
=> logger.write("some message\n")
|
9
|
-
|
10
|
-
This will create a file like 'test-1342477810-60.log'. A new file will be
|
11
|
-
created every 60 seconds. You don't need to do anything except keep calling
|
12
|
-
logger.write().
|
13
|
-
|
14
|
-
Files are created as needed, so you won't end up with lots of 0-length files.
|
15
|
-
If you do see a recent 0-length file, it's probably due to your OS buffering
|
16
|
-
writes to the file.
|
17
|
-
|
18
|
-
Other configuration options:
|
19
|
-
|
20
|
-
:binary - boolean. If true, log files are opened in binary mode. (Useful for Marshal.dump)
|
21
|
-
:separator - string. Appended to each write. Defaults to \n. Use something else in :binary mode.
|
22
|
-
|
23
|
-
== Contributing to file_series
|
24
|
-
|
25
|
-
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
26
|
-
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
27
|
-
* Fork the project.
|
28
|
-
* Start a feature/bugfix branch.
|
29
|
-
* Commit and push until you are happy with your contribution.
|
30
|
-
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
31
|
-
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
32
|
-
|
33
|
-
== Copyright
|
34
|
-
|
35
|
-
Copyright (c) 2012 TED Conferences. See LICENSE.txt for
|
36
|
-
further details.
|
37
|
-
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.6.0
|
data/file_series.gemspec
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: file_series 0.6.0 ruby lib
|
6
|
-
|
7
|
-
Gem::Specification.new do |s|
|
8
|
-
s.name = "file_series"
|
9
|
-
s.version = "0.6.0"
|
10
|
-
|
11
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
-
s.require_paths = ["lib"]
|
13
|
-
s.authors = ["Alex Dean"]
|
14
|
-
s.date = "2015-01-05"
|
15
|
-
s.description = "Automatically start writing to a new file every X seconds without any locking or file moving/renaming."
|
16
|
-
s.email = "alex@crackpot.org"
|
17
|
-
s.extra_rdoc_files = [
|
18
|
-
"LICENSE.txt",
|
19
|
-
"README.rdoc"
|
20
|
-
]
|
21
|
-
s.files = [
|
22
|
-
".autotest",
|
23
|
-
".document",
|
24
|
-
".rspec",
|
25
|
-
".ruby-gemset",
|
26
|
-
".ruby-version",
|
27
|
-
"Gemfile",
|
28
|
-
"Gemfile.lock",
|
29
|
-
"LICENSE.txt",
|
30
|
-
"README.rdoc",
|
31
|
-
"Rakefile",
|
32
|
-
"VERSION",
|
33
|
-
"file_series.gemspec",
|
34
|
-
"lib/file_series.rb",
|
35
|
-
"spec/file_series_spec.rb",
|
36
|
-
"spec/spec_helper.rb"
|
37
|
-
]
|
38
|
-
s.homepage = "http://github.com/tedconf/file_series"
|
39
|
-
s.licenses = ["MIT"]
|
40
|
-
s.rubygems_version = "2.2.2"
|
41
|
-
s.summary = "Write to a series of time-based files."
|
42
|
-
|
43
|
-
if s.respond_to? :specification_version then
|
44
|
-
s.specification_version = 4
|
45
|
-
|
46
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
47
|
-
s.add_development_dependency(%q<rspec>, ["~> 2.8.0"])
|
48
|
-
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
49
|
-
s.add_development_dependency(%q<bundler>, ["~> 1.6.0"])
|
50
|
-
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
51
|
-
s.add_development_dependency(%q<timecop>, ["= 0.3.5"])
|
52
|
-
else
|
53
|
-
s.add_dependency(%q<rspec>, ["~> 2.8.0"])
|
54
|
-
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
55
|
-
s.add_dependency(%q<bundler>, ["~> 1.6.0"])
|
56
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
57
|
-
s.add_dependency(%q<timecop>, ["= 0.3.5"])
|
58
|
-
end
|
59
|
-
else
|
60
|
-
s.add_dependency(%q<rspec>, ["~> 2.8.0"])
|
61
|
-
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
62
|
-
s.add_dependency(%q<bundler>, ["~> 1.6.0"])
|
63
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
64
|
-
s.add_dependency(%q<timecop>, ["= 0.3.5"])
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|