rcp 1.1.5 → 1.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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/rcp +12 -7
  3. data/lib/rcp.rb +3 -3
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bb978c595535f9c826c6cc3d0c7ebc6a55527dc5
4
- data.tar.gz: 0cd5308e6150a6a5b7ac091cf85f98feed1fd9c6
3
+ metadata.gz: aeb5b54d9b9a456b722bcd47ba1fe6131f030fa2
4
+ data.tar.gz: afa2a1db16962126d2b7578d415e585d2a863857
5
5
  SHA512:
6
- metadata.gz: 8b3352adbc91abbcb9f04edeaaead13f225e0c738f73681ca1b7a49fd71459dd521dd96807df3f6fb8982f56baa69b64b7c137062524460786f4d83180d21b39
7
- data.tar.gz: 1500e7cfdbd3906a6145f05b38533a1915f49d98e47e01d164b5c3ac9327377f117503079f5ed58f4df120d99002053328223ce662d35c0a72c634295a2f7824
6
+ metadata.gz: 50a6de671a0de192b8a2438e9611466985028d023a92d951180ce3f5ef42bea32dafa7a094c11135bd5a96acd8a7a6e7aa7df207847dcd459161520434f2ffea
7
+ data.tar.gz: a4c5cf6062ff05494acf04d265b387b01d2e95e00b253228d98fedca08a8459b30372230a38f5e755ed5158bb5293ddc3b55204b7cab1a340233434991d35403
data/bin/rcp CHANGED
@@ -1,12 +1,17 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'rcp'
3
+ require './lib/rcp'
4
+ require 'debugger'
5
+ require 'optparse'
4
6
 
5
7
  rcp = RemoteCopy.new
6
- content = ARGV.join(' ')
7
8
 
8
- if(content.empty?)
9
- rcp.pull
10
- else
11
- rcp.push(content)
12
- end
9
+ OptionParser.new do |opts|
10
+ opts.on('-p', '--post CONTENT', String) do |content|
11
+ rcp.push(content)
12
+ end
13
+
14
+ opts.on('-g', '--get') do
15
+ rcp.pull
16
+ end
17
+ end.parse!
data/lib/rcp.rb CHANGED
@@ -25,9 +25,9 @@ class RemoteCopy
25
25
 
26
26
  @content = response_json["item"]["content"]
27
27
 
28
- prompt_question
28
+ prompt_question if urls.any?
29
29
 
30
- open_urls if should_i_open?
30
+ open_urls if urls.any? && should_i_open?
31
31
 
32
32
  copy_to_clipboard
33
33
 
@@ -57,7 +57,7 @@ class RemoteCopy
57
57
  end
58
58
 
59
59
  def urls
60
- @content.split(" ").select do |w|
60
+ @urls ||= @content.split(" ").select do |w|
61
61
  w =~ /^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/
62
62
  end
63
63
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rcp
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.5
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luis Vasconcellos
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-25 00:00:00.000000000 Z
11
+ date: 2013-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: clipboard