captured 0.2.9 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +1 -1
- data/VERSION +1 -1
- data/bin/captured +5 -0
- data/lib/captured/file_uploader.rb +1 -0
- data/lib/captured/history.rb +32 -0
- data/lib/captured.rb +1 -0
- data/spec/fixtures/history +3 -0
- data/spec/history_spec.rb +20 -0
- data/spec/spec_helper.rb +2 -0
- data/spec/uploader_specs/imageshack_uploader_spec.rb +10 -8
- data/spec/uploader_specs/imgur_uploader_spec.rb +15 -0
- data/spec/uploader_specs/scp_uploader_spec.rb +10 -8
- metadata +8 -2
data/README.markdown
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
data/bin/captured
CHANGED
@@ -18,6 +18,11 @@ OptionParser.new do |opts|
|
|
18
18
|
exit
|
19
19
|
end
|
20
20
|
|
21
|
+
opts.on('--history', "Print History") do
|
22
|
+
History.list
|
23
|
+
exit
|
24
|
+
end
|
25
|
+
|
21
26
|
opts.on('--version', "Print the version") do
|
22
27
|
puts "Captured #{File.open("#{File.dirname(__FILE__)}/../VERSION", "r").read}"
|
23
28
|
exit
|
@@ -50,6 +50,7 @@ class FileUploader
|
|
50
50
|
puts "Uploaded '#{file}' to '#{remote_path}'"
|
51
51
|
pbcopy remote_path
|
52
52
|
growl("Upload Succeeded", "#{File.dirname(File.expand_path(__FILE__))}/../../resources/green_check.png")
|
53
|
+
History.append(file, remote_path)
|
53
54
|
rescue => e
|
54
55
|
puts e
|
55
56
|
puts e.backtrace
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'shellwords'
|
2
|
+
|
3
|
+
class History
|
4
|
+
|
5
|
+
def self.file_path
|
6
|
+
"#{ENV['HOME']}/.captured_history"
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.time_stamp
|
10
|
+
DateTime.now.strftime("%m/%d/%Y-%I:%M%p")
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.append(original_name, remote_path)
|
14
|
+
File.open(History.file_path, 'a') do |f|
|
15
|
+
f.puts(History.format_line(original_name, remote_path))
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.format_line(original_name, remote_path)
|
20
|
+
"#{History.time_stamp} \"#{original_name}\" #{remote_path}"
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.list
|
24
|
+
if File.exists? History.file_path
|
25
|
+
File.open(History.file_path).each do |line|
|
26
|
+
puts line
|
27
|
+
end
|
28
|
+
else
|
29
|
+
puts "You ain't got no history yet"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/captured.rb
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "History" do
|
4
|
+
before(:each) do
|
5
|
+
@date_time = mock(DateTime)
|
6
|
+
@date_time.stub!(:strftime).and_return("01/11/2010 02:48PM")
|
7
|
+
DateTime.stub!(:now).and_return(@date_time)
|
8
|
+
History.stub!(:file_path).and_return("#{File.dirname(__FILE__)}/fixtures/history")
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should format a line" do
|
12
|
+
line = History.format_line("original_name", "remote_path")
|
13
|
+
line.should == "01/11/2010 02:48PM original_name remote_path"
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should list the history" do
|
17
|
+
History.should respond_to(:list)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
data/spec/spec_helper.rb
CHANGED
@@ -1,14 +1,16 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
2
|
require File.expand_path(File.dirname(__FILE__) + '/../../lib/captured/uploaders/imageshack_uploader')
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
"
|
8
|
-
|
4
|
+
if CONFIG['imageshack_spec']
|
5
|
+
describe "Imageshack File Uploader" do
|
6
|
+
it "should upload to the server" do
|
7
|
+
config = {"upload"=>{"url"=>"http://fuzzymonk.com/captured/",
|
8
|
+
"type"=>"imageshack",
|
9
|
+
"shackid"=>"capturedspec"}}
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
11
|
+
@uploader = ImageshackUploader.new(config)
|
12
|
+
@uploader.upload(File.expand_path(File.dirname(__FILE__) + '/../../resources/captured.png'))
|
13
|
+
system "open #{@uploader.url}"
|
14
|
+
end
|
13
15
|
end
|
14
16
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../lib/captured/uploaders/imgur_uploader')
|
3
|
+
|
4
|
+
if CONFIG['imgur_spec']
|
5
|
+
describe "Imgur File Uploader" do
|
6
|
+
it "should upload to the server" do
|
7
|
+
# This spec requires a scp_spec section in the config file with the
|
8
|
+
# scp settings
|
9
|
+
config = CONFIG['imgur_spec']
|
10
|
+
@uploader = ImgurUploader.new
|
11
|
+
@uploader.upload(File.expand_path(File.dirname(__FILE__) + '/../../resources/captured.png'))
|
12
|
+
system "open #{@uploader.url}"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -1,13 +1,15 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
2
|
require File.expand_path(File.dirname(__FILE__) + '/../../lib/captured/uploaders/scp_uploader')
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
4
|
+
if CONFIG['scp_spec']
|
5
|
+
describe "SCP File Uploader" do
|
6
|
+
it "should upload to the server" do
|
7
|
+
# This spec requires a scp_spec section in the config file with the
|
8
|
+
# scp settings
|
9
|
+
config = YAML.load_file("#{ENV['HOME']}/.captured.yml")['scp_spec']
|
10
|
+
@uploader = ScpUploader.new(config)
|
11
|
+
@uploader.upload(File.expand_path(File.dirname(__FILE__) + '/../../resources/captured.png'))
|
12
|
+
system "open #{@uploader.url}"
|
13
|
+
end
|
12
14
|
end
|
13
15
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: captured
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christopher Sexton
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2010-01-11 00:00:00 -05:00
|
13
13
|
default_executable: captured
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -51,6 +51,7 @@ files:
|
|
51
51
|
- lib/captured/file_tracker.rb
|
52
52
|
- lib/captured/file_uploader.rb
|
53
53
|
- lib/captured/fs_events.rb
|
54
|
+
- lib/captured/history.rb
|
54
55
|
- lib/captured/uploaders/eval_uploader.rb
|
55
56
|
- lib/captured/uploaders/imageshack_uploader.rb
|
56
57
|
- lib/captured/uploaders/imgur_uploader.rb
|
@@ -68,9 +69,12 @@ files:
|
|
68
69
|
- spec/bin/mockgrowlnotify
|
69
70
|
- spec/captured_spec.rb
|
70
71
|
- spec/file_uploader_spec.rb
|
72
|
+
- spec/fixtures/history
|
71
73
|
- spec/fixtures/scp_config.yml
|
74
|
+
- spec/history_spec.rb
|
72
75
|
- spec/spec_helper.rb
|
73
76
|
- spec/uploader_specs/imageshack_uploader_spec.rb
|
77
|
+
- spec/uploader_specs/imgur_uploader_spec.rb
|
74
78
|
- spec/uploader_specs/scp_uploader_spec.rb
|
75
79
|
- LICENSE
|
76
80
|
has_rdoc: true
|
@@ -104,6 +108,8 @@ summary: Quick screenshot sharing for OS X
|
|
104
108
|
test_files:
|
105
109
|
- spec/captured_spec.rb
|
106
110
|
- spec/file_uploader_spec.rb
|
111
|
+
- spec/history_spec.rb
|
107
112
|
- spec/spec_helper.rb
|
108
113
|
- spec/uploader_specs/imageshack_uploader_spec.rb
|
114
|
+
- spec/uploader_specs/imgur_uploader_spec.rb
|
109
115
|
- spec/uploader_specs/scp_uploader_spec.rb
|