vagrant-capistrano-push 0.0.1

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: 1e836939a7552aa248738d7500de14ec2b9bbbd8
4
+ data.tar.gz: a7f0d559c2e0eae71a275ca3f08e7ee6ae62183b
5
+ SHA512:
6
+ metadata.gz: aaf2cae96fc41d5a2fc876037beb8c706dcbeaf9f6c60e78084d730adec05ba6f43d78e7653d1ab72d8f161ef67d492129385d79ee5d1fe12add18d84cc02738
7
+ data.tar.gz: c1d53d2fcbe7dee590dcca081c354668f28659b1bc207a6cdcbf6759fcd9ab0d3b80f6930e188ecc14bf762ef0e137c1b38bf431a5a69edb92473fa77d0a23ed
@@ -0,0 +1,38 @@
1
+ module VagrantPlugins
2
+ module CapistranoPush
3
+ class Config < Vagrant.plugin("2", :config)
4
+ # The capistrano command (as a string) to execute.
5
+ # @return [String]
6
+ attr_accessor :stage, :command
7
+
8
+ def initialize
9
+ @stage = UNSET_VALUE
10
+ @command = "bundle exec cap #{@stage} deploy"
11
+ end
12
+
13
+ def finalize!
14
+ @stage = nil if @stage == UNSET_VALUE
15
+ end
16
+
17
+ def validate(machine)
18
+ errors = _detected_errors
19
+
20
+ if missing?(@stage)
21
+ errors << I18n.t("capistrano_push.errors.missing_attribute",
22
+ attribute: "stage",
23
+ )
24
+ end
25
+
26
+ { "Capistrano push" => errors }
27
+ end
28
+
29
+ private
30
+
31
+ # Determine if the given string is "missing" (blank)
32
+ # @return [true, false]
33
+ def missing?(obj)
34
+ obj.to_s.strip.empty?
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,13 @@
1
+ module VagrantPlugins
2
+ module CapistranoPush
3
+ module Errors
4
+ class Error < Vagrant::Errors::VagrantError
5
+ error_namespace("capistrano_push.errors")
6
+ end
7
+
8
+ class CommandFailed < Error
9
+ error_key(:command_failed)
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,33 @@
1
+ require "vagrant"
2
+
3
+ module VagrantPlugins
4
+ module CapistranoPush
5
+ class Plugin < Vagrant.plugin("2")
6
+ name "capistrano"
7
+ description <<-DESC
8
+ Run capistrano to push
9
+ DESC
10
+
11
+ config(:capistrano, :push) do
12
+ require File.expand_path("../config", __FILE__)
13
+ init!
14
+ Config
15
+ end
16
+
17
+ push(:capistrano) do
18
+ require File.expand_path("../push", __FILE__)
19
+ init!
20
+ Push
21
+ end
22
+
23
+ protected
24
+
25
+ def self.init!
26
+ return if defined?(@_init)
27
+ I18n.load_path << File.expand_path("../locales/en.yml", __FILE__)
28
+ I18n.reload!
29
+ @_init = true
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,27 @@
1
+ require "vagrant/util/subprocess"
2
+
3
+ require_relative "errors"
4
+
5
+ module VagrantPlugins
6
+ module CapistranoPush
7
+ class Push < Vagrant.plugin("2", :push)
8
+ def push
9
+ execute!(config.command)
10
+ end
11
+
12
+ # Execute the capistrano command, raising an exception if it fails.
13
+ def execute!(*cmd)
14
+ result = Vagrant::Util::Subprocess.execute(*cmd)
15
+
16
+ if result.exit_code != 0
17
+ raise Errors::CommandFailed,
18
+ cmd: cmd.join(" "),
19
+ stdout: result.stdout,
20
+ stderr: result.stderr
21
+ end
22
+
23
+ result
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,5 @@
1
+ module VagrantPlugins
2
+ module CapistranoPush
3
+ VERSION = '0.0.1'
4
+ end
5
+ end
@@ -0,0 +1,14 @@
1
+ require 'vagrant-capistrano-push/version'
2
+ require 'vagrant-capistrano-push/plugin'
3
+ require 'vagrant-capistrano-push/errors'
4
+
5
+ module VagrantPlugins
6
+ module CapistranoPush
7
+ def self.source_root
8
+ @source_root ||= Pathname.new(File.expand_path('../../', __FILE__))
9
+ end
10
+
11
+ I18n.load_path << File.expand_path('locales/en.yml', source_root)
12
+ I18n.reload!
13
+ end
14
+ end
metadata ADDED
@@ -0,0 +1,105 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vagrant-capistrano-push
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Martin Fenner
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-01-31 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: vagrant-spec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 1.4.0
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 1.4.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.1.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.1.0
69
+ description: Use capistrano with the vagrant push command.
70
+ email: mf@martinfenner.org
71
+ executables: []
72
+ extensions: []
73
+ extra_rdoc_files: []
74
+ files:
75
+ - lib/vagrant-capistrano-push.rb
76
+ - lib/vagrant-capistrano-push/config.rb
77
+ - lib/vagrant-capistrano-push/errors.rb
78
+ - lib/vagrant-capistrano-push/plugin.rb
79
+ - lib/vagrant-capistrano-push/push.rb
80
+ - lib/vagrant-capistrano-push/version.rb
81
+ homepage: http://www.vagrantup.com
82
+ licenses:
83
+ - MIT
84
+ metadata: {}
85
+ post_install_message:
86
+ rdoc_options: []
87
+ require_paths:
88
+ - lib
89
+ required_ruby_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ required_rubygems_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: 1.3.6
99
+ requirements: []
100
+ rubyforge_project:
101
+ rubygems_version: 2.2.2
102
+ signing_key:
103
+ specification_version: 4
104
+ summary: Use capistrano with vagrant push.
105
+ test_files: []