vagrant-file-watcher 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +41 -0
- data/Rakefile +2 -0
- data/bin/vagrant-file-watcher +76 -0
- data/lib/vagrant/file/watcher.rb +9 -0
- data/lib/vagrant/file/watcher/version.rb +7 -0
- data/vagrant-file-watcher.gemspec +37 -0
- metadata +145 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 364e492c5729f9433589219a9a5b33e0308018f6
|
4
|
+
data.tar.gz: c93cc409244926d11fbe49c53d380ac16d35a819
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9b6fe5f351a616e7c6ec63d0ddd502c8d1393213a910006403a21a73a2e9ba137a9080600332fc5cc3618569c2f1f4956882ba86b13d794dd6b85edb1f2bea8a
|
7
|
+
data.tar.gz: f57b0755f687e1db9d60e463da0bb6d754ccd84e1a5bac07c055215462dc6efb4ddea95c75ecafaecc4434cafe0a6399047b2c8e90d170623fbbb347732c68cc
|
data/.gitignore
ADDED
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
vagrant-file-watcher
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.3.1
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 David Kerber
|
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
|
13
|
+
all 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
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# Vagrant::File::Watcher
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/vagrant/file/watcher`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'vagrant-file-watcher'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install vagrant-file-watcher
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
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).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/vagrant-file-watcher.
|
36
|
+
|
37
|
+
|
38
|
+
## License
|
39
|
+
|
40
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
41
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'optparse'
|
5
|
+
require 'pathname'
|
6
|
+
require 'net/ssh'
|
7
|
+
require 'listen'
|
8
|
+
require 'pry'
|
9
|
+
|
10
|
+
# The default options
|
11
|
+
options = {
|
12
|
+
host: 'localhost',
|
13
|
+
port: 2222,
|
14
|
+
user: 'vagrant',
|
15
|
+
private_key_paths: [],
|
16
|
+
source_directory: Dir.pwd,
|
17
|
+
target_directory: "/host_folder/#{File.basename(Dir.pwd)}"
|
18
|
+
}
|
19
|
+
|
20
|
+
OptionParser.new do |option_parser|
|
21
|
+
option_parser.banner = 'Usage: vagrant-file-watcher [options]'
|
22
|
+
|
23
|
+
option_parser.on('-h', '--host [HOST]', String, 'The remote machine') do |host|
|
24
|
+
options[:host] ||= host
|
25
|
+
end
|
26
|
+
|
27
|
+
option_parser.on('-p', '--port [PORT]', Integer, 'The port on which to connect to the remote machine') do |port|
|
28
|
+
options[:port] ||= port
|
29
|
+
end
|
30
|
+
|
31
|
+
option_parser.on('-u', '--user [USERNAME]', String, 'The user as which to connect to the remote machine') do |user|
|
32
|
+
options[:user] ||= user
|
33
|
+
end
|
34
|
+
|
35
|
+
option_parser.on('-k', '--private-key [PATH]', String, 'A private key with witch to connect to the remote machine') do |private_key_path|
|
36
|
+
options[:private_key_paths] << private_key_path
|
37
|
+
end
|
38
|
+
|
39
|
+
# option_parser.on('-v', '--vagrant-directory [PATH]', String, 'The directory of the Vagrantfile (will use attempt to extract the private key)') do |vagrant_path|
|
40
|
+
# options[:private_key_paths] << File.join(vagrant_path, VAGRANT_PRIVATE_KEY_PATH)
|
41
|
+
# end
|
42
|
+
|
43
|
+
option_parser.on('-s', '--source-directory [PATH]', String, 'The directory on the local machine to watch') do |source_directory|
|
44
|
+
options[:source_directory] = source_directory
|
45
|
+
end
|
46
|
+
|
47
|
+
option_parser.on('-t', '--target-directory [PATH]', String, 'The directory on the remote machine to touch') do |target_directory|
|
48
|
+
options[:target_directory] = target_directory
|
49
|
+
end
|
50
|
+
end.parse!
|
51
|
+
|
52
|
+
puts "[*] Starting agape-watch with options `#{options.inspect}`..."
|
53
|
+
|
54
|
+
target_directory, source_directory_pathname = options[:target_directory], Pathname.new(options[:source_directory])
|
55
|
+
|
56
|
+
Net::SSH.start(options[:host], options[:user], port: options[:port], keys: options[:private_key_paths]) do |client|
|
57
|
+
puts "[*] Connected to #{options[:host]}!"
|
58
|
+
|
59
|
+
|
60
|
+
listener = Listen.to(options[:source_directory], ignore: /\/\..*/) do |local_paths, *|
|
61
|
+
relative_paths = local_paths.map { |local_path| Pathname.new(local_path).relative_path_from(source_directory_pathname).to_s }
|
62
|
+
|
63
|
+
relative_paths.each do |relative_path|
|
64
|
+
remote_path = File.join(target_directory, relative_path)
|
65
|
+
|
66
|
+
puts "[*] Touch #{remote_path}"
|
67
|
+
client.exec!(%{touch "#{remote_path}"})
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
listener.start
|
72
|
+
|
73
|
+
# the listener runs in another thread... sleep forever waiting for an interrupt
|
74
|
+
sleep
|
75
|
+
end
|
76
|
+
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'vagrant/file/watcher/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "vagrant-file-watcher"
|
8
|
+
spec.version = Vagrant::File::Watcher::VERSION
|
9
|
+
spec.authors = ["Alec Larsen","David Kerber"]
|
10
|
+
spec.email = ["alec.larsen@agapered.com","dave@agapered.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{A simple utility to send file signals across shared folders.}
|
13
|
+
spec.description = %q{A simple utility to send file signals across shared folders. This is useful for situations such as if you are running Grails inside a vagrant vm.}
|
14
|
+
spec.homepage = "https://github.com/agapered/vagrant-file-watcher"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
21
|
+
else
|
22
|
+
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
23
|
+
end
|
24
|
+
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
26
|
+
spec.bindir = "bin"
|
27
|
+
spec.executables = %w{ vagrant-file-watcher}
|
28
|
+
|
29
|
+
spec.add_dependency 'listen'
|
30
|
+
spec.add_dependency 'pry'
|
31
|
+
spec.add_dependency 'net-ssh'
|
32
|
+
spec.add_dependency 'highline'
|
33
|
+
|
34
|
+
spec.add_development_dependency "bundler", "~> 1.12"
|
35
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
36
|
+
|
37
|
+
end
|
metadata
ADDED
@@ -0,0 +1,145 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vagrant-file-watcher
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Alec Larsen
|
8
|
+
- David Kerber
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2016-08-23 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: listen
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '0'
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '0'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: pry
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: net-ssh
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
type: :runtime
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: highline
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
type: :runtime
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: bundler
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '1.12'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '1.12'
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: rake
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - "~>"
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '10.0'
|
91
|
+
type: :development
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - "~>"
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '10.0'
|
98
|
+
description: A simple utility to send file signals across shared folders. This is
|
99
|
+
useful for situations such as if you are running Grails inside a vagrant vm.
|
100
|
+
email:
|
101
|
+
- alec.larsen@agapered.com
|
102
|
+
- dave@agapered.com
|
103
|
+
executables:
|
104
|
+
- vagrant-file-watcher
|
105
|
+
extensions: []
|
106
|
+
extra_rdoc_files: []
|
107
|
+
files:
|
108
|
+
- ".gitignore"
|
109
|
+
- ".ruby-gemset"
|
110
|
+
- ".ruby-version"
|
111
|
+
- Gemfile
|
112
|
+
- Gemfile.lock
|
113
|
+
- LICENSE.txt
|
114
|
+
- README.md
|
115
|
+
- Rakefile
|
116
|
+
- bin/vagrant-file-watcher
|
117
|
+
- lib/vagrant/file/watcher.rb
|
118
|
+
- lib/vagrant/file/watcher/version.rb
|
119
|
+
- vagrant-file-watcher.gemspec
|
120
|
+
homepage: https://github.com/agapered/vagrant-file-watcher
|
121
|
+
licenses:
|
122
|
+
- MIT
|
123
|
+
metadata:
|
124
|
+
allowed_push_host: https://rubygems.org
|
125
|
+
post_install_message:
|
126
|
+
rdoc_options: []
|
127
|
+
require_paths:
|
128
|
+
- lib
|
129
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
130
|
+
requirements:
|
131
|
+
- - ">="
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
requirements: []
|
140
|
+
rubyforge_project:
|
141
|
+
rubygems_version: 2.5.1
|
142
|
+
signing_key:
|
143
|
+
specification_version: 4
|
144
|
+
summary: A simple utility to send file signals across shared folders.
|
145
|
+
test_files: []
|