vrome 1.0.2 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.txt +27 -29
  2. data/bin/vrome +12 -28
  3. data/lib/vrome/version.rb +1 -1
  4. metadata +4 -4
data/README.txt CHANGED
@@ -1,42 +1,40 @@
1
1
  = Vrome
2
2
 
3
- == Install
3
+ Vrome is a external server for Vrome: a Vim keybindings extension for chrome.(https://chrome.google.com/webstore/detail/godjoomfiimiddapohpmfklhgmbfffjj/details)
4
4
 
5
- 0, Install ruby
5
+ The server is writen with ruby. so ruby is required. (Install Ruby: http://www.ruby-lang.org/en/downloads/)
6
6
 
7
- 1, Install Vrome as RubyGem
8
- $ sudo gem install vrome
7
+ === Install vrome as RubyGem
8
+ $ (sudo) gem install vrome
9
9
 
10
- 2, Start the server
11
- $ sudo vrome
10
+ === Install vrome from Script
11
+ $ wget https://raw.github.com/jinzhu/vrome/master/system/ruby/bin/vrome
12
+ $ chmod +x vrome
13
+ $ sudo mv vrome /usr/bin/vrome
12
14
 
13
- 3, Auto start after login
15
+ === Run It
16
+ $ vrome
14
17
 
15
- // Linux
16
- $ echo "nohup sudo vrome > /dev/null &" >> ~/.xprofile
17
- $ nohup sudo vrome > /dev/null &
18
+ === Running on a different port?
18
19
 
19
- == LICENSE:
20
+ By default, the service running on port 20000, If you want to run it on a different port.
21
+ You need to update your Vrome(chrome extension)'s option first. (How TO: https://github.com/jinzhu/vrome/wiki/customize-your-vrome)
20
22
 
21
- (The MIT License)
23
+ For example: If you want to run on port 30000. then you could add `set server_port=30000` to your config.
22
24
 
23
- Copyright (c) 2010 ~ Jinzhu
25
+ Then you can run the service on port 30000 with following command:
26
+ $ vrome 30000
27
+
28
+ === Auto start
29
+ // Linux
30
+ Add `nohup vrome > /dev/null &` to your ~/.xprofile or other xinit files.
31
+ // Mac
24
32
 
25
- Permission is hereby granted, free of charge, to any person obtaining
26
- a copy of this software and associated documentation files (the
27
- 'Software'), to deal in the Software without restriction, including
28
- without limitation the rights to use, copy, modify, merge, publish,
29
- distribute, sublicense, and/or sell copies of the Software, and to
30
- permit persons to whom the Software is furnished to do so, subject to
31
- the following conditions:
33
+ // Windows
34
+
35
+
36
+ == LICENSE:
37
+ Same As Vrome <Chrome Extension>
32
38
 
33
- The above copyright notice and this permission notice shall be
34
- included in all copies or substantial portions of the Software.
35
39
 
36
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
37
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
38
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
39
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
40
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
41
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
42
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
40
+ Copyright (c) 2010~Now Jinzhu (wosmvp@gmail.com)
data/bin/vrome CHANGED
@@ -5,6 +5,12 @@ require 'webrick'
5
5
  require 'tempfile'
6
6
  require 'json'
7
7
 
8
+ port = 20000
9
+
10
+ if ARGV[0] =~ /^\d+$/
11
+ port = ARGV[0].to_i
12
+ end
13
+
8
14
  class VromeServer < WEBrick::HTTPServlet::AbstractServlet
9
15
 
10
16
  def do_POST(request, response)
@@ -17,47 +23,25 @@ class VromeServer < WEBrick::HTTPServlet::AbstractServlet
17
23
  end
18
24
 
19
25
  def open_editor(request)
20
- editor = request['editor']
26
+ editor = request['editor']
27
+
21
28
  tmpfile = Tempfile.new('editor')
22
29
  tmpfile.write request['data']
23
30
  tmpfile.flush
31
+
24
32
  editor = 'gvim -f' if editor == 'gvim' # Foreground: Don't fork when starting GUI
25
33
  system("#{editor} #{tmpfile.path}")
26
34
  text = File.read(tmpfile.path)
35
+
27
36
  tmpfile.delete
28
37
 
29
38
  return 200, "text/plain", text
30
39
  end
31
-
32
- def get_configure(request)
33
- config_file = File.join(ENV['HOME'],'.vromerc')
34
- vromeConfig = {:set => {},:imap => {},:map => {},:cmap => {}};
35
-
36
- if File.exist?(config_file)
37
- File.read(config_file).split("\n").map do |line|
38
- array = line.split(/\s+/)
39
- case line
40
- when /^imap\s+/
41
- vromeConfig[:imap][array[1]] = array[2];
42
- when /^map\s+/
43
- vromeConfig[:map][array[1]] = array[2];
44
- when /^cmap\s+/
45
- vromeConfig[:cmap][array[1]] = array[2];
46
- when /^set\s+/
47
- array = line.split(/\s+/,2)
48
- array = array[1].split(/\+?=/,2)
49
- vromeConfig[:set][array[0]] = [array[1], line =~ /^set\s+\w+\+=/ ? true : false]
50
- end
51
- end
52
-
53
- return 200, "text/plain", vromeConfig.to_json
54
- end
55
- end
56
40
  end
57
41
 
58
42
  puts "Starting Vrome server..."
59
- server = WEBrick::HTTPServer.new
60
- server.listen('127.0.0.1', 20000)
43
+
44
+ server = WEBrick::HTTPServer.new(:BindAddress => '127.0.0.1', :Port => port)
61
45
  server.mount "/", VromeServer
62
46
  trap(:INT) { server.shutdown }
63
47
  server.start
@@ -1,3 +1,3 @@
1
1
  module Vrome
2
- VERSION = "1.0.2"
2
+ VERSION = "1.1.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vrome
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-27 00:00:00.000000000 Z
12
+ date: 2011-12-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
16
- requirement: &12152060 !ruby/object:Gem::Requirement
16
+ requirement: &10767300 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *12152060
24
+ version_requirements: *10767300
25
25
  description: Vrome is a external server for vrome, a Vim keybindings extension for
26
26
  chrome
27
27
  email: