tmp_autoclean 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 6abae15d60db4cc3f22200e88ba6107daa0d3c0e632abb863383b54a2faec684
4
+ data.tar.gz: c4b19f955a63f48919bcbc0228844f6657bab1e939763af1389aaac4d3354740
5
+ SHA512:
6
+ metadata.gz: 92741fd2ff8111da337b98378dd015f29840d0893229868eb6812803b6bd6a837dccc22719970aab3dd3eb9a1e79b008dbc924a7df2c97b036e9b199d53a78ed
7
+ data.tar.gz: 40d159fbb9d225a860cd8af3a6e0af4128e1e99c28a8ee678214f2a84d658435373be64213c1cc1ab1cc14440aa9f36a7189e86d52f0f6a2a7dccae8337e7fd7
@@ -0,0 +1,20 @@
1
+ Copyright 2020 Kirill Shevchenko
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,46 @@
1
+ # tmp_autoclean
2
+
3
+ Autoclean Rails `tmp` directory for local development. Keep your application stateless and storage clean.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile and type `bundle install`:
8
+
9
+ ```ruby
10
+ gem 'tmp_autoclean'
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ Enable tmp directory autoclean:
16
+
17
+ Add line to `config/initializers/development.rb`
18
+
19
+ ```ruby
20
+ Rails.application.configure do
21
+ # other configrations ...
22
+
23
+ config.tmp_autoclean_enable = true
24
+ end
25
+ ```
26
+
27
+ That it. After next rails server start up `tmp/` folder will be cleaned.
28
+
29
+ ## Configuration
30
+
31
+ Clean specific tmp files
32
+
33
+ Add `tmp_autoclean_options` line to `config/initializers/development.rb`
34
+
35
+ ```ruby
36
+ Rails.application.configure do
37
+ # other configrations ...
38
+
39
+ config.tmp_autoclean_enable = true
40
+ config.tmp_autoclean_options = %w[cache sockets pids screenshots] # full list of available options
41
+ end
42
+ ```
43
+
44
+ ## License
45
+
46
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,27 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'TmpAutoclean'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.md')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ require 'bundler/gem_tasks'
18
+
19
+ require 'rake/testtask'
20
+
21
+ Rake::TestTask.new(:test) do |t|
22
+ t.libs << 'test'
23
+ t.pattern = 'test/**/*_test.rb'
24
+ t.verbose = false
25
+ end
26
+
27
+ task default: :test
@@ -0,0 +1,6 @@
1
+ require 'tmp_autoclean/railtie'
2
+ require 'rake'
3
+ require 'rails/tasks'
4
+
5
+ module TmpAutoclean
6
+ end
@@ -0,0 +1,16 @@
1
+ module TmpAutoclean
2
+ class Railtie < ::Rails::Railtie
3
+ config.after_initialize do
4
+ enable = config.try(:tmp_autoclean_enable)
5
+ specific_options = config.try(:tmp_autoclean_options)
6
+
7
+ if enable && specific_options
8
+ specific_options.each do |option|
9
+ Rake::Task["tmp:#{option}:clear"].invoke
10
+ end
11
+ elsif config.try(:tmp_autoclean_enable)
12
+ Rake::Task['tmp:clear'].invoke
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,3 @@
1
+ module TmpAutoclean
2
+ VERSION = '0.1.0'
3
+ end
metadata ADDED
@@ -0,0 +1,63 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tmp_autoclean
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Kirill Shevchenko
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-11-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
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
+ description: Autoclean Rails tmp directory
28
+ email:
29
+ - hello@kirillshevch.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - MIT-LICENSE
35
+ - README.md
36
+ - Rakefile
37
+ - lib/tmp_autoclean.rb
38
+ - lib/tmp_autoclean/railtie.rb
39
+ - lib/tmp_autoclean/version.rb
40
+ homepage: https://github.com/kirillshevch/tmp_autoclean
41
+ licenses:
42
+ - MIT
43
+ metadata: {}
44
+ post_install_message:
45
+ rdoc_options: []
46
+ require_paths:
47
+ - lib
48
+ required_ruby_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ required_rubygems_version: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ requirements: []
59
+ rubygems_version: 3.0.6
60
+ signing_key:
61
+ specification_version: 4
62
+ summary: Autoclean Rails tmp directory
63
+ test_files: []