growl-transfer 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,15 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
8
+ group :development do
9
+ gem "shoulda", ">= 0"
10
+ gem "bundler", "~> 1.0.0"
11
+ gem "jeweler", "~> 1.5.1"
12
+ gem "rcov", ">= 0"
13
+ gem "ruby-growl", ">=3.0"
14
+ gem "net-scp", ">=1.0.4"
15
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,26 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ git (1.2.5)
5
+ jeweler (1.5.1)
6
+ bundler (~> 1.0.0)
7
+ git (>= 1.2.5)
8
+ rake
9
+ net-scp (1.0.4)
10
+ net-ssh (>= 1.99.1)
11
+ net-ssh (2.0.23)
12
+ rake (0.8.7)
13
+ rcov (0.9.9)
14
+ ruby-growl (3.0)
15
+ shoulda (2.11.3)
16
+
17
+ PLATFORMS
18
+ ruby
19
+
20
+ DEPENDENCIES
21
+ bundler (~> 1.0.0)
22
+ jeweler (~> 1.5.1)
23
+ net-scp (>= 1.0.4)
24
+ rcov
25
+ ruby-growl (>= 3.0)
26
+ shoulda
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Clint Shryock
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,19 @@
1
+ = growl-down
2
+
3
+ Growl-Down is a little gem that wraps around a file transfer protocol (scp/curl) and notifies you via growl when the transfer is complete.
4
+
5
+ == Contributing to growl-down
6
+
7
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
8
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
9
+ * Fork the project
10
+ * Start a feature/bugfix branch
11
+ * Commit and push until you are happy with your contribution
12
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2010 Clint Shryock. See LICENSE.txt for
18
+ further details.
19
+
data/Rakefile ADDED
@@ -0,0 +1,54 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'rake'
11
+
12
+ require 'jeweler'
13
+ Jeweler::Tasks.new do |gem|
14
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
15
+ gem.name = "growl-transfer"
16
+ gem.homepage = "https://github.com/ctshryock/growl-transfer"
17
+ gem.license = "MIT"
18
+ gem.summary = %Q{Transfer big files, get Growl notice when it's done}
19
+ gem.description = %Q{A ruby gem wrapper around scp / curl / wget (and the like) that notifies you via Growl when the transfer is complete}
20
+ gem.email = "clint+growl-transfer@ctshryock.com"
21
+ gem.authors = ["Clint Shryock"]
22
+ # Include your dependencies below. Runtime dependencies are required when using your gem,
23
+ # and development dependencies are only needed for development (ie running rake tasks, tests, etc)
24
+ gem.add_runtime_dependency "ruby-growl", ">=3.0"
25
+ gem.add_runtime_dependency "net-scp", ">=1.0.4"
26
+ # gem.add_development_dependency 'rspec', '> 1.2.3'
27
+ end
28
+ Jeweler::RubygemsDotOrgTasks.new
29
+
30
+ require 'rake/testtask'
31
+ Rake::TestTask.new(:test) do |test|
32
+ test.libs << 'lib' << 'test'
33
+ test.pattern = 'test/**/test_*.rb'
34
+ test.verbose = true
35
+ end
36
+
37
+ require 'rcov/rcovtask'
38
+ Rcov::RcovTask.new do |test|
39
+ test.libs << 'test'
40
+ test.pattern = 'test/**/test_*.rb'
41
+ test.verbose = true
42
+ end
43
+
44
+ task :default => :test
45
+
46
+ require 'rake/rdoctask'
47
+ Rake::RDocTask.new do |rdoc|
48
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
49
+
50
+ rdoc.rdoc_dir = 'rdoc'
51
+ rdoc.title = "gd #{version}"
52
+ rdoc.rdoc_files.include('README*')
53
+ rdoc.rdoc_files.include('lib/**/*.rb')
54
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.2
data/bin/gt ADDED
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env ruby
2
+ $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
3
+ require 'growl-transfer'
4
+
5
+ require 'optparse'
6
+
7
+ # Get source and destintation from command line
8
+ options = {}
9
+ case ARGV.size
10
+ when 1
11
+ options['remote'] = ARGV[0]
12
+ options['local'] = '.'
13
+ when 2
14
+ options['remote'] = ARGV[0]
15
+ options['local'] = ARGV[1]
16
+ else
17
+ puts "Invalid options"
18
+ exit(1)
19
+ end
20
+
21
+ downloader = GrowlTransfer::GTScp.new(STDOUT)
22
+ downloader.download(options['remote'], options['local'])
@@ -0,0 +1,15 @@
1
+ Feature: growl-down downloads a file via scp
2
+
3
+ As a busy developer
4
+ I want to download a large file via scp
5
+ And receive a growl notice when it is completed
6
+ So that I can do other things in the meantime
7
+ And not have to watch or check the progress
8
+
9
+ Scenario: Download file assuming ssh keyless authentication
10
+ Given I have an available server "ctshryock.com"
11
+ And "growl-down-test/unicorns.zip" as the file name
12
+ When I run "download"
13
+ Then I should see "Finished!"
14
+ And TEST_DIR should contains "unicorns.zip" file
15
+
@@ -0,0 +1,48 @@
1
+ Before do
2
+ FileUtils.mkdir(TEST_DIR)
3
+ Dir.chdir(TEST_DIR)
4
+ end
5
+
6
+ After do
7
+ Dir.chdir(TEST_DIR)
8
+ FileUtils.rm_rf(TEST_DIR)
9
+ end
10
+
11
+ class Output
12
+ def messages
13
+ @messages ||= []
14
+ end
15
+
16
+ def puts(message)
17
+ messages << message
18
+ end
19
+ end
20
+
21
+ #
22
+ # Start SCP steps
23
+ #
24
+ def output
25
+ @output ||= Output.new
26
+ end
27
+
28
+ Given /^I have an available server "([^"]*)"$/ do |remote_host|
29
+ @remote = []
30
+ @remote << remote_host
31
+ end
32
+
33
+ When /^"([^"]*)" as the file name$/ do |remote_path|
34
+ @remote << remote_path
35
+ end
36
+
37
+ When /^I run "([^"]*)"$/ do |arg1|
38
+ gd_scp = GrowlTransfer::GTScp.new(output)
39
+ gd_scp.download(@remote.join(':'), TEST_DIR)
40
+ end
41
+
42
+ Then /^I should see "([^"]*)"$/ do |status|
43
+ output.messages.should include(status)
44
+ end
45
+
46
+ Then /^TEST_DIR should contains "([^"]*)" file$/ do |arg1|
47
+ File.file?([TEST_DIR, arg1].join('/'))
48
+ end
@@ -0,0 +1,5 @@
1
+ $LOAD_PATH << File.expand_path('../../../lib', __FILE__)
2
+ require 'growl-transfer'
3
+ require 'fileutils'
4
+
5
+ TEST_DIR = File.join('/', 'tmp', 'growl-transfer')
@@ -0,0 +1,82 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{growl-down}
8
+ s.version = "0.0.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Clint Shryock"]
12
+ s.date = %q{2011-01-27}
13
+ s.default_executable = %q{gd}
14
+ s.description = %q{A ruby gem wrapper around scp / curl / wget (and the like) that notifies you via Growl when the transfer is complete}
15
+ s.email = %q{clint+growl-down@ctshryock.com}
16
+ s.executables = ["gd"]
17
+ s.extra_rdoc_files = [
18
+ "LICENSE.txt",
19
+ "README.rdoc"
20
+ ]
21
+ s.files = [
22
+ "Gemfile",
23
+ "Gemfile.lock",
24
+ "LICENSE.txt",
25
+ "README.rdoc",
26
+ "Rakefile",
27
+ "VERSION",
28
+ "bin/gd",
29
+ "features/gd_scp_file.feature",
30
+ "features/step_definitions/gd_scp_steps.rb",
31
+ "features/support/env.rb",
32
+ "growl-down.gemspec",
33
+ "lib/growl-down.rb",
34
+ "lib/growl-down/gd_scp.rb",
35
+ "test/helper.rb",
36
+ "test/test_gd.rb"
37
+ ]
38
+ s.homepage = %q{http://github.com/ctshryock/gd}
39
+ s.licenses = ["MIT"]
40
+ s.require_paths = ["lib"]
41
+ s.rubygems_version = %q{1.3.7}
42
+ s.summary = %q{Download big files, get Growl notice when it's done}
43
+ s.test_files = [
44
+ "test/helper.rb",
45
+ "test/test_gd.rb"
46
+ ]
47
+
48
+ if s.respond_to? :specification_version then
49
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
50
+ s.specification_version = 3
51
+
52
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
53
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
54
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
55
+ s.add_development_dependency(%q<jeweler>, ["~> 1.5.1"])
56
+ s.add_development_dependency(%q<rcov>, [">= 0"])
57
+ s.add_development_dependency(%q<ruby-growl>, [">= 3.0"])
58
+ s.add_development_dependency(%q<net-scp>, [">= 1.0.4"])
59
+ s.add_runtime_dependency(%q<ruby-growl>, [">= 3.0"])
60
+ s.add_runtime_dependency(%q<net-scp>, [">= 1.0.4"])
61
+ else
62
+ s.add_dependency(%q<shoulda>, [">= 0"])
63
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
64
+ s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
65
+ s.add_dependency(%q<rcov>, [">= 0"])
66
+ s.add_dependency(%q<ruby-growl>, [">= 3.0"])
67
+ s.add_dependency(%q<net-scp>, [">= 1.0.4"])
68
+ s.add_dependency(%q<ruby-growl>, [">= 3.0"])
69
+ s.add_dependency(%q<net-scp>, [">= 1.0.4"])
70
+ end
71
+ else
72
+ s.add_dependency(%q<shoulda>, [">= 0"])
73
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
74
+ s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
75
+ s.add_dependency(%q<rcov>, [">= 0"])
76
+ s.add_dependency(%q<ruby-growl>, [">= 3.0"])
77
+ s.add_dependency(%q<net-scp>, [">= 1.0.4"])
78
+ s.add_dependency(%q<ruby-growl>, [">= 3.0"])
79
+ s.add_dependency(%q<net-scp>, [">= 1.0.4"])
80
+ end
81
+ end
82
+
@@ -0,0 +1,5 @@
1
+ require 'rubygems'
2
+ require 'net/scp'
3
+ require 'ruby-growl'
4
+
5
+ require 'growl-transfer/gt_scp.rb'
@@ -0,0 +1,24 @@
1
+ module GrowlTransfer
2
+ class GTScp
3
+ def initialize(output)
4
+ @output = output
5
+ end
6
+
7
+ def download(remote, local_path)
8
+ @output.puts "Downloading #{remote}"
9
+ params = remote.split(":")
10
+ file = params.last.split("/").last
11
+ Net::SCP.start(params[0], "clint") do |scp|
12
+ scp.download!(params[1], local_path, {:recursive => true, :verbose => true}) do |ch, name, sent, total|
13
+ # => progress?
14
+ end
15
+ end
16
+ @output.puts "Finished!"
17
+ g = Growl.new "localhost", "GrowlTransfer",
18
+ ["GrowlTransfer Notification"]
19
+ g.notify "GrowlTransfer Notification", "#{file}",
20
+ "Download complete"
21
+ end
22
+
23
+ end
24
+ end
data/test/helper.rb ADDED
@@ -0,0 +1,18 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'test/unit'
11
+ require 'shoulda'
12
+
13
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
15
+ require 'gd'
16
+
17
+ class Test::Unit::TestCase
18
+ end
data/test/test_gd.rb ADDED
@@ -0,0 +1,7 @@
1
+ require 'helper'
2
+
3
+ class TestGd < Test::Unit::TestCase
4
+ should "probably rename this file and start testing for real" do
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,204 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: growl-transfer
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 2
10
+ version: 0.0.2
11
+ platform: ruby
12
+ authors:
13
+ - Clint Shryock
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-01-27 00:00:00 -06:00
19
+ default_executable: gt
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ type: :development
23
+ prerelease: false
24
+ name: shoulda
25
+ version_requirements: &id001 !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ">="
29
+ - !ruby/object:Gem::Version
30
+ hash: 3
31
+ segments:
32
+ - 0
33
+ version: "0"
34
+ requirement: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ type: :development
37
+ prerelease: false
38
+ name: bundler
39
+ version_requirements: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ~>
43
+ - !ruby/object:Gem::Version
44
+ hash: 23
45
+ segments:
46
+ - 1
47
+ - 0
48
+ - 0
49
+ version: 1.0.0
50
+ requirement: *id002
51
+ - !ruby/object:Gem::Dependency
52
+ type: :development
53
+ prerelease: false
54
+ name: jeweler
55
+ version_requirements: &id003 !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ~>
59
+ - !ruby/object:Gem::Version
60
+ hash: 1
61
+ segments:
62
+ - 1
63
+ - 5
64
+ - 1
65
+ version: 1.5.1
66
+ requirement: *id003
67
+ - !ruby/object:Gem::Dependency
68
+ type: :development
69
+ prerelease: false
70
+ name: rcov
71
+ version_requirements: &id004 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ hash: 3
77
+ segments:
78
+ - 0
79
+ version: "0"
80
+ requirement: *id004
81
+ - !ruby/object:Gem::Dependency
82
+ type: :development
83
+ prerelease: false
84
+ name: ruby-growl
85
+ version_requirements: &id005 !ruby/object:Gem::Requirement
86
+ none: false
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ hash: 7
91
+ segments:
92
+ - 3
93
+ - 0
94
+ version: "3.0"
95
+ requirement: *id005
96
+ - !ruby/object:Gem::Dependency
97
+ type: :development
98
+ prerelease: false
99
+ name: net-scp
100
+ version_requirements: &id006 !ruby/object:Gem::Requirement
101
+ none: false
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ hash: 31
106
+ segments:
107
+ - 1
108
+ - 0
109
+ - 4
110
+ version: 1.0.4
111
+ requirement: *id006
112
+ - !ruby/object:Gem::Dependency
113
+ type: :runtime
114
+ prerelease: false
115
+ name: ruby-growl
116
+ version_requirements: &id007 !ruby/object:Gem::Requirement
117
+ none: false
118
+ requirements:
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ hash: 7
122
+ segments:
123
+ - 3
124
+ - 0
125
+ version: "3.0"
126
+ requirement: *id007
127
+ - !ruby/object:Gem::Dependency
128
+ type: :runtime
129
+ prerelease: false
130
+ name: net-scp
131
+ version_requirements: &id008 !ruby/object:Gem::Requirement
132
+ none: false
133
+ requirements:
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ hash: 31
137
+ segments:
138
+ - 1
139
+ - 0
140
+ - 4
141
+ version: 1.0.4
142
+ requirement: *id008
143
+ description: A ruby gem wrapper around scp / curl / wget (and the like) that notifies you via Growl when the transfer is complete
144
+ email: clint+growl-transfer@ctshryock.com
145
+ executables:
146
+ - gt
147
+ extensions: []
148
+
149
+ extra_rdoc_files:
150
+ - LICENSE.txt
151
+ - README.rdoc
152
+ files:
153
+ - Gemfile
154
+ - Gemfile.lock
155
+ - LICENSE.txt
156
+ - README.rdoc
157
+ - Rakefile
158
+ - VERSION
159
+ - bin/gt
160
+ - features/gt_scp_file.feature
161
+ - features/step_definitions/gt_scp_steps.rb
162
+ - features/support/env.rb
163
+ - growl-down.gemspec
164
+ - lib/growl-transfer.rb
165
+ - lib/growl-transfer/gt_scp.rb
166
+ - test/helper.rb
167
+ - test/test_gd.rb
168
+ has_rdoc: true
169
+ homepage: https://github.com/ctshryock/growl-transfer
170
+ licenses:
171
+ - MIT
172
+ post_install_message:
173
+ rdoc_options: []
174
+
175
+ require_paths:
176
+ - lib
177
+ required_ruby_version: !ruby/object:Gem::Requirement
178
+ none: false
179
+ requirements:
180
+ - - ">="
181
+ - !ruby/object:Gem::Version
182
+ hash: 3
183
+ segments:
184
+ - 0
185
+ version: "0"
186
+ required_rubygems_version: !ruby/object:Gem::Requirement
187
+ none: false
188
+ requirements:
189
+ - - ">="
190
+ - !ruby/object:Gem::Version
191
+ hash: 3
192
+ segments:
193
+ - 0
194
+ version: "0"
195
+ requirements: []
196
+
197
+ rubyforge_project:
198
+ rubygems_version: 1.3.7
199
+ signing_key:
200
+ specification_version: 3
201
+ summary: Transfer big files, get Growl notice when it's done
202
+ test_files:
203
+ - test/helper.rb
204
+ - test/test_gd.rb