capistrano-file-upload 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
+ SHA1:
3
+ metadata.gz: 58a68fecaacb4dfa982fb8bbd32d1603d5928196
4
+ data.tar.gz: d558a3595254e093b6f320eddc81df2eff831283
5
+ SHA512:
6
+ metadata.gz: f95e153bbe8eb5c8ee825d69661235f748bec23e5e9928a3ed731f6da0a81008021d558a5720821d7aa74758d8ff4ff7a411c63f3fc2f02195b29fd038b83daa
7
+ data.tar.gz: 452cc9d85ceab4a1f68fa5704a3546553ee362c3c53c2fcf9cb8b6817c2bf926c8d14cded1cc1a39b237f0e5e8c40fd16afeb8b01cc37a4625f8330d5ba3ed82
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 Evgeniy NeoFusion
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,38 @@
1
+ # Capistrano::File::Upload
2
+
3
+ Upload local files to remote server (plugin for Capistrano 3.x)
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'capistrano', '~> 3.5'
11
+ gem 'capistrano-file-upload'
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install capistrano-file-upload
21
+
22
+ ## Usage
23
+
24
+ Require in `Capfile` to use the default task:
25
+
26
+ ```ruby
27
+ require 'capistrano/file-upload'
28
+ ```
29
+
30
+ The task will run before `deploy:updated` as part of Capistrano's default deploy.
31
+
32
+ Configurable options:
33
+
34
+ ```ruby
35
+ append :file_upload_files, 'config/parameters.json' # default value is []
36
+ append :file_upload_dirs, 'shared', 'web/assets' # default value is []
37
+ set :file_upload_roles, :all # default
38
+ ```
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'capistrano-file-upload'
7
+ spec.version = '0.1.0'
8
+ spec.authors = ['Evgeniy NeoFusion']
9
+ spec.email = ['evgeniy@neofusion.ru']
10
+ spec.summary = %q{Upload plugin for Capistrano 3.x}
11
+ spec.description = %q{Upload local files to remote server (plugin for Capistrano 3.x)}
12
+ spec.homepage = 'https://github.com/NeoFusion/capistrano-file-upload'
13
+ spec.license = 'MIT'
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.require_paths = ['lib']
17
+
18
+ spec.add_dependency 'capistrano', '~> 3.5'
19
+ spec.add_dependency 'sshkit', '~> 1.9'
20
+
21
+ spec.add_development_dependency 'bundler', '~> 1.16'
22
+ spec.add_development_dependency 'rake', '~> 10.0'
23
+ end
File without changes
@@ -0,0 +1 @@
1
+ load File.expand_path('../tasks/file-upload.rake', __FILE__)
@@ -0,0 +1,94 @@
1
+ namespace :file_upload do
2
+ desc 'Check required files and dirs'
3
+ task :check do
4
+ invoke 'file_upload:check:dirs'
5
+ invoke 'file_upload:check:files'
6
+ end
7
+
8
+ namespace :check do
9
+ desc 'Check required dirs exists'
10
+ task :dirs do
11
+ next unless any? :file_upload_dirs
12
+ run_locally do
13
+ fetch(:file_upload_dirs).each do |dir|
14
+ unless test "[ -d #{dir} ]"
15
+ error "Local dir '#{dir}' not found!"
16
+ exit 1
17
+ end
18
+ end
19
+ end
20
+ end
21
+
22
+ desc 'Check required files exists'
23
+ task :files do
24
+ next unless any? :file_upload_files
25
+ run_locally do
26
+ fetch(:file_upload_files).each do |file|
27
+ unless test "[ -f #{file} ]"
28
+ error "Local file '#{file}' not found!"
29
+ exit 1
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
35
+
36
+ desc 'Remove existing files and dirs'
37
+ task :remove do
38
+ invoke 'file_upload:remove:dirs'
39
+ invoke 'file_upload:remove:files'
40
+ end
41
+
42
+ namespace :remove do
43
+ desc 'Remove existing dirs'
44
+ task :dirs do
45
+ next unless any? :file_upload_dirs
46
+ on release_roles(fetch(:file_upload_roles)) do
47
+ fetch(:file_upload_dirs).each do |dir|
48
+ target = release_path.join(dir)
49
+ execute :rm, '-rf', target if test "[ -d #{target} ]"
50
+ end
51
+ end
52
+ end
53
+
54
+ desc 'Remove existing files'
55
+ task :files do
56
+ next unless any? :file_upload_files
57
+ on release_roles(fetch(:file_upload_roles)) do
58
+ fetch(:file_upload_files).each do |file|
59
+ target = release_path.join(file)
60
+ execute :rm, target if test "[ -f #{target} ]"
61
+ end
62
+ end
63
+ end
64
+ end
65
+
66
+ desc 'Upload data to server'
67
+ task :upload do
68
+ on release_roles(fetch(:file_upload_roles)) do
69
+ fetch(:file_upload_dirs).each do |dir|
70
+ upload! dir, File.join(release_path, dir), recursive: true
71
+ end
72
+ fetch(:file_upload_files).each do |file|
73
+ upload! file, File.join(release_path, file)
74
+ end
75
+ end
76
+ end
77
+
78
+ desc 'Prepare and upload new data'
79
+ task :run do
80
+ invoke 'file_upload:remove'
81
+ invoke 'file_upload:upload'
82
+ end
83
+
84
+ before 'deploy:started', 'file_upload:check'
85
+ before 'deploy:updated', 'file_upload:run'
86
+ end
87
+
88
+ namespace :load do
89
+ task :defaults do
90
+ set :file_upload_dirs, []
91
+ set :file_upload_files, []
92
+ set :file_upload_roles, :all
93
+ end
94
+ end
metadata ADDED
@@ -0,0 +1,107 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-file-upload
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Evgeniy NeoFusion
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-03-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: capistrano
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.5'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.5'
27
+ - !ruby/object:Gem::Dependency
28
+ name: sshkit
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.9'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.9'
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.16'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.16'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ description: Upload local files to remote server (plugin for Capistrano 3.x)
70
+ email:
71
+ - evgeniy@neofusion.ru
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - Gemfile
77
+ - LICENSE
78
+ - README.md
79
+ - capistrano-file-upload.gemspec
80
+ - lib/capistrano-file-upload.rb
81
+ - lib/capistrano/file-upload.rb
82
+ - lib/capistrano/tasks/file-upload.rake
83
+ homepage: https://github.com/NeoFusion/capistrano-file-upload
84
+ licenses:
85
+ - MIT
86
+ metadata: {}
87
+ post_install_message:
88
+ rdoc_options: []
89
+ require_paths:
90
+ - lib
91
+ required_ruby_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ required_rubygems_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ requirements: []
102
+ rubyforge_project:
103
+ rubygems_version: 2.5.2.1
104
+ signing_key:
105
+ specification_version: 4
106
+ summary: Upload plugin for Capistrano 3.x
107
+ test_files: []