listenandcopy 0.0.2

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
+ data.tar.gz: 924f2fe9c50477806f04ea4599eeb9ee2b4a3ed0
4
+ metadata.gz: 9fb1847b9261c40acd719b44f960ae50b48aef92
5
+ SHA512:
6
+ data.tar.gz: 660d21534b61ce94e61a6491d00ad3aba3b4aae5b3efa3d85b8f2ca23dcf774a129da9c523535ae6dd0de6c50368d6f4e7a21e7db64cc1b64d63c9a79ea23f1a
7
+ metadata.gz: ff5a4dcecbb0ac6ffe69e5995f183519d22dd4c83d4b8516ebf85eaa9256d8bd4f5118bd9f7f9eeba86d3b8c7687cb3cbca9e25b55beb7dfebf8a758b73845da
data/Rakefile ADDED
@@ -0,0 +1,24 @@
1
+ require 'rake/testtask'
2
+
3
+ desc "Build and install"
4
+ task :default => :build
5
+
6
+
7
+ desc "Validate the gemspec"
8
+ task :gemspec do
9
+ gemspec.validate
10
+ end
11
+
12
+ desc "Build gem locally"
13
+ task :build do
14
+ gemspec.validate
15
+ system "gem build #{gemspec.name}.gemspec"
16
+ FileUtils.mkdir_p "pkg"
17
+ FileUtils.mv "#{gemspec.name}-#{gemspec.version}.gem", "pkg"
18
+ end
19
+
20
+ desc "Install gem locally"
21
+ task :install => :build do
22
+ system "gem install pkg/#{gemspec.name}-#{gemspec.version}"
23
+ end
24
+
data/bin/listenandcopy ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'listenandcopy'
4
+ puts Listenandcopy.listenandcopy(ARGV[0], ARGV[1])
@@ -0,0 +1,17 @@
1
+ require 'FileUtils'
2
+ require 'listen'
3
+
4
+ class Listenandcopy
5
+
6
+ def self.listenandcopy(filePath, destination)
7
+ Listen.to(filePath, :force_polling => true) do |modified, added, removed|
8
+ # This block will be called when there are changes.
9
+ for f in modified
10
+ puts "change detected in file: " + f
11
+ # puts "copy from: " + f + " to: " + destination
12
+ FileUtils.copy(f, destination)
13
+ end
14
+ end
15
+ end
16
+
17
+ end
@@ -0,0 +1,9 @@
1
+ require 'test/unit'
2
+ require 'listenandcopy'
3
+
4
+ class ListenandcopyTest < Test::Unit::TestCase
5
+ def test_listenandcopy
6
+ # assert_equal "hello world", Hola.hi("english")
7
+ assert_equal 1,1
8
+ end
9
+ end
metadata ADDED
@@ -0,0 +1,55 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: listenandcopy
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Balazs Perlaki-Hovath
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2013-02-25 00:00:00 Z
13
+ dependencies: []
14
+
15
+ description: A simple gem, based on listen, that copies the file to a new destination on changes
16
+ email: perlakihorvathbalazs@gmail.com
17
+ executables:
18
+ - listenandcopy
19
+ extensions: []
20
+
21
+ extra_rdoc_files: []
22
+
23
+ files:
24
+ - Rakefile
25
+ - lib/listenandcopy.rb
26
+ - bin/listenandcopy
27
+ - test/test_listenandcopy.rb
28
+ homepage: http://rubygems.org/gems/listenandcopy
29
+ licenses: []
30
+
31
+ metadata: {}
32
+
33
+ post_install_message:
34
+ rdoc_options: []
35
+
36
+ require_paths:
37
+ - lib
38
+ required_ruby_version: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - &id001
41
+ - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: "0"
44
+ required_rubygems_version: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - *id001
47
+ requirements: []
48
+
49
+ rubyforge_project:
50
+ rubygems_version: 2.0.0
51
+ signing_key:
52
+ specification_version: 3
53
+ summary: Listen to a file and copy to new destination!
54
+ test_files:
55
+ - test/test_listenandcopy.rb