1
0
mirror of https://github.com/seejohnrun/haste-client.git synced 2025-12-16 00:35:56 +00:00

9 Commits

Author SHA1 Message Date
Konstantin Rybakov
5a4953dc93 feat: update light weight alternative 2022-01-12 15:29:01 +03:00
John Crepezzi
32c4523e1c Update travis to reflect rubies actually used in the real world 2017-07-19 17:30:45 -04:00
John Crepezzi
c307e8c904 Remove transpec dependency 2017-07-19 17:27:06 -04:00
John Crepezzi
1037d899b9 Bump version to 0.2.3
For #27
2017-07-19 17:23:07 -04:00
John Crepezzi
b5aa8fbacc Added some tests for #27 2017-07-19 17:22:04 -04:00
John Crepezzi
1f3318adeb Merge pull request #27 from vaibhav92/master
Fix issue #26
2017-07-19 17:13:43 -04:00
John Crepezzi
4c0e5f311d Merge pull request #34 from seejohnrun/move_readme_to_https
Move README to HTTPS
2017-03-24 11:24:40 -04:00
John Crepezzi
dab2d08f42 Move README to HTTPS
Also remove a trailing whitespace
2017-03-24 11:23:53 -04:00
vajain21
0ea5e5c61c Fix issue #26 2015-01-21 14:59:06 +05:30
6 changed files with 54 additions and 8 deletions

View File

@@ -4,6 +4,6 @@ branches:
- master
rvm:
- 1.8.7
- 1.9.2
- 1.9.3
- 2.0.0
- 2.4.0

View File

@@ -1,3 +1,2 @@
source 'https://rubygems.org'
gemspec
gem 'transpec'

View File

@@ -10,7 +10,7 @@ And once the output makes it to the server, it will print the URL to STDOUT.
This can be really really cool in combination with `pbcopy`, like:
* mac osx: `cat file | haste | pbcopy`
* mac osx: `cat file | haste | pbcopy`
* linux: `cat file | haste | xsel`
after which the contents of `file` will be accessible at a URL which has been copied to your pasteboard.
@@ -42,10 +42,10 @@ haste file --raw
## Changing the location of your haste server
By default, haste will point at `http://hastebin.com`. You can change this by setting the value of `ENV['HASTE_SERVER']` to the URL of your haste server. You can also use `alias` to make easy shortcuts if you commonly use a few hastes intermingled with each other. To do that, you'd put something like this into ~.bash_profile:
By default, haste will point at `https://hastebin.com`. You can change this by setting the value of `ENV['HASTE_SERVER']` to the URL of your haste server. You can also use `alias` to make easy shortcuts if you commonly use a few hastes intermingled with each other. To do that, you'd put something like this into ~.bash_profile:
``` bash
alias work_haste="HASTE_SERVER=http://something.com haste"
alias work_haste="HASTE_SERVER=https://something.com haste"
```
After which you can use `work_haste` to send hastes to that server instead.
@@ -70,7 +70,7 @@ If you'd like an alternative on Windows that supports functionality similar to `
Han Boetes and @nickthename have contributed a simple shell-script alternative for those not interested in installing a RubyGem:
``` bash
haste() { a=$(cat); curl -X POST -s -d "$a" http://hastebin.com/documents | awk -F '"' '{print "http://hastebin.com/"$4}'; }
haste() { curl -X POST -s -d "$(cat $1)" https://hastebin.com/documents | awk -F '"' '{print "https://hastebin.com/"$4}'; }
```
Usage:
@@ -78,6 +78,11 @@ Usage:
``` bash
cat file.txt | haste
```
or:
```bash
haste file.txt
```
And a more expansive BASH option by @diethnis can be found at:
https://github.com/diethnis/standalones/blob/master/hastebin.sh

View File

@@ -1,5 +1,6 @@
require 'json'
require 'faraday'
require 'uri'
module Haste
@@ -40,8 +41,13 @@ module Haste
private
def post_path
parsed_uri = URI.parse(server_url)
"#{parsed_uri.path}/documents"
end
def do_post(data)
connection.post('/documents', data)
connection.post(post_path, data)
end
def connection

View File

@@ -1,5 +1,5 @@
module Haste
VERSION = '0.2.2'
VERSION = '0.2.3'
end

View File

@@ -126,6 +126,42 @@ describe Haste::Uploader do
end
describe :post_path do
let(:post_path) { uploader.send(:post_path) }
context "when the server URL doesn't have a path" do
let(:base) { 'http://example.com/' }
it 'should return /documents' do
expect(post_path).to eq('/documents')
end
end
context "when the server URL has a path" do
let(:base) { 'http://example.com/friend' }
it 'should return /documents' do
expect(post_path).to eq('/friend/documents')
end
end
context "when the server URL has a path that ends with slash" do
let(:base) { 'http://example.com/friend/' }
it 'should return /documents appended to the path without a duplicate slash' do
expect(post_path).to eq('/friend/documents')
end
end
end
describe :server_url do
let(:server_url) { uploader.server_url }