vagrant-shell 0.2.14 → 0.2.15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
- ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- YWJjNjBkNTU5OTZmNTA1OGI2MzNmNTU0YmVhMzc0Y2ZhZWEwZGJkMA==
5
- data.tar.gz: !binary |-
6
- ZmI4MDk2MmY0MjcyZmUyNjU4Mjk4ZGFhZmQ4NDE4YmExZGE4NjYyZg==
7
- SHA512:
8
- metadata.gz: !binary |-
9
- YzM5NmI5MjU0YzI0ODk5ZGQ4N2ViNzA3NTNjYTI0NjEzN2Q3ZmRjMjNmNThh
10
- ZTc5YTgyZjUzMDA3NmYxZGJhYzU2YzYyZjVjODYzOGQzZTE5YjIxOTU5Zjdh
11
- MDZlMGZhY2ExZDJmZGNjN2MxNzQ4OWE5MjI3YjdkMmNjOGExZDE=
12
- data.tar.gz: !binary |-
13
- NjE1MzRjYzRhNzFkMDNiYzI1NTM2MzQ0OTk4Mzc5M2EwMDI1ZDFmZTk5ZGE5
14
- NmNjZTFhOWY1MzVhMTgzOTc3NTMxMWVkNDAxNjAxZDliMGFhMGE5MmFjOTVi
15
- YTdiZGY3NDk1YTAyMGE1Y2QxNzExMTliY2ZmMWMzOGVmMTY0ZDM=
1
+ ---
2
+ SHA512:
3
+ metadata.gz: d14ca3df494cac0f48a470ecf757312df2f1c390b1ef8f7c0715a15c573c5055fff8efbe67158d8cb17a737f3650d0476665953c225cb8d887d8f3bd7cdf20db
4
+ data.tar.gz: 4648f73c86070fa6ef929f8c497ff0096bfb5e8d82351163ff8fe5a3cab7949dcbd931d56136ee847af1808e7c00a14837ead347f881f3cf4b736dd0833a34f7
5
+ SHA1:
6
+ metadata.gz: fb216248e27fb0c22ed1325e808d8236506cfeaf
7
+ data.tar.gz: 30e6ee1cd824649024136c1971a609b75112a184
data/.gitignore ADDED
@@ -0,0 +1,7 @@
1
+ # OS-specific
2
+ .DS_Store
3
+
4
+ # Bundler/Rubygems
5
+ /*.gem
6
+ pkg/*
7
+ tags
data/.gitsetup.yml ADDED
@@ -0,0 +1,4 @@
1
+ ---
2
+ remotes:
3
+ primary: git@github.com:destructuring/vagrant-shell
4
+ secondary: git@bitbucket.org:destructuring/vagrant-shell
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,14 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ vagrant-shell (0.2.6)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+
10
+ PLATFORMS
11
+ ruby
12
+
13
+ DEPENDENCIES
14
+ vagrant-shell!
data/Makefile ADDED
@@ -0,0 +1,6 @@
1
+ GEM := $(shell pwd | xargs basename)
2
+ gem:
3
+ gem build $(GEM).gemspec
4
+
5
+ public:
6
+ gem push $(shell ls -thd $(GEM)*.gem | head -1)
data/README.md CHANGED
@@ -11,7 +11,8 @@ terminate-instance, ssh-info, and read-state.
11
11
 
12
12
  See `libexec/shell-docker` for an example.
13
13
 
14
- **NOTE:** This plugin requires ruby 1.9 and bundler
14
+ **NOTE:** This plugin requires Vagrant 1.2+, ruby 1.9, and bundler. This
15
+ README was tested using Ubuntu Raring.
15
16
 
16
17
  ## Demo
17
18
 
@@ -20,24 +21,37 @@ bundler and cached gems.
20
21
 
21
22
  Go to the demo directory:
22
23
 
23
- cd demo/docker
24
-
25
- Download the ubuntu docker image:
26
-
27
- docker pull ubuntu
24
+ cd demo
28
25
 
29
26
  Run make to bundle gems, install the demo vagrant box:
30
27
 
31
28
  make
32
29
 
30
+ Download the ubuntu docker image:
31
+
32
+ docker pull ubuntu
33
+
33
34
  Bring up the docker containers:
34
35
 
35
36
  bundle exec vagrant up
36
- bundle exec vagrant status
37
37
 
38
38
  The commands passed to the container are sourced from `libexec/init-docker`.
39
39
  It sets up the root user with an ssh key suitable for vagrant.
40
40
 
41
41
  SSH into one of the the containers:
42
42
 
43
- bundle exec vagrant ssh ubuntu:precise
43
+ bundle exec vagrant ssh default
44
+
45
+ ## Testing without docker
46
+
47
+ If docker is not available, use script `shell-self` to pretend the
48
+ localhost is the vagrant instance. Be careful since `vagrant ssh` will
49
+ connect to the localhost.
50
+
51
+ Prepend `env SHELL_SCRIPT=self` to `bundle exec vagrant` so the
52
+ `Vagrantfile` will adjust its docker behavior to suit localhost.
53
+
54
+ ## TODO
55
+
56
+ vagrant package
57
+ vagrant reload?
@@ -12,27 +12,24 @@ module VagrantPlugins
12
12
  end
13
13
 
14
14
  def call(env)
15
- env[:machine_ssh_info] = read_ssh_info(env[:script], env[:machine])
15
+ env[:machine_ssh_info] = read_ssh_info(env[:machine])
16
16
 
17
17
  @app.call(env)
18
18
  end
19
19
 
20
- def read_ssh_info(script, machine)
20
+ def read_ssh_info(machine)
21
21
  return nil if machine.id.nil?
22
22
 
23
- # Find the machine
24
- server = script.servers.get(machine.id)
25
- if server.nil?
26
- # The machine can't be found
27
- @logger.info("Machine couldn't be found, assuming it got destroyed.")
28
- machine.id = nil
29
- return nil
23
+ # Read the DNS info
24
+ output = %x{ #{machine.provider_config.script} ssh-info #{machine.id} }
25
+ if $?.to_i > 0
26
+ raise Errors::ShellError, :message => "Failure: #{env[:machine].provider_config.script} ssh-info #{machine.id}"
30
27
  end
31
28
 
32
- # Read the DNS info
29
+ host,port = output.split(/\s+/)[0,2] # TODO check formatting
33
30
  return {
34
- :host => server.public_ip_address || server.dns_name || server.private_ip_address,
35
- :port => server.public_port || server.private_port
31
+ :host => host,
32
+ :port => port
36
33
  }
37
34
  end
38
35
  end
@@ -12,25 +12,20 @@ module VagrantPlugins
12
12
  end
13
13
 
14
14
  def call(env)
15
- env[:machine_state_id] = read_state(env[:script], env[:machine])
15
+ env[:machine_state_id] = read_state(env[:machine])
16
16
 
17
17
  @app.call(env)
18
18
  end
19
19
 
20
- def read_state(script, machine)
20
+ def read_state(machine)
21
21
  return :not_created if machine.id.nil?
22
22
 
23
- # Find the machine
24
- server = aws.servers.get(machine.id)
25
- if server.nil? || [:"shutting-down", :terminated].include?(server.state.to_sym)
26
- # The machine can't be found
27
- @logger.info("Machine not found or terminated, assuming it got destroyed.")
28
- machine.id = nil
29
- return :not_created
30
- end
31
-
32
23
  # Return the state
33
- return server.state.to_sym
24
+ output = %x{ #{machine.provider_config.script} read-state #{machine.id} }
25
+ if $?.to_i > 0
26
+ raise Errors::ShellError, :message => "Failure: #{env[:machine].provider_config.script} read-state #{machine.id}"
27
+ end
28
+ output.strip
34
29
  end
35
30
  end
36
31
  end
@@ -1,5 +1,5 @@
1
1
  require "log4r"
2
- require 'json'
2
+ require "pp"
3
3
 
4
4
  require 'vagrant/util/retryable'
5
5
 
@@ -21,35 +21,27 @@ module VagrantPlugins
21
21
  # Initialize metrics if they haven't been
22
22
  env[:metrics] ||= {}
23
23
 
24
- # Get the region we're going to booting up in
25
- region = env[:machine].provider_config.region
26
-
27
24
  # Get the configs
28
- region_config = env[:machine].provider_config.get_region_config(region)
29
- image = region_config.image
30
- user_data = region_config.user_data
31
- run_args = region_config.run_args
25
+ provider_config = env[:machine].provider_config
26
+ image = provider_config.image
27
+ user_data = provider_config.user_data
28
+ run_args = provider_config.run_args
32
29
 
33
30
  # Launch!
34
31
  env[:ui].info(I18n.t("vagrant_shell.launching_instance"))
35
32
  env[:ui].info(" -- Image: #{image}")
36
33
 
37
- begin
38
- options = {
39
- :image => image,
40
- :user_data => user_data,
41
- :run_args => run_args
42
- }
43
-
44
- server = env[:script].servers.create(options)
34
+ # Immediately save the ID since it is created at this point.
35
+ output = %x{ #{env[:machine].provider_config.script} run-instance #{image} #{run_args.join(" ")} }
36
+ if $?.to_i > 0
37
+ raise Errors::ShellError, :message => "Failure: #{env[:machine].provider_config.script} run-instance #{image} ..."
45
38
  end
46
39
 
47
- # Immediately save the ID since it is created at this point.
48
- env[:machine].id = server.id
40
+ env[:machine].id = output.split(/\s+/)[0]
49
41
 
50
42
  # Wait for the instance to be ready first
51
43
  env[:metrics]["instance_ready_time"] = Util::Timer.time do
52
- tries = region_config.instance_ready_timeout / 2
44
+ tries = provider_config.instance_ready_timeout / 2
53
45
 
54
46
  env[:ui].info(I18n.t("vagrant_shell.waiting_for_ready"))
55
47
  begin
@@ -58,7 +50,7 @@ module VagrantPlugins
58
50
  next if env[:interrupted]
59
51
 
60
52
  # Wait for the server to be ready
61
- server.wait_for(2) { ready? }
53
+ true
62
54
  end
63
55
  rescue Shell::Errors::TimeoutError
64
56
  # Delete the instance
@@ -66,7 +58,7 @@ module VagrantPlugins
66
58
 
67
59
  # Notify the user
68
60
  raise Errors::InstanceReadyTimeout,
69
- timeout: region_config.instance_ready_timeout
61
+ timeout: provider_config.instance_ready_timeout
70
62
  end
71
63
  end
72
64
 
@@ -11,11 +11,15 @@ module VagrantPlugins
11
11
  end
12
12
 
13
13
  def call(env)
14
- server = env[:script].servers.get(env[:machine].id)
15
-
16
14
  # Destroy the server and remove the tracking ID
17
15
  env[:ui].info(I18n.t("vagrant_shell.terminating"))
18
- server.destroy
16
+ output = %x{ #{env[:machine].provider_config.script} terminate-instance #{env[:machine].id}}
17
+ if $?.to_i > 0
18
+ raise Errors::ShellError, :message => "Failure: #{env[:machine].provider_config.script} terminate-instance #{env[:machine].id}"
19
+ end
20
+
21
+ puts output
22
+
19
23
  env[:machine].id = nil
20
24
 
21
25
  @app.call(env)
@@ -11,15 +11,8 @@ module VagrantPlugins
11
11
  # This action is called to terminate the remote machine.
12
12
  def self.action_destroy
13
13
  Vagrant::Action::Builder.new.tap do |b|
14
- b.use Call, DestroyConfirm do |env, b2|
15
- if env[:result]
16
- b2.use ConfigValidate
17
- b2.use ConnectShell
18
- b2.use TerminateInstance
19
- else
20
- b2.use MessageWillNotDestroy
21
- end
22
- end
14
+ b.use ConfigValidate
15
+ b.use TerminateInstance
23
16
  end
24
17
  end
25
18
 
@@ -44,7 +37,6 @@ module VagrantPlugins
44
37
  def self.action_read_ssh_info
45
38
  Vagrant::Action::Builder.new.tap do |b|
46
39
  b.use ConfigValidate
47
- b.use ConnectShell
48
40
  b.use ReadSSHInfo
49
41
  end
50
42
  end
@@ -55,7 +47,6 @@ module VagrantPlugins
55
47
  def self.action_read_state
56
48
  Vagrant::Action::Builder.new.tap do |b|
57
49
  b.use ConfigValidate
58
- b.use ConnectShell
59
50
  b.use ReadState
60
51
  end
61
52
  end
@@ -92,9 +83,7 @@ module VagrantPlugins
92
83
  # This action is called to bring the box up from nothing.
93
84
  def self.action_up
94
85
  Vagrant::Action::Builder.new.tap do |b|
95
- b.use HandleBoxUrl
96
86
  b.use ConfigValidate
97
- b.use ConnectShell
98
87
  b.use Call, IsCreated do |env, b2|
99
88
  if env[:result]
100
89
  b2.use MessageAlreadyCreated
@@ -109,11 +98,9 @@ module VagrantPlugins
109
98
 
110
99
  # The autoload farm
111
100
  action_root = Pathname.new(File.expand_path("../action", __FILE__))
112
- autoload :ConnectShell, action_root.join("connect_shell")
113
101
  autoload :IsCreated, action_root.join("is_created")
114
102
  autoload :MessageAlreadyCreated, action_root.join("message_already_created")
115
103
  autoload :MessageNotCreated, action_root.join("message_not_created")
116
- autoload :MessageWillNotDestroy, action_root.join("message_will_not_destroy")
117
104
  autoload :ReadSSHInfo, action_root.join("read_ssh_info")
118
105
  autoload :ReadState, action_root.join("read_state")
119
106
  autoload :RunInstance, action_root.join("run_instance")
@@ -3,71 +3,41 @@ require "vagrant"
3
3
  module VagrantPlugins
4
4
  module Shell
5
5
  class Config < Vagrant.plugin("2", :config)
6
+ # The ID of the Image to use.
7
+ #
8
+ # @return [String]
9
+ attr_accessor :image
6
10
 
7
11
  # The timeout to wait for an instance to become ready.
8
12
  #
9
13
  # @return [Fixnum]
10
14
  attr_accessor :instance_ready_timeout
11
15
 
12
-
13
16
  # The user data string
14
17
  #
15
18
  # @return [String]
16
19
  attr_accessor :user_data
17
20
 
18
- # The ID of the Image to use.
19
- attr_accessor :image
20
-
21
21
  # The shell script implementing some tech
22
+ #
23
+ # @return [String]
22
24
  attr_accessor :script
23
25
 
24
26
  # The shell script run-instance args
27
+ #
28
+ # @return [String]
25
29
  attr_accessor :run_args
26
30
 
27
- def initialize(region_specific=false)
31
+ def initialize
32
+ @image = UNSET_VALUE
28
33
  @instance_ready_timeout = UNSET_VALUE
29
34
  @user_data = UNSET_VALUE
30
- @image = UNSET_VALUE
31
35
  @script = UNSET_VALUE
32
36
  @run_args = UNSET_VALUE
33
37
 
34
38
  # Internal state (prefix with __ so they aren't automatically
35
39
  # merged)
36
- @__compiled_region_configs = {}
37
40
  @__finalized = false
38
- @__region_config = {}
39
- @__region_specific = region_specific
40
- end
41
-
42
- # Allows region-specific overrides of any of the settings on this
43
- # configuration object. This allows the user to override things like
44
- # AMI and keypair name for regions. Example:
45
- #
46
- # aws.region_config "us-east-1" do |region|
47
- # region.ami = "ami-12345678"
48
- # region.keypair_name = "company-east"
49
- # end
50
- #
51
- # @param [String] region The region name to configure.
52
- # @param [Hash] attributes Direct attributes to set on the configuration
53
- # as a shortcut instead of specifying a full block.
54
- # @yield [config] Yields a new Shell configuration.
55
- def region_config(region, attributes=nil, &block)
56
- # Append the block to the list of region configs for that region.
57
- # We'll evaluate these upon finalization.
58
- @__region_config[region] ||= []
59
-
60
- # Append a block that sets attributes if we got one
61
- if attributes
62
- attr_block = lambda do |config|
63
- config.set_options(attributes)
64
- end
65
-
66
- @__region_config[region] << attr_block
67
- end
68
-
69
- # Append a block if we got one
70
- @__region_config[region] << block if block_given?
71
41
  end
72
42
 
73
43
  #-------------------------------------------------------------------
@@ -76,102 +46,31 @@ module VagrantPlugins
76
46
 
77
47
  def merge(other)
78
48
  super.tap do |result|
79
- # Copy over the region specific flag. "True" is retained if either
80
- # has it.
81
- new_region_specific = other.instance_variable_get(:@__region_specific)
82
- result.instance_variable_set(
83
- :@__region_specific, new_region_specific || @__region_specific)
84
-
85
- # Go through all the region configs and prepend ours onto
86
- # theirs.
87
- new_region_config = other.instance_variable_get(:@__region_config)
88
- @__region_config.each do |key, value|
89
- new_region_config[key] ||= []
90
- new_region_config[key] = value + new_region_config[key]
91
- end
92
-
93
- # Set it
94
- result.instance_variable_set(:@__region_config, new_region_config)
95
-
96
- # Merge in the tags
97
- result.tags.merge!(self.tags)
98
- result.tags.merge!(other.tags)
99
49
  end
100
50
  end
101
51
 
102
52
  def finalize!
53
+ # Image must be nil, since we can't default that
54
+ @image = nil if @image == UNSET_VALUE
55
+
103
56
  # Set the default timeout for waiting for an instance to be ready
104
57
  @instance_ready_timeout = 120 if @instance_ready_timeout == UNSET_VALUE
105
58
 
106
59
  # User Data is nil by default
107
60
  @user_data = nil if @user_data == UNSET_VALUE
108
61
 
109
- # Image must be nil, since we can't default that
110
- @image = nil if @image == UNSET_VALUE
111
-
112
62
  # No default shell script
113
63
  @script = nil if @script == UNSET_VALUE
114
64
 
115
- # No run args by default
65
+ # No rub args by default
116
66
  @run_args = [] if @run_args == UNSET_VALUE
117
67
 
118
- # Compile our region specific configurations only within
119
- # NON-REGION-SPECIFIC configurations.
120
- if !@__region_specific
121
- @__region_config.each do |region, blocks|
122
- config = self.class.new(true).merge(self)
123
-
124
- # Execute the configuration for each block
125
- blocks.each { |b| b.call(config) }
126
-
127
- # The region name of the configuration always equals the
128
- # region config name:
129
- config.region = region
130
-
131
- # Finalize the configuration
132
- config.finalize!
133
-
134
- # Store it for retrieval
135
- @__compiled_region_configs[region] = config
136
- end
137
- end
138
-
139
68
  # Mark that we finalized
140
69
  @__finalized = true
141
70
  end
142
71
 
143
72
  def validate(machine)
144
- errors = _detected_errors
145
-
146
- errors << I18n.t("vagrant_shell.config.region_required") if @region.nil?
147
-
148
- if @region
149
- # Get the configuration for the region we're using and validate only
150
- # that region.
151
- config = get_region_config(@region)
152
-
153
- if !config.use_iam_profile
154
- errors << I18n.t("vagrant_shell.config.access_key_id_required") if \
155
- config.access_key_id.nil?
156
- errors << I18n.t("vagrant_shell.config.secret_access_key_required") if \
157
- config.secret_access_key.nil?
158
- end
159
-
160
- errors << I18n.t("vagrant_shell.config.ami_required") if config.ami.nil?
161
- end
162
-
163
- { "Shell Provider" => errors }
164
- end
165
-
166
- # This gets the configuration for a specific region. It shouldn't
167
- # be called by the general public and is only used internally.
168
- def get_region_config(name)
169
- if !@__finalized
170
- raise "Configuration must be finalized before calling this method."
171
- end
172
-
173
- # Return the compiled region config
174
- @__compiled_region_configs[name] || self
73
+ { "Shell Provider" => [ ] }
175
74
  end
176
75
 
177
76
  # utilities
@@ -180,16 +79,9 @@ module VagrantPlugins
180
79
  end
181
80
 
182
81
  def find_script name
183
- try_path = ENV['PATH'].split(/:/).flatten.inject([]) { |acc, p| x = File.join(p,"shell-#{name.to_s}"); File.exists?(x) && acc << x; acc }.first
184
- if try_path
185
- return try_path
186
- end
187
-
188
- try_load = $:.inject([]) { |acc, p| x = File.expand_path("../libexec/shell-#{name.to_s}", p); File.exists?(x) && acc << x; acc }.first
189
- if try_load
190
- return try_load
191
- end
82
+ File.expand_path("../../../libexec/shell-#{name}", __FILE__)
192
83
  end
84
+
193
85
  end
194
86
  end
195
87
  end
@@ -11,20 +11,16 @@ module VagrantPlugins
11
11
  error_key(:shell_error)
12
12
  end
13
13
 
14
- class InternalShellError < VagrantShellError
15
- error_key(:internal_shell_error)
16
- end
17
-
18
- class InstanceReadyTimeout < VagrantShellError
14
+ class TimeoutError < VagrantShellError
19
15
  error_key(:instance_ready_timeout)
20
16
  end
21
17
 
22
- class RsyncError < VagrantShellError
23
- error_key(:rsync_error)
18
+ class ComputeError < VagrantShellError
19
+ error_key(:instance_ready_timeout)
24
20
  end
25
21
 
26
- class MkdirError < VagrantShellError
27
- error_key(:mkdir_error)
22
+ class InstanceReadyTimeout < VagrantShellError
23
+ error_key(:instance_ready_timeout)
28
24
  end
29
25
  end
30
26
  end
@@ -18,13 +18,14 @@ module VagrantPlugins
18
18
  This plugin installs a provider that allows Vagrant to manage
19
19
  machines with shell scripts.
20
20
  DESC
21
+
21
22
  def self.make_provider nm_provider
22
23
  config(nm_provider, :provider) do
23
24
  require_relative "config"
24
25
  Config
25
26
  end
26
27
 
27
- provider(nm_provider, parallel: true) do
28
+ provider(nm_provider) do
28
29
  # Setup logging and i18n
29
30
  setup_logging
30
31
  setup_i18n
@@ -35,6 +36,8 @@ module VagrantPlugins
35
36
  end
36
37
  end
37
38
 
39
+ make_provider(:shell)
40
+
38
41
  # This initializes the internationalization strings.
39
42
  def self.setup_i18n
40
43
  I18n.load_path << File.expand_path("locales/en.yml", Shell.source_root)
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module Shell
3
- VERSION = File.read(File.expand_path("../../../VERSION", __FILE__)).strip
3
+ VERSION = "0.2.15"
4
4
  end
5
5
  end
File without changes
data/libexec/shell-docker CHANGED
@@ -8,10 +8,6 @@ cmd="$1"; shift
8
8
  case "$cmd" in
9
9
  run-instance)
10
10
  image="$1"; shift
11
- cmd_bootstrap="$(which shell-docker-$image 2>&- || true)"
12
- if [[ -x "$cmd_bootstrap" ]]; then
13
- $cmd_bootstrap
14
- fi
15
11
  docker run -d "$image" "$@"
16
12
  ;;
17
13
  terminate-instance)
@@ -16,7 +16,7 @@ case "$cmd" in
16
16
  image="$1"; shift
17
17
  debug "run-instance $image"
18
18
  debug "run-instance args: $* 1>&2"
19
- echo "$image"
19
+ echo $RANDOM
20
20
  ;;
21
21
  terminate-instance)
22
22
  instance="$1"; shift
@@ -26,7 +26,7 @@ case "$cmd" in
26
26
  instance="$1"; shift
27
27
  debug "ssh-info $instance"
28
28
  debug "ssh-info: 127.0.0.1 22"
29
- echo "${instance} 22"
29
+ echo "127.0.0.1 22"
30
30
  ;;
31
31
  read-state)
32
32
  instance="$1"; shift
Binary file
@@ -0,0 +1,51 @@
1
+ $:.unshift File.expand_path("../lib", __FILE__)
2
+ require "vagrant-shell/version"
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "vagrant-shell"
6
+ s.version = VagrantPlugins::Shell::VERSION
7
+ s.platform = Gem::Platform::RUBY
8
+ s.authors = [ "Tom Bombadil", "Mitchell Hashimoto" ]
9
+ s.email = [ "amanibhavam@destructuring.org", "mitchell@hashicorp.com" ]
10
+ s.homepage = "http://destructuring.org/vagrant-shell"
11
+ s.summary = "Enables Vagrant to manage machines using shell scripts"
12
+ s.description = "Enables Vagrant to manage machines using shell scripts"
13
+
14
+ s.required_rubygems_version = ">= 1.3.6"
15
+ s.rubyforge_project = "vagrant-shell"
16
+
17
+ # The following block of code determines the files that should be included
18
+ # in the gem. It does this by reading all the files in the directory where
19
+ # this gemspec is, and parsing out the ignored files from the gitignore.
20
+ # Note that the entire gitignore(5) syntax is not supported, specifically
21
+ # the "!" syntax, but it should mostly work correctly.
22
+ root_path = File.dirname(__FILE__)
23
+ all_files = Dir.chdir(root_path) { Dir.glob("**/{*,.*}") }
24
+ all_files.reject! { |file| [".", ".."].include?(File.basename(file)) }
25
+ gitignore_path = File.join(root_path, ".gitignore")
26
+ gitignore = File.readlines(gitignore_path)
27
+ gitignore.map! { |line| line.chomp.strip }
28
+ gitignore.reject! { |line| line.empty? || line =~ /^(#|!)/ }
29
+
30
+ unignored_files = all_files.reject do |file|
31
+ # Ignore any directories, the gemspec only cares about files
32
+ next true if File.directory?(file)
33
+
34
+ # Ignore any paths that match anything in the gitignore. We do
35
+ # two tests here:
36
+ #
37
+ # - First, test to see if the entire path matches the gitignore.
38
+ # - Second, match if the basename does, this makes it so that things
39
+ # like '.DS_Store' will match sub-directories too (same behavior
40
+ # as git).
41
+ #
42
+ gitignore.any? do |ignore|
43
+ File.fnmatch(ignore, file, File::FNM_PATHNAME) ||
44
+ File.fnmatch(ignore, File.basename(file), File::FNM_PATHNAME)
45
+ end
46
+ end
47
+
48
+ s.files = unignored_files
49
+ s.executables = unignored_files.map { |f| f[/^bin\/(.*)/, 1] }.compact
50
+ s.require_path = 'lib'
51
+ end
metadata CHANGED
@@ -1,29 +1,35 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: vagrant-shell
3
- version: !ruby/object:Gem::Version
4
- version: 0.2.14
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.15
5
5
  platform: ruby
6
- authors:
6
+ authors:
7
7
  - Tom Bombadil
8
8
  - Mitchell Hashimoto
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-01-17 00:00:00.000000000 Z
12
+
13
+ date: 2014-01-17 00:00:00 Z
13
14
  dependencies: []
15
+
14
16
  description: Enables Vagrant to manage machines using shell scripts
15
- email:
17
+ email:
16
18
  - amanibhavam@destructuring.org
17
19
  - mitchell@hashicorp.com
18
20
  executables: []
21
+
19
22
  extensions: []
23
+
20
24
  extra_rdoc_files: []
21
- files:
22
- - lib/vagrant-shell/action/connect_shell.rb
25
+
26
+ files:
27
+ - CHANGELOG.md
28
+ - Gemfile
29
+ - Gemfile.lock
23
30
  - lib/vagrant-shell/action/is_created.rb
24
31
  - lib/vagrant-shell/action/message_already_created.rb
25
32
  - lib/vagrant-shell/action/message_not_created.rb
26
- - lib/vagrant-shell/action/message_will_not_destroy.rb
27
33
  - lib/vagrant-shell/action/read_ssh_info.rb
28
34
  - lib/vagrant-shell/action/read_state.rb
29
35
  - lib/vagrant-shell/action/run_instance.rb
@@ -34,39 +40,46 @@ files:
34
40
  - lib/vagrant-shell/errors.rb
35
41
  - lib/vagrant-shell/plugin.rb
36
42
  - lib/vagrant-shell/provider.rb
37
- - lib/vagrant-shell/ssh-agent.rb
38
43
  - lib/vagrant-shell/util/timer.rb
39
44
  - lib/vagrant-shell/version.rb
40
45
  - lib/vagrant-shell.rb
41
- - locales/en.yml
46
+ - libexec/shell-aws
42
47
  - libexec/shell-docker
43
- - libexec/shell-ec2
44
- - libexec/shell-static
45
- - CHANGELOG.md
48
+ - libexec/shell-self
46
49
  - LICENSE
50
+ - locales/en.yml
51
+ - Makefile
47
52
  - README.md
48
- - VERSION
53
+ - vagrant-shell-0.2.7.gem
54
+ - vagrant-shell.gemspec
55
+ - .gitignore
56
+ - .gitsetup.yml
49
57
  homepage: http://destructuring.org/vagrant-shell
50
58
  licenses: []
59
+
51
60
  metadata: {}
61
+
52
62
  post_install_message:
53
63
  rdoc_options: []
54
- require_paths:
64
+
65
+ require_paths:
55
66
  - lib
56
- required_ruby_version: !ruby/object:Gem::Requirement
57
- requirements:
58
- - - ! '>='
59
- - !ruby/object:Gem::Version
60
- version: '0'
61
- required_rubygems_version: !ruby/object:Gem::Requirement
62
- requirements:
63
- - - ! '>='
64
- - !ruby/object:Gem::Version
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: "0"
72
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
65
76
  version: 1.3.6
66
77
  requirements: []
78
+
67
79
  rubyforge_project: vagrant-shell
68
80
  rubygems_version: 2.1.11
69
81
  signing_key:
70
82
  specification_version: 4
71
83
  summary: Enables Vagrant to manage machines using shell scripts
72
84
  test_files: []
85
+
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.2.14
@@ -1,30 +0,0 @@
1
- require "log4r"
2
-
3
- module VagrantPlugins
4
- module Shell
5
- module Action
6
- # This action connects to Shell, verifies credentials work, and
7
- # puts the Shell script object into the `:script` key
8
- # in the environment.
9
- class ConnectShell
10
- def initialize(app, env)
11
- @app = app
12
- @logger = Log4r::Logger.new("vagrant_shell::action::connect_shell")
13
- end
14
-
15
- def call(env)
16
- # Get the region we're going to booting up in
17
- region = env[:machine].provider_config.region
18
-
19
- # Get the configs
20
- region_config = env[:machine].provider_config.get_region_config(region)
21
-
22
- @logger.info("Connecting to Shell...")
23
- env[:script] = nil
24
-
25
- @app.call(env)
26
- end
27
- end
28
- end
29
- end
30
- end
@@ -1,16 +0,0 @@
1
- module VagrantPlugins
2
- module Shell
3
- module Action
4
- class MessageWillNotDestroy
5
- def initialize(app, env)
6
- @app = app
7
- end
8
-
9
- def call(env)
10
- env[:ui].info(I18n.t("vagrant_shell.will_not_destroy", name: env[:machine].name))
11
- @app.call(env)
12
- end
13
- end
14
- end
15
- end
16
- end
@@ -1,23 +0,0 @@
1
- # fool vagrant into using ssh-agent keys instead of a fixed key on file
2
- module Vagrant
3
- module Util
4
- class Platform
5
- def self.solaris?
6
- true
7
- end
8
- end
9
- end
10
- end
11
-
12
- require "net/ssh"
13
-
14
- module Net::SSH
15
- class << self
16
- alias_method :old_start, :start
17
-
18
- def start(host, username, opts)
19
- opts[:keys_only] = false
20
- self.old_start(host, username, opts)
21
- end
22
- end
23
- end