capistrano-sudo 0.0.3

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: 127b9c81e07a637492cbcf8e8f31c7864a6c83ab
4
+ data.tar.gz: fdbf9438aa6e94423840844db82878d7352b0b51
5
+ SHA512:
6
+ metadata.gz: 408c176ba5bfacc79f0e538d7110743c95bdfa328339684fe11d0e2b6c4787f9d824ffb0774e61782dcc45924f5cd166565e98ac46c21fd5cf6bb68f599dc8c3
7
+ data.tar.gz: 47bfa09f20e2a84d3cbf16ed35dd66239d8127af1aa68951eec9da7ca7a23576bb049bef319b029db3214d50a7220c68540811eea28e9b4b053d887934a7d92f
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.2
4
+
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in capistrano-sudo.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Yuta, AKAMINE
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,50 @@
1
+ # Capistrano-sudo
2
+
3
+ Capistrano plugin for sudo operation with password input.
4
+
5
+ # Requirements
6
+
7
+ * Capistrano ~> 3.3
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'capistrano'
15
+ gem 'capistrano-sudo'
16
+ ```
17
+
18
+ And then execute:
19
+
20
+ $ bundle install
21
+
22
+ ## Configuration
23
+
24
+ You can also Capistrano variables with `set name, value`.
25
+
26
+ Name | Default | Description
27
+ -----------|----------------------|------------
28
+ password | ENV['SUDO_PASSWORD'] | target machine's sudo password
29
+
30
+ ## Usage
31
+
32
+ Add this line to your application's Capfile:
33
+
34
+ ```ruby
35
+ require 'capistrano/capistrano-sudo'
36
+ ```
37
+
38
+ And execute `cap` command with sudo password, like this:
39
+
40
+ ```sh
41
+ % SUDO_PASSWORD=<sudopass> bundle exec cap production deploy
42
+ ```
43
+
44
+ ## Contributing
45
+
46
+ 1. Fork it ( https://github.com/[my-github-username]/capistrano-sudo/fork )
47
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
48
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
49
+ 4. Push to the branch (`git push origin my-new-feature`)
50
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
7
+
@@ -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 'capistrano/sudo/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "capistrano-sudo"
8
+ spec.version = Capistrano::Sudo::VERSION
9
+ spec.authors = ["Yuta, AKAMINE"]
10
+ spec.email = ["analogeryuta1984@gmail.com"]
11
+ spec.summary = %q{sudo extention for Capistrano}
12
+ spec.description = %q{capistrano plugin, for sudo operation with password input.}
13
+ spec.homepage = "https://github.com/analogeryuta/capistrano-sudo"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "capistrano", "~> 3.3"
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.6"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
+ spec.add_development_dependency "rspec", "~> 3.0"
26
+ end
data/example/Capfile ADDED
@@ -0,0 +1,26 @@
1
+ # Load DSL and Setup Up Stages
2
+ require 'capistrano/setup'
3
+
4
+ # Includes default deployment tasks
5
+ require 'capistrano/deploy'
6
+
7
+ # Includes tasks from other gems included in your Gemfile
8
+ #
9
+ # For documentation on these, see for example:
10
+ #
11
+ # https://github.com/capistrano/rvm
12
+ # https://github.com/capistrano/rbenv
13
+ # https://github.com/capistrano/chruby
14
+ # https://github.com/capistrano/bundler
15
+ # https://github.com/capistrano/rails
16
+ #
17
+ require 'capistrano/sudo'
18
+ # require 'capistrano/rvm'
19
+ # require 'capistrano/rbenv'
20
+ # require 'capistrano/chruby'
21
+ # require 'capistrano/bundler'
22
+ # require 'capistrano/rails/assets'
23
+ # require 'capistrano/rails/migrations'
24
+
25
+ # Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
26
+ Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
@@ -0,0 +1,8 @@
1
+ # If your local server can ssh access, use this.
2
+ #
3
+ #
4
+ server 'localhost', roles: %w{web app}, ssh_option: {
5
+ user: 'your_account_name',
6
+ port: 22,
7
+ auth_methods: %w(password)
8
+ }
@@ -0,0 +1,25 @@
1
+ # Simple Role Syntax
2
+ # ==================
3
+ # Supports bulk-adding hosts to roles, the primary server in each group
4
+ # is considered to be the first unless any hosts have the primary
5
+ # property set. Don't declare `role :all`, it's a meta role.
6
+
7
+ # role :app, %w{vagrant@localhost}
8
+ # role :web, %w{vagrant@localhost}
9
+ # role :db, %w{vagrant@localhost}
10
+
11
+ # Extended Server Syntax
12
+ # ======================
13
+ # This can be used to drop a more detailed server definition into the
14
+ # server list. The second argument is a, or duck-types, Hash and is
15
+ # used to set extended properties on the server.
16
+ ask :user, 'vagrant'
17
+ ask :keypath, '~/.vagrant.d/insecure_private_key'
18
+ ask :port, '2222'
19
+
20
+ server 'localhost', roles: %w{web app}, ssh_options: {
21
+ user: fetch(:user),
22
+ port: fetch(:port),
23
+ keys: fetch(:keypath),
24
+ auth_methods: %w(publickey)
25
+ }
@@ -0,0 +1,66 @@
1
+ # config valid only for Capistrano 3.1
2
+ lock '3.3.3'
3
+
4
+ # set :application, 'my_app_name'
5
+ # set :repo_url, 'git@example.com:me/my_repo.git'
6
+
7
+ # Default branch is :master
8
+ # ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }.call
9
+
10
+ # Default deploy_to directory is /var/www/my_app
11
+ # set :deploy_to, '/var/www/my_app'
12
+
13
+ # Default value for :scm is :git
14
+ # set :scm, :git
15
+
16
+ # Default value for :format is :pretty
17
+ # set :format, :pretty
18
+
19
+ # Default value for :log_level is :debug
20
+ # set :log_level, :debug
21
+
22
+ # Default value for :pty is false
23
+ # set :pty, true
24
+
25
+ # Default value for :linked_files is []
26
+ # set :linked_files, %w{config/database.yml}
27
+
28
+ # Default value for linked_dirs is []
29
+ # set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}
30
+
31
+ # Default value for default_env is {}
32
+ # set :default_env, { path: "/opt/ruby/bin:$PATH" }
33
+
34
+ # Default value for keep_releases is 5
35
+ # set :keep_releases, 5
36
+
37
+ namespace :deploy do
38
+
39
+ desc 'Restart application'
40
+ task :restart do
41
+ on roles(:app), in: :sequence, wait: 5 do
42
+ # Your restart mechanism here, for example:
43
+ # execute :touch, release_path.join('tmp/restart.txt')
44
+ end
45
+ end
46
+
47
+ after :publishing, :restart
48
+
49
+ after :restart, :clear_cache do
50
+ on roles(:web), in: :groups, limit: 3, wait: 10 do
51
+ # Here we can do anything such as:
52
+ # within release_path do
53
+ # execute :rake, 'cache:clear'
54
+ # end
55
+ end
56
+ end
57
+
58
+
59
+ desc 'test for doing sudo operation.'
60
+ task :test_sudo_execute do
61
+ on roles(:app) do
62
+ sudo "ls -lh /root"
63
+ end
64
+ end
65
+
66
+ end
@@ -0,0 +1,7 @@
1
+ module Capistrano
2
+ module DSL
3
+ def sudo(*args)
4
+ execute :echo, "'#{fetch(:password)}'|", :sudo, '-S', *args, raise_on_non_zero_exit: false
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ module Capistrano
2
+ module Sudo
3
+ VERSION = "0.0.3"
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ require "capistrano/sudo/dsl"
2
+
3
+ load File.expand_path("../tasks/capistrano-sudo.rake", __FILE__)
@@ -0,0 +1,5 @@
1
+ namespace :load do
2
+ task :defaults do
3
+ set :password, ask('SUDO password', ENV['SUDO_PASSWORD'], echo: false)
4
+ end
5
+ end
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ describe Capistrano::Sudo do
4
+ it 'has a version number' do
5
+ expect(Capistrano::Sudo::VERSION).not_to be nil
6
+ end
7
+
8
+ it 'does something useful' do
9
+ expect(false).to eq(true)
10
+ end
11
+ end
@@ -0,0 +1,2 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+ require 'capistrano/sudo'
metadata ADDED
@@ -0,0 +1,120 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-sudo
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.3
5
+ platform: ruby
6
+ authors:
7
+ - Yuta, AKAMINE
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-03-04 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.3'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.3'
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.6'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.6'
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
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ description: capistrano plugin, for sudo operation with password input.
70
+ email:
71
+ - analogeryuta1984@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - ".rspec"
78
+ - ".travis.yml"
79
+ - Gemfile
80
+ - LICENSE.txt
81
+ - README.md
82
+ - Rakefile
83
+ - capistrano-sudo.gemspec
84
+ - example/Capfile
85
+ - example/config/deploy.rb
86
+ - example/config/deploy/local.rb
87
+ - example/config/deploy/vagrant-local.rb
88
+ - lib/capistrano/sudo.rb
89
+ - lib/capistrano/sudo/dsl.rb
90
+ - lib/capistrano/sudo/version.rb
91
+ - lib/capistrano/tasks/capistrano-sudo.rake
92
+ - spec/capistrano/sudo_spec.rb
93
+ - spec/spec_helper.rb
94
+ homepage: https://github.com/analogeryuta/capistrano-sudo
95
+ licenses:
96
+ - MIT
97
+ metadata: {}
98
+ post_install_message:
99
+ rdoc_options: []
100
+ require_paths:
101
+ - lib
102
+ required_ruby_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ required_rubygems_version: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ requirements: []
113
+ rubyforge_project:
114
+ rubygems_version: 2.2.2
115
+ signing_key:
116
+ specification_version: 4
117
+ summary: sudo extention for Capistrano
118
+ test_files:
119
+ - spec/capistrano/sudo_spec.rb
120
+ - spec/spec_helper.rb