captured 0.2.9 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.markdown CHANGED
@@ -50,7 +50,7 @@ To edit the configuraiton:
50
50
  $ open -e ~/.captured.yml
51
51
 
52
52
  Type: Imgur
53
- ----------------
53
+ -----------
54
54
  The simple image sharer. The default option.
55
55
 
56
56
  <pre>
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.9
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
@@ -1,3 +1,4 @@
1
+ require "#{File.dirname(__FILE__)}/captured/history"
1
2
  require "#{File.dirname(__FILE__)}/captured/file_tracker"
2
3
  require "#{File.dirname(__FILE__)}/captured/file_uploader"
3
4
 
@@ -0,0 +1,3 @@
1
+ 01/11/2010 02:47PM original_file remote_path
2
+ 01/11/2010 02:48PM original_file remote_path
3
+ 01/11/2010 02:49PM original_file remote_path
@@ -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
@@ -5,6 +5,8 @@ $LOAD_PATH.unshift(File.dirname(__FILE__))
5
5
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
6
  require 'captured'
7
7
 
8
+ CONFIG = YAML.load_file("#{ENV['HOME']}/.captured.yml")
9
+
8
10
  Spec::Runner.configure do |config|
9
11
 
10
12
  end
@@ -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
- describe "SCP File Uploader" do
5
- it "should upload to the server" do
6
- config = {"upload"=>{"url"=>"http://fuzzymonk.com/captured/",
7
- "type"=>"imageshack",
8
- "shackid"=>"capturedspec"}}
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
- @uploader = ImageshackUploader.new(config)
11
- @uploader.upload(File.expand_path(File.dirname(__FILE__) + '/../../resources/captured.png'))
12
- system "open #{@uploader.url}"
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
- describe "SCP File Uploader" do
5
- it "should upload to the server" do
6
- # This spec requires a scp_spec section in the config file with the
7
- # scp settings
8
- config = YAML.load_file("#{ENV['HOME']}/.captured.yml")['scp_spec']
9
- @uploader = ScpUploader.new(config)
10
- @uploader.upload(File.expand_path(File.dirname(__FILE__) + '/../../resources/captured.png'))
11
- system "open #{@uploader.url}"
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.2.9
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: 2009-12-07 00:00:00 -05:00
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