captured 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
data/bin/captured CHANGED
@@ -3,6 +3,8 @@ require 'rubygems'
3
3
  require 'optparse'
4
4
  require "#{File.dirname(__FILE__)}/../lib/captured"
5
5
 
6
+ puts "YOOOOOO"
7
+
6
8
  options = {:config_file => "#{ENV['HOME']}/.captured.yml",
7
9
  :watch_path => "#{ENV['HOME']}/Desktop/",
8
10
  :watch_pattern => Captured.guess_watch_path,
@@ -23,6 +23,9 @@ class FileUploader
23
23
  else
24
24
  raise "Invalid Type"
25
25
  end
26
+ rescue
27
+ growl "Unable to load config file"
28
+ raise "Unable to load config file"
26
29
  end
27
30
 
28
31
  def pbcopy(str)
@@ -1,7 +1,6 @@
1
1
  require 'net/http'
2
2
  require 'uri'
3
3
  require 'cgi'
4
- require 'mime/types'
5
4
 
6
5
  # Adapted from http://codesnippets.joyent.com/posts/show/1156
7
6
  class ImageshackUploader
@@ -114,11 +113,24 @@ class FileParam
114
113
  @k = k
115
114
  @filename = filename
116
115
  @content = content
116
+ @extension_index = {
117
+ 'jpg' => "image/jpeg",
118
+ 'jpeg' => "image/jpeg",
119
+ 'png' => "image/png",
120
+ 'bmp' => "image/bmpimage/x-bmp",
121
+ 'tiff' => "image/tiff",
122
+ 'tif' => "image/tiff"}
117
123
  end
118
124
 
125
+ def type_for(filename)
126
+ ext = filename.chomp.downcase.gsub(/.*\./o, '')
127
+ @extension_index[ext]
128
+ end
129
+
130
+
119
131
  def to_multipart
120
132
  return "Content-Disposition: form-data; name=\"#{CGI::escape(k)}\"; filename=\"#{filename}\"\r\n" +
121
- "Content-Type: #{MIME::Types.type_for(@filename)}\r\n\r\n" + content + "\r\n"
133
+ "Content-Type: #{type_for(@filename)}\r\n\r\n" + content + "\r\n"
122
134
  end
123
135
  end
124
136
 
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.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christopher Sexton
@@ -22,16 +22,6 @@ dependencies:
22
22
  - !ruby/object:Gem::Version
23
23
  version: "0"
24
24
  version:
25
- - !ruby/object:Gem::Dependency
26
- name: mime-types
27
- type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: "0"
34
- version:
35
25
  description: Because <shift>-<command>-4 is the single most useful shorcut in Macdom
36
26
  email: csexton@gmail.com
37
27
  executables: