edit_server 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +31 -0
- data/Rakefile +1 -0
- data/bin/edit-server +12 -0
- data/edit_server.gemspec +24 -0
- data/lib/edit_server.rb +2 -0
- data/lib/edit_server/base.rb +25 -0
- data/lib/edit_server/version.rb +3 -0
- metadata +124 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 slnovak
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# EditServer
|
2
|
+
|
3
|
+
EditServer is a small Sinatra app that works in conjunction with [Edit with Emacs](https://chrome.google.com/webstore/detail/edit-with-emacs/ljobjlafonikaiipfkggjbhkghgicgoh?hl=en) to integrate GVim with your browser. Simply install the gem (`gem install edit_server`) and kick off the daemon (`edit-server start`). Use Edit with Emacs as documented. To kill the EditServer daemon, run `edit-server stop`.
|
4
|
+
|
5
|
+
Furthermore, HTML formatting in the text area (such as the text in a Gmail e-mail) is converted to Github Flavored Markdown for easy editing. The text is converted back to HTML when translated back to Chrome.
|
6
|
+
|
7
|
+
## Requirements
|
8
|
+
|
9
|
+
* [pandoc 1.10.1.1](http://johnmacfarlane.net/pandoc/) - At the time of writing, you need to make a custom build of pandoc since the lastest distributed version lacks support for a Github Flavored Markdown reader. Make sure the executable is available in your path.
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
Install edit_server:
|
14
|
+
|
15
|
+
$ gem install edit_server
|
16
|
+
|
17
|
+
Start the daemon:
|
18
|
+
|
19
|
+
$ edit-server start
|
20
|
+
|
21
|
+
To stop the Sinatra app:
|
22
|
+
|
23
|
+
$ edit-server stop
|
24
|
+
|
25
|
+
## Contributing
|
26
|
+
|
27
|
+
1. Fork it
|
28
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
29
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
30
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
31
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/edit-server
ADDED
data/edit_server.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'edit_server/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "edit_server"
|
8
|
+
gem.version = EditServer::VERSION
|
9
|
+
gem.authors = ["Stefan Novak"]
|
10
|
+
gem.email = ["stefan.louis.novak@gmail.com"]
|
11
|
+
gem.description = %q{This is a Sinatra app that integrates Google Chrome with GVim via the Edit with Emacs extension.}
|
12
|
+
gem.summary = %q{This is a Sinatra app that responds to POST requests sent via Chrome from the Edit with Emacs extension to kick off GVim. An instance of GVim is loaded up with content from the source textarea. When saving and exiting GVim, the text will loaded back into the original textarea.}
|
13
|
+
gem.homepage = "https://github.com/slnovak/edit_server"
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
|
20
|
+
gem.add_dependency "foreverb", "~> 0.3.2"
|
21
|
+
gem.add_dependency "pandoc-ruby", "~> 0.6.0"
|
22
|
+
gem.add_dependency "sinatra", "~> 1.3.4"
|
23
|
+
gem.add_dependency "thin", "~> 1.5.0"
|
24
|
+
end
|
data/lib/edit_server.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'sinatra/base'
|
2
|
+
require 'tempfile'
|
3
|
+
require 'pandoc-ruby'
|
4
|
+
|
5
|
+
module EditServer
|
6
|
+
class Base < Sinatra::Base
|
7
|
+
post("/edit") do
|
8
|
+
file = Tempfile.new "chrome"
|
9
|
+
|
10
|
+
body = request.body.read
|
11
|
+
body_markdown = PandocRuby.convert(body, :from => :html, :to => :markdown_github)
|
12
|
+
file.write body_markdown
|
13
|
+
file.close
|
14
|
+
|
15
|
+
`gvim -f #{file.path}`
|
16
|
+
|
17
|
+
file.open
|
18
|
+
contents = file.read
|
19
|
+
contents_html = PandocRuby.convert(contents, :from => :markdown_github, :to => :html)
|
20
|
+
file.close
|
21
|
+
|
22
|
+
contents_html
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,124 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: edit_server
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Stefan Novak
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-02-13 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: foreverb
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.3.2
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.3.2
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: pandoc-ruby
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 0.6.0
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.6.0
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: sinatra
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 1.3.4
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.3.4
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: thin
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 1.5.0
|
70
|
+
type: :runtime
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 1.5.0
|
78
|
+
description: This is a Sinatra app that integrates Google Chrome with GVim via the
|
79
|
+
Edit with Emacs extension.
|
80
|
+
email:
|
81
|
+
- stefan.louis.novak@gmail.com
|
82
|
+
executables:
|
83
|
+
- edit-server
|
84
|
+
extensions: []
|
85
|
+
extra_rdoc_files: []
|
86
|
+
files:
|
87
|
+
- .gitignore
|
88
|
+
- Gemfile
|
89
|
+
- LICENSE.txt
|
90
|
+
- README.md
|
91
|
+
- Rakefile
|
92
|
+
- bin/edit-server
|
93
|
+
- edit_server.gemspec
|
94
|
+
- lib/edit_server.rb
|
95
|
+
- lib/edit_server/base.rb
|
96
|
+
- lib/edit_server/version.rb
|
97
|
+
homepage: https://github.com/slnovak/edit_server
|
98
|
+
licenses: []
|
99
|
+
post_install_message:
|
100
|
+
rdoc_options: []
|
101
|
+
require_paths:
|
102
|
+
- lib
|
103
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
104
|
+
none: false
|
105
|
+
requirements:
|
106
|
+
- - ! '>='
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
109
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
|
+
none: false
|
111
|
+
requirements:
|
112
|
+
- - ! '>='
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '0'
|
115
|
+
requirements: []
|
116
|
+
rubyforge_project:
|
117
|
+
rubygems_version: 1.8.24
|
118
|
+
signing_key:
|
119
|
+
specification_version: 3
|
120
|
+
summary: This is a Sinatra app that responds to POST requests sent via Chrome from
|
121
|
+
the Edit with Emacs extension to kick off GVim. An instance of GVim is loaded up
|
122
|
+
with content from the source textarea. When saving and exiting GVim, the text will
|
123
|
+
loaded back into the original textarea.
|
124
|
+
test_files: []
|