view_server 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  # view_server
2
+
2
3
  ## Description
3
4
 
4
5
  Sometimes when working on a remote server you want to view data in a local app like Excel. The traditionnal way to acheive this is to save the data into a file then copy it using scp, then opening it with the app of your choice. If you have to do this many times a day it can really slow down your workflow.
@@ -12,7 +13,7 @@ view\_server also offers you a way to access your local clipboard from a remote
12
13
 
13
14
  ## Usage
14
15
 
15
- ### Show file
16
+ ### View file on local computer
16
17
 
17
18
  Start the server on your local machine. At the moment only OS X is supported.
18
19
 
@@ -26,6 +27,8 @@ Then install the gem on the remote server:
26
27
 
27
28
  gem install view_server
28
29
 
30
+ #### With Ruby
31
+
29
32
  Now that your setup is complete. You can view data from the remote server. Open a irb console on the remote server and try this:
30
33
 
31
34
  require 'view_server'
@@ -39,12 +42,24 @@ This will open Excel with a spreadsheet filled with the data defined in the here
39
42
 
40
43
  The last paramenter of the show method represents the file extension of the temporary file that will be created before being opened on your local computer. If you want to open it with your text editor just change this parameter with 'txt'
41
44
 
45
+ #### At the Shell
46
+
42
47
  There is also a command line utility to that you can use:
43
48
 
44
49
  echo -e "1,2\n2,3" | show -e csv
45
50
 
46
51
  ### Clipboard support
47
52
 
53
+ #### With Ruby
54
+
55
+ require 'view_server'
56
+ client = ViewServer::Client.new
57
+ clipboard = client.clipboard
58
+ clipboard.copy('coco')
59
+ clipboard_content = clipboard.paste
60
+
61
+ #### At the shell
62
+
48
63
  On the remote server you can copy to the local clipboard:
49
64
 
50
65
  ls | cbcopy
@@ -65,10 +80,6 @@ The first line tells ssh to create the tunnel for all ssh connection except for
65
80
 
66
81
  Now each time that you connect to a remote server with ssh the tunnel will be made, to need to add the -R option.
67
82
 
68
- ## TODO
69
-
70
- Adding tests
71
-
72
83
  ## Contributing
73
84
 
74
85
  1. Fork it
@@ -18,13 +18,14 @@ module ViewServer
18
18
 
19
19
  def self.run(args = [])
20
20
  opts = parse(args)
21
- server = if opts[:port] == -1
21
+ client = if opts[:port] == -1
22
22
  ViewServer::Server.new(nil)
23
23
  else
24
24
  ViewServer::Client.new(opts[:port])
25
25
  end
26
26
  content = $stdin.read
27
- server.to_cb(content)
27
+ clipboard = client.clipboard
28
+ clipboard.copy(content)
28
29
  end
29
30
  end
30
31
  end
@@ -18,12 +18,13 @@ module ViewServer
18
18
 
19
19
  def self.run(args = [])
20
20
  opts = parse(args)
21
- server = if opts[:port] == -1
21
+ client = if opts[:port] == -1
22
22
  ViewServer::Server.new(nil)
23
23
  else
24
24
  ViewServer::Client.new(opts[:port])
25
25
  end
26
- $stdout << server.paste
26
+ clipboard = client.clipboard
27
+ $stdout << clipboard.paste
27
28
  end
28
29
  end
29
30
  end
@@ -16,14 +16,6 @@ module ViewServer
16
16
  launcher.launch(data, file_ext)
17
17
  end
18
18
 
19
- def to_cb(data) # To clipboard
20
- clipboard.copy(data)
21
- end
22
-
23
- def paste # From clipboard
24
- clipboard.paste
25
- end
26
-
27
19
  def self.serve(launcher = Launcher.new, port)
28
20
  DRb.start_service "druby://localhost:#{port}", Server.new
29
21
  puts DRb.uri
@@ -1,3 +1,3 @@
1
1
  module ViewServer
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: view_server
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-29 00:00:00.000000000 Z
12
+ date: 2013-12-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: main
@@ -180,7 +180,6 @@ files:
180
180
  - lib/view_server/cbpaste_runner.rb
181
181
  - lib/view_server/client.rb
182
182
  - lib/view_server/launcher.rb
183
- - lib/view_server/runner.rb
184
183
  - lib/view_server/server.rb
185
184
  - lib/view_server/show_runner.rb
186
185
  - lib/view_server/tmp_file.rb
@@ -204,7 +203,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
204
203
  version: '0'
205
204
  segments:
206
205
  - 0
207
- hash: -1787566526224458814
206
+ hash: 3654653287489127086
208
207
  required_rubygems_version: !ruby/object:Gem::Requirement
209
208
  none: false
210
209
  requirements:
@@ -213,7 +212,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
213
212
  version: '0'
214
213
  segments:
215
214
  - 0
216
- hash: -1787566526224458814
215
+ hash: 3654653287489127086
217
216
  requirements: []
218
217
  rubyforge_project:
219
218
  rubygems_version: 1.8.23
@@ -1,27 +0,0 @@
1
- require 'main'
2
-
3
- module ViewServer
4
- class Runner
5
- def self.run
6
- main.run
7
- end
8
-
9
- def self.main
10
- main = Main.new do
11
- option 'port', 'p' do
12
- cast :int
13
- default 10021
14
- end
15
-
16
- option 'verbose', 'v' do
17
- default false
18
- end
19
-
20
- def run
21
- puts "serving on port #{params['port']}"
22
- Server.serve params['port'].value
23
- end
24
- end
25
- end
26
- end
27
- end