capistrano-locally 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 281b70cf8991c8cc2b75da826aadb2fd176dfc79
4
+ data.tar.gz: cdf2c30ed86f20f3bea6631f4e2a5de6f9fd668f
5
+ SHA512:
6
+ metadata.gz: 6dbcc174116786aa181adc69a117f7884aa08cbace4e1bc407b2e7692dba11bc6ad5aabc665fc2b7f094c69f29ec48499e5eed55c40862b16045c905ca0bc6c3
7
+ data.tar.gz: 809e863eb54addd87cc7b808edebc58229ae21b0fa5f47d9d6410152184cdcaba482f554b9f896b40743d972b4d57374836e1786d44ce36d4701de505f7bb783
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/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in capistrano-locally.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,54 @@
1
+ # Capistrano::Locally
2
+
3
+ This gem is a Capistrano plugin to simplify "localhost" deployment.
4
+
5
+ Capistrano can deploy the source to any hosts including localhost via SSH (`SSHKit::Backend::Netssh`).
6
+ But when limiting to some simple case that deployment to localhost, SSH isn't sometimes necessary.
7
+
8
+ A `capistrano-locally` deploys without SSH only when a target host named "localhost"
9
+
10
+ So, you don't need to write SSH user and configs on `server 'localhost'`.
11
+
12
+ ## Installation
13
+
14
+ Add this line to your application's Gemfile:
15
+
16
+ ```ruby
17
+ gem 'capistrano-locally'
18
+ ```
19
+
20
+ And then execute:
21
+
22
+ $ bundle
23
+
24
+ Or install it yourself as:
25
+
26
+ $ gem install capistrano-locally
27
+
28
+ ## Usage
29
+
30
+ Require in `Capfile`:
31
+
32
+ require 'capistrano/locally'
33
+
34
+
35
+ ### Example
36
+
37
+ `config/deploy/staging_and_local.rb`
38
+
39
+ # typically server config is:
40
+ server 'my.remotehost.com', roles: w%{app web}, user: 'deploy', key: '/path/to/key.pem'
41
+ # localhost config is:
42
+ server 'localhost', roles: w%{app web} # no need to set SSH configs.
43
+
44
+
45
+ ## Development
46
+
47
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
48
+
49
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
50
+
51
+ ## Contributing
52
+
53
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/capistrano-locally.
54
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "capistrano/locally"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,33 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'capistrano/locally/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "capistrano-locally"
8
+ spec.version = Capistrano::Locally::VERSION
9
+ spec.authors = ["Takuto Komazaki"]
10
+ spec.email = ["komazarari@gmail.com"]
11
+
12
+ spec.summary = %q{Capistrano plugin to simplify "localhost" deployment.}
13
+ spec.description = <<-EOS
14
+ Capistrano plugin to simplify "localhost" deployment.
15
+
16
+ Capistrano can deploy the source to any hosts including localhost via SSH (`SSHKit::Backend::Netssh`).
17
+ But when limiting to some simple case that deployment to localhost, SSH isn't sometimes necessary.
18
+
19
+ A `capistrano-locally` deploys without SSH only when a target host named "localhost".
20
+ EOS
21
+ spec.homepage = "https://github.com/komazarari/capistrano-locally"
22
+
23
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
24
+ spec.bindir = "exe"
25
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
+ spec.require_paths = ["lib"]
27
+
28
+ spec.add_dependency "capistrano", "~> 3.0"
29
+
30
+ spec.add_development_dependency "bundler", "~> 1.10"
31
+ spec.add_development_dependency "rake", "~> 10.0"
32
+ spec.add_development_dependency "rspec"
33
+ end
@@ -0,0 +1,34 @@
1
+ require "capistrano/locally/version"
2
+ require "capistrano/dsl"
3
+
4
+ module Capistrano
5
+ module Locally
6
+ end
7
+ end
8
+
9
+
10
+ module Capistrano
11
+ module DSL
12
+ alias original_on on
13
+
14
+ def on(hosts, options={}, &block)
15
+ localhosts, remotehosts = hosts.partition { |h| h.hostname.to_s == 'localhost' }
16
+ localhost = Configuration.env.filter(localhosts).first
17
+
18
+ unless localhost.nil?
19
+ if dry_run?
20
+ SSHKit::Backend::Printer
21
+ else
22
+ SSHKit::Backend::Local
23
+ end.new(localhost, &block).run
24
+ end
25
+
26
+ original_on(remotehosts, options={}, &block)
27
+ end
28
+
29
+ private
30
+ def dry_run?
31
+ fetch(:sshkit_backend) == SSHKit::Backend::Printer
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,5 @@
1
+ module Capistrano
2
+ module Locally
3
+ VERSION = "0.2.0"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,115 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-locally
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ platform: ruby
6
+ authors:
7
+ - Takuto Komazaki
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-09-26 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.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.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.10'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.10'
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: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: |
70
+ Capistrano plugin to simplify "localhost" deployment.
71
+
72
+ Capistrano can deploy the source to any hosts including localhost via SSH (`SSHKit::Backend::Netssh`).
73
+ But when limiting to some simple case that deployment to localhost, SSH isn't sometimes necessary.
74
+
75
+ A `capistrano-locally` deploys without SSH only when a target host named "localhost".
76
+ email:
77
+ - komazarari@gmail.com
78
+ executables: []
79
+ extensions: []
80
+ extra_rdoc_files: []
81
+ files:
82
+ - ".gitignore"
83
+ - ".rspec"
84
+ - Gemfile
85
+ - README.md
86
+ - Rakefile
87
+ - bin/console
88
+ - bin/setup
89
+ - capistrano-locally.gemspec
90
+ - lib/capistrano/locally.rb
91
+ - lib/capistrano/locally/version.rb
92
+ homepage: https://github.com/komazarari/capistrano-locally
93
+ licenses: []
94
+ metadata: {}
95
+ post_install_message:
96
+ rdoc_options: []
97
+ require_paths:
98
+ - lib
99
+ required_ruby_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ required_rubygems_version: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ requirements: []
110
+ rubyforge_project:
111
+ rubygems_version: 2.4.5.1
112
+ signing_key:
113
+ specification_version: 4
114
+ summary: Capistrano plugin to simplify "localhost" deployment.
115
+ test_files: []