interactive_editor 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE CHANGED
@@ -0,0 +1,23 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2010-2011 Jan Berkel
4
+ Portions Copyright (c) 2006-2007 Giles Bowkett et al.
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining
7
+ a copy of this software and associated documentation files (the
8
+ 'Software'), to deal in the Software without restriction, including
9
+ without limitation the rights to use, copy, modify, merge, publish,
10
+ distribute, sublicense, and/or sell copies of the Software, and to
11
+ permit persons to whom the Software is furnished to do so, subject to
12
+ the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be
15
+ included in all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
18
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,7 +1,11 @@
1
-
2
1
  # Interactive editor
3
2
 
4
- cf. my (slightly outdated) blog post: [Integrating vim and irb](http://zegoggl.es/2009/04/integrating-vim-and-irb.html) and [vimcasts #20: Running Vim within IRB](http://vimcasts.org/e/20).
3
+ Drew Neil has made it the subject of one of his vimcasts:
4
+ [vimcasts #20: running Vim within IRB][], and Chad Perrin has written an
5
+ article about it on TechRepublic:
6
+ [Use interactive_editor with irb for an inside-out Ruby IDE][].
7
+ There's also an outdated blog post which predates the gem from 2009:
8
+ [Integrating vim and IRB][].
5
9
 
6
10
  ## Usage
7
11
 
@@ -31,11 +35,13 @@ To try it out without installing the gem:
31
35
  $ cd interactive_editor
32
36
  $ rake console
33
37
 
34
- interactive_editor also works with the IRB alternative [ripl][].
38
+ interactive_editor also works with the IRB alternatives [ripl][] and [pry][].
35
39
 
36
40
  ## Credits
37
41
 
38
- Giles Bowkett, Greg Brown, and several audience members from Giles' Ruby East presentation: [Use vi or any text editor from within IRB](http://gilesbowkett.blogspot.com/2007/10/use-vi-or-any-text-editor-from-within.html).
42
+ Giles Bowkett, Greg Brown, and several audience members from Giles' Ruby East
43
+ presentation: [Use vi or any text editor from within
44
+ IRB](http://gilesbowkett.blogspot.com/2007/10/use-vi-or-any-text-editor-from-within.html).
39
45
 
40
46
  With contributions from:
41
47
 
@@ -43,5 +49,9 @@ With contributions from:
43
49
  * [Jan Lelis](https://github.com/janlelis)
44
50
  * [TJ Singleton](https://github.com/tjsingleton)
45
51
 
52
+ [Integrating vim and irb]: http://zegoggl.es/2009/04/integrating-vim-and-irb.html
53
+ [vimcasts #20: Running Vim within IRB]: http://vimcasts.org/e/20
54
+ [Use interactive_editor with irb for an inside-out Ruby IDE]: http://www.techrepublic.com/blog/programming-and-development/use-interactiveeditor-with-irb-for-an-inside-out-ruby-ide/4125
46
55
  [ripl]: https://github.com/cldwalker/ripl
56
+ [pry]: https://github.com/pry/pry
47
57
  [object aorta]: http://rubyforge.org/snippet/detail.php?type=snippet&id=22
data/Rakefile CHANGED
@@ -116,3 +116,48 @@ task :validate do
116
116
  exit!
117
117
  end
118
118
  end
119
+
120
+ namespace :doc do
121
+ desc "Render markdown as if it were shown on github, expects FILE=path/to/doc.md"
122
+ task :preview do
123
+ infile = File.expand_path(ENV['FILE'].to_s)
124
+ outfile = "/tmp/#{File.basename(infile)}.html"
125
+ revision = `git rev-parse HEAD`.strip
126
+ markdown = `which markdown`.strip
127
+
128
+ unless $?.success?
129
+ puts "Make sure you have 'markdown' in your path, usage: brew install markdown"
130
+ exit 1
131
+ end
132
+
133
+ unless File.exists?(infile)
134
+ puts "Cannot find FILE=#{ENV['FILE'].inspect}, usage: rake soundcloud:doc:preview FILE=doc/hello.md"
135
+ exit 2
136
+ end
137
+
138
+ File.open(outfile, "w") do |out|
139
+ body = `#{markdown} #{infile}`
140
+ template = <<-END
141
+ <html>
142
+ <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
143
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
144
+ <head>
145
+ <link href="https://assets0.github.com/stylesheets/bundle_common.css?#{revision}" media="screen" rel="stylesheet" type="text/css" />
146
+ <link href="https://assets3.github.com/stylesheets/bundle_github.css?#{revision}" media="screen" rel="stylesheet" type="text/css" />
147
+ </head>
148
+ <body>
149
+ <div id="readme" class="blob">
150
+ <div class="wikistyle">
151
+ #{body}
152
+ </div>
153
+ </div>
154
+ </body>
155
+ </html>
156
+ END
157
+ out.write(template)
158
+ end
159
+
160
+ puts "Launching: open #{outfile}"
161
+ system("open #{outfile}")
162
+ end
163
+ end
@@ -7,8 +7,8 @@ Gem::Specification.new do |s|
7
7
  ## If your rubyforge_project name is different, then edit it and comment out
8
8
  ## the sub! line in the Rakefile
9
9
  s.name = 'interactive_editor'
10
- s.version = '0.0.8'
11
- s.date = '2011-03-28'
10
+ s.version = '0.0.9'
11
+ s.date = '2011-09-06'
12
12
  s.rubyforge_project = 'interactive_editor'
13
13
 
14
14
  ## Make sure your summary is short. The description may be as long
@@ -43,6 +43,8 @@ Gem::Specification.new do |s|
43
43
  ]
44
44
  # = MANIFEST =
45
45
 
46
+ s.license = 'MIT'
47
+
46
48
  ## Test files will be grabbed from the file list. Make sure the path glob
47
49
  ## matches what you actually use.
48
50
  s.test_files = s.files.select { |path| path =~ /^test\/test_.*\.rb/ }
@@ -9,7 +9,7 @@ require 'shellwords'
9
9
  require 'yaml'
10
10
 
11
11
  class InteractiveEditor
12
- VERSION = '0.0.8'
12
+ VERSION = '0.0.9'
13
13
 
14
14
  attr_accessor :editor
15
15
 
@@ -56,8 +56,15 @@ class InteractiveEditor
56
56
 
57
57
  def self.edit(editor, self_, file=nil)
58
58
  #maybe serialise last file to disk, for recovery
59
- (IRB.conf[:interactive_editors] ||=
60
- Hash.new { |h,k| h[k] = InteractiveEditor.new(k) })[editor].edit(self_, file)
59
+ (editors_storage ||= Hash.new { |h,k| h[k] = InteractiveEditor.new(k) })[editor].edit(self_, file)
60
+ end
61
+
62
+ def self.editors_storage
63
+ if defined?(Pry) and IRB == Pry
64
+ IRB.config.interactive_editors
65
+ else
66
+ IRB.conf[:interactive_editors]
67
+ end
61
68
  end
62
69
 
63
70
  module Exec
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: interactive_editor
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
5
4
  prerelease: false
6
5
  segments:
7
6
  - 0
8
7
  - 0
9
- - 8
10
- version: 0.0.8
8
+ - 9
9
+ version: 0.0.9
11
10
  platform: ruby
12
11
  authors:
13
12
  - Jan Berkel
@@ -15,7 +14,7 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2011-03-28 00:00:00 +02:00
17
+ date: 2011-09-06 00:00:00 +02:00
19
18
  default_executable:
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
@@ -26,7 +25,6 @@ dependencies:
26
25
  requirements:
27
26
  - - ">="
28
27
  - !ruby/object:Gem::Version
29
- hash: 29
30
28
  segments:
31
29
  - 0
32
30
  - 0
@@ -51,8 +49,8 @@ files:
51
49
  - lib/interactive_editor.rb
52
50
  has_rdoc: true
53
51
  homepage: http://github.com/jberkel/interactive_editor
54
- licenses: []
55
-
52
+ licenses:
53
+ - MIT
56
54
  post_install_message:
57
55
  rdoc_options:
58
56
  - --charset=UTF-8
@@ -63,7 +61,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
63
61
  requirements:
64
62
  - - ">="
65
63
  - !ruby/object:Gem::Version
66
- hash: 3
67
64
  segments:
68
65
  - 0
69
66
  version: "0"
@@ -72,7 +69,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
72
69
  requirements:
73
70
  - - ">="
74
71
  - !ruby/object:Gem::Version
75
- hash: 3
76
72
  segments:
77
73
  - 0
78
74
  version: "0"