1
0
mirror of https://github.com/seejohnrun/haste-client.git synced 2025-12-17 17:21:29 +00:00

14 Commits

Author SHA1 Message Date
John Crepezzi
ea7750c3bb Remove unused pieces of Rakefile 2013-11-08 14:04:24 -05:00
John Crepezzi
d380711d26 Bump version to 0.1.7 2013-11-08 14:03:46 -05:00
John Crepezzi
a195f017e2 Merge pull request #15 from TsCl/master
Fixed the JSON::ParserError rescue message
2013-11-08 11:03:04 -08:00
John Crepezzi
4e3e90f7cc Merge pull request #14 from tommcdo/master
Do not trim leading whitespace
2013-11-08 11:01:18 -08:00
Pierre MONTAGNIER
a7df62a0a5 Fixed the JSON::ParserError rescue message
I guess this message may be more appropriate for this error.
2013-09-22 00:26:29 +02:00
Tom McDonald
ce764ca7c4 Do not trim leading whitespace
For pastes of code snippets, removing leading whitespace usually
results in mis-aligned code.
2013-07-12 12:05:49 -04:00
John Crepezzi
e6532aa100 Bump to 0.1.6 2013-06-03 12:37:39 -04:00
John Crepezzi
82d191fc5e Merge pull request #13 from zertrin/master
Make HTTPS support to actually work (require 'net/https')
2013-06-03 09:36:29 -07:00
zertrin
2ef8f926af Make HTTPS support to actually work (require 'net/https') 2013-06-02 02:03:55 +02:00
John Crepezzi
6430635bfa Bump version to 0.1.5 2013-04-08 11:59:50 -04:00
John Crepezzi
028e7c4424 Merge pull request #12 from sairez/master
add ability to use SSL to contact haste-server
2013-04-08 08:58:18 -07:00
Sarah Zelechoski
b10fa4782a simplify ssl support 2013-04-02 20:26:31 -03:00
Sarah Zelechoski
d8c4be9744 Update haste.rb
add HTTPS capability
2013-04-02 20:15:41 -03:00
John Crepezzi
7913dd521d Added install note to README
Closes #7
2013-03-16 20:41:32 -04:00
4 changed files with 16 additions and 17 deletions

View File

@@ -13,6 +13,12 @@ This can be really really cool in combination with `pbcopy`, like:
after which the contents of `file` will be accessible at a URL which has been copied to your pasteboard.
## Installation
``` bash
gem install haste
```
## Support
Please consider paying what you think haste-client is worth:

View File

@@ -1,7 +1,6 @@
require 'rspec/core/rake_task'
require File.dirname(__FILE__) + '/lib/haste/version'
task :build => :test do
task :build do
system "gem build haste.gemspec"
end
@@ -12,14 +11,3 @@ task :release => :build do
# push the gem
system "gem push haste-#{Haste::VERSION}.gem"
end
RSpec::Core::RakeTask.new(:test) do |t|
t.pattern = 'spec/**/*_spec.rb'
fail_on_error = true # be explicit
end
RSpec::Core::RakeTask.new(:rcov) do |t|
t.pattern = 'spec/**/*_spec.rb'
t.rcov = true
fail_on_error = true # be explicit
end

View File

@@ -1,5 +1,6 @@
require 'json'
require 'net/http'
require 'net/https'
require 'uri'
module Haste
@@ -19,13 +20,17 @@ module Haste
@input = STDIN.readlines.join
end
# clean up
@input.strip!
@input.rstrip!
end
# Upload the and output the URL we get back
def start
uri = URI.parse server
http = Net::HTTP.new uri.host, uri.port
if uri.scheme =~ /^https/
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
end
response = http.post '/documents', @input
if response.is_a?(Net::HTTPOK)
data = JSON.parse(response.body)
@@ -35,7 +40,7 @@ module Haste
abort "failure uploading: #{response.code}"
end
rescue JSON::ParserError => e
abort "failure uploading: #{response.code}"
abort "failure parsing response: #{e.message}"
rescue Errno::ECONNREFUSED => e
abort "failure connecting: #{e.message}"
end

View File

@@ -1,5 +1,5 @@
module Haste
VERSION = '0.1.4'
VERSION = '0.1.7'
end