logbackup 0.0.1 → 0.0.2

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.
Files changed (6) hide show
  1. data/Manifest +1 -1
  2. data/README +6 -6
  3. data/Rakefile +1 -1
  4. data/lib/logbackup.rb +15 -0
  5. data/logbackup.gemspec +3 -3
  6. metadata +5 -5
data/Manifest CHANGED
@@ -1,4 +1,4 @@
1
+ Manifest
1
2
  README
2
3
  Rakefile
3
4
  lib/logbackup.rb
4
- Manifest
data/README CHANGED
@@ -3,23 +3,23 @@ Simple Log backup
3
3
  USAGE:
4
4
 
5
5
  gem install logbackup
6
+
6
7
  require 'rubygems'
7
8
  require 'yaml'
8
- require 'lib/logbackup'
9
+ require 'logbackup'
9
10
 
10
- config = "/user/log/"
11
+ config = "/users/log"
11
12
 
12
- LOG_DIRECTORY_PATH = config['log_directory']
13
+ LOG_DIRECTORY_PATH = config
13
14
 
14
15
 
15
- class Logbackup
16
+ class Sample
16
17
 
17
18
  p "-----------Start-------------"
18
-
19
19
  logbackup = LogbackUp.new "development.log","#{Time.now}_development.log",LOG_DIRECTORY_PATH
20
20
  logbackup.renamefile
21
21
  logbackup.createfile
22
22
  p "--------------End---------------"
23
23
  end
24
24
 
25
-
25
+ shrisowdhaman
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('logbackup', '0.0.1') do |p|
5
+ Echoe.new('logbackup', '0.0.2') do |p|
6
6
  p.description = 'Simple Log backup'
7
7
  p.url = 'http://github.com/shrisowdhaman/logbackup'
8
8
  p.author = 'ShriSowdhaman'
data/lib/logbackup.rb CHANGED
@@ -6,6 +6,21 @@ class LogbackUp
6
6
  @dir = dir
7
7
  end
8
8
 
9
+ def log_content
10
+ @log_content = File.read("#{@LOG_PATH}/#{@filename}")
11
+ end
12
+
13
+ def log_size
14
+ @log_size = File.size?("#{@LOG_PATH}/#{@filename}").to_f/1048576 #converts file size to MB
15
+ end
16
+
17
+ def renamefile_with_size(mb)
18
+ if @log_size >3
19
+ File.rename("#{@LOG_PATH}/#{@filename}","#{@LOG_PATH}/#{@rename}")
20
+ File.new("#{@LOG_PATH}/#{@filename}", "w")
21
+ end
22
+ end
23
+
9
24
  def renamefile
10
25
  File.rename("#{@dir}/#{@filename}","#{@dir}/#{@rename}")
11
26
  end
data/logbackup.gemspec CHANGED
@@ -2,15 +2,15 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{logbackup}
5
- s.version = "0.0.1"
5
+ s.version = "0.0.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["ShriSowdhaman"]
9
- s.date = %q{2010-10-22}
9
+ s.date = %q{2010-10-25}
10
10
  s.description = %q{Simple Log backup}
11
11
  s.email = %q{shrisowdhaman@gmail.com}
12
12
  s.extra_rdoc_files = ["README", "lib/logbackup.rb"]
13
- s.files = ["README", "Rakefile", "lib/logbackup.rb", "Manifest", "logbackup.gemspec"]
13
+ s.files = ["Manifest", "README", "Rakefile", "lib/logbackup.rb", "logbackup.gemspec"]
14
14
  s.homepage = %q{http://github.com/shrisowdhaman/logbackup}
15
15
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Logbackup", "--main", "README"]
16
16
  s.require_paths = ["lib"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logbackup
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - ShriSowdhaman
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-22 00:00:00 +05:30
18
+ date: 2010-10-25 00:00:00 +05:30
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -29,10 +29,10 @@ extra_rdoc_files:
29
29
  - README
30
30
  - lib/logbackup.rb
31
31
  files:
32
+ - Manifest
32
33
  - README
33
34
  - Rakefile
34
35
  - lib/logbackup.rb
35
- - Manifest
36
36
  - logbackup.gemspec
37
37
  has_rdoc: true
38
38
  homepage: http://github.com/shrisowdhaman/logbackup