mina-logrotate 0.0.1

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 34104d278218e9af27eb0534ce3c977ccc550c5f
4
+ data.tar.gz: 5466dfaba408ee84f2b760e1490e831d6bf91d82
5
+ SHA512:
6
+ metadata.gz: d2e7e2edc3e233b778850421699e49a1ed8198a986bf7fde2541552699e0c3f3d4ae86323e459018dbc69025c8b45054a6364abfcc74c2c2ec63f620d4fd17e6
7
+ data.tar.gz: 5630bc03ed7ba5cc7c92f266a50f9c002ad9986072627cced9ddf13ef45e62405a4b8b9ceb4f6842515f29678e79b041f7a9df0be556d6eae4e8d6d3632dc069
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in mina-logrotate.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,66 @@
1
+ # Mina Logrotate
2
+
3
+ Inspired on [mina-nginx](https://github.com/hbin/mina-nginx) gem, provides [Mina](https://github.com/nadarei/mina) tasks to work with [Logrotate](http://www.linuxcommand.org/man_pages/logrotate8.html)
4
+
5
+ This gem provides several mina tasks (you can check using `mina tasks`):
6
+
7
+ ```
8
+ mina logrotate:apply # Run logrotate into symlink file
9
+ mina logrotate:link # Symlinking logrotate config file
10
+ mina logrotate:parse # Parse logrotate configuration file and upload it to the server
11
+ mina logrotate:setup # Setup logrotate
12
+ ```
13
+
14
+ ## Installation
15
+
16
+ Add this line to your application's Gemfile:
17
+
18
+ ```ruby
19
+ gem 'mina-logrotate', require: false
20
+ ```
21
+ And then execute:
22
+ ```
23
+ $ bundle
24
+ ```
25
+
26
+ Or install it yourself as:
27
+ ```
28
+ $ gem install mina-logrotate
29
+ ```
30
+
31
+ ## Usage
32
+
33
+ Add this to your `config/deploy.rb` file:
34
+ ```ruby
35
+ require 'mina/logrotate'
36
+ ```
37
+ Make sure the following settings are set in your `config/deploy.rb`:
38
+
39
+ * `application` - application name
40
+ * `deploy_to` - deployment path
41
+
42
+ Launch new tasks:
43
+
44
+ ```
45
+ $ mina logrotate:setup
46
+ $ mina logrotate:link
47
+ ```
48
+
49
+ There is a default [template file](lib/mina/templates/logrotate.erb) to use logrotate with all files inside shared/log but it's allowed define the template file with
50
+
51
+ ```ruby
52
+ private
53
+
54
+ def logrotate_template
55
+ '/path/to/my/template/file'
56
+ end
57
+ ```
58
+
59
+ ## Contributing
60
+
61
+ 1. Fork it ( http://github.com/hbin/mina-logrotate/fork )
62
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
63
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
64
+ 4. Push to the branch (`git push origin my-new-feature`)
65
+ 5. Create new Pull Request
66
+
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,5 @@
1
+ module Mina
2
+ module Logrotate
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,40 @@
1
+ require "mina/logrotate/version"
2
+
3
+ namespace :logrotate do
4
+ set_default :logrotate_path, '/etc/logrotate.d'
5
+ set_default :logrotate_config, -> { "#{deploy_to}/#{shared_path}/config/logrotate" }
6
+ set_default :logrotate_config_e, -> { "#{logrotate_path}/#{application}" }
7
+
8
+ desc 'Setup logrotate'
9
+ task setup: :environment do
10
+ queue %(echo "-----> Setup the logrotate")
11
+ queue! %(touch #{logrotate_config})
12
+ queue %(echo "-----> Be sure to edit 'shared/config/logrotate'.")
13
+ end
14
+
15
+ desc 'Symlinking logrotate config file'
16
+ task link: :environment do
17
+ queue %(echo "-----> Symlinking logrotate config file")
18
+ queue! %(sudo ln -nfs "#{logrotate_config}" "#{logrotate_config_e}")
19
+ end
20
+
21
+ desc 'Parse logrotate configuration file and upload it to the server.'
22
+ task parse: :environment do
23
+ content = erb(logrotate_template)
24
+ queue %(echo '#{content}' > #{logrotate_config})
25
+ queue %(cat #{logrotate_config})
26
+ queue %(echo "-----> Be sure to edit 'shared/config/logrotate'.")
27
+ end
28
+
29
+ desc 'Run logrotate into symlink file'
30
+ task apply: :environment do
31
+ queue %(echo "-----> Applying logrotate")
32
+ queue! "sudo logrotate #{logrotate_config_e}"
33
+ end
34
+
35
+ private
36
+
37
+ def logrotate_template
38
+ File.expand_path('../templates/logrotate.erb', __FILE__)
39
+ end
40
+ end
@@ -0,0 +1,11 @@
1
+ <%= logs_path %>/*.log {
2
+ weekly
3
+ size 100M
4
+ missingok
5
+ rotate 7
6
+ compress
7
+ delaycompress
8
+ notifempty
9
+ create 0640 www-data root
10
+ su root ubuntu
11
+ }
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'mina/logrotate/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "mina-logrotate"
8
+ spec.version = Mina::Logrotate::VERSION
9
+ spec.authors = ["Rodrigo Otavio van den Berg Maia"]
10
+ spec.email = ["rodrigo@devlandia.net"]
11
+
12
+ spec.summary = %q{Logrotate integration with mina}
13
+ spec.description = %q{Logrotate features to use with mina}
14
+ spec.homepage = "https://github.com/Devlandia/mina-logrotate"
15
+ spec.license = "GPLv3"
16
+
17
+ spec.files = `git ls-files`.split($/)
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_dependency "mina", "~> 0"
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.8"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ end
metadata ADDED
@@ -0,0 +1,94 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mina-logrotate
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Rodrigo Otavio van den Berg Maia
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-05-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: mina
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.8'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.8'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ description: Logrotate features to use with mina
56
+ email:
57
+ - rodrigo@devlandia.net
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - Gemfile
64
+ - README.md
65
+ - Rakefile
66
+ - lib/mina/logrotate.rb
67
+ - lib/mina/logrotate/version.rb
68
+ - lib/mina/templates/logrotate.erb
69
+ - mina-logrotate.gemspec
70
+ homepage: https://github.com/Devlandia/mina-logrotate
71
+ licenses:
72
+ - GPLv3
73
+ metadata: {}
74
+ post_install_message:
75
+ rdoc_options: []
76
+ require_paths:
77
+ - lib
78
+ required_ruby_version: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ required_rubygems_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ requirements: []
89
+ rubyforge_project:
90
+ rubygems_version: 2.4.6
91
+ signing_key:
92
+ specification_version: 4
93
+ summary: Logrotate integration with mina
94
+ test_files: []