gemedit 0.9.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +9 -0
- data/License.txt +2 -2
- data/README.txt +18 -13
- data/Rakefile +15 -0
- data/lib/gemedit.rb +1 -2
- data/lib/gemedit/edit_command.rb +12 -24
- data/lib/gemedit/version.rb +5 -3
- metadata +81 -31
- data/bin/gemedit +0 -8
data/History.txt
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
== 1.0.0 2011-01-11
|
2
|
+
|
3
|
+
* 1 major enhancement:
|
4
|
+
* cd to directory before starting editor. Good for using NERDtree in vim for example. via alkesh
|
5
|
+
* Other changes:
|
6
|
+
* removed gemedit executable since it runs as a rubygems command
|
7
|
+
* tested with cucumber
|
8
|
+
* reduced development depencies
|
9
|
+
|
1
10
|
== 0.9.0 2009-11-15
|
2
11
|
|
3
12
|
* 1 major change:
|
data/License.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c) 2008 Lee Marlow
|
1
|
+
Copyright (c) 2008-2011 Lee Marlow
|
2
2
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
a copy of this software and associated documentation files (the
|
@@ -17,4 +17,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
17
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
18
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
19
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.txt
CHANGED
@@ -1,37 +1,42 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
gemedit
|
2
|
+
https://github.com/lmarlow/gemedit
|
3
|
+
by Lee Marlow
|
4
4
|
|
5
5
|
== DESCRIPTION:
|
6
6
|
|
7
7
|
Gemedit lets you quickly open up the source for a gem in your favorite editor.
|
8
8
|
|
9
|
-
Looking through other people's code is a great way to learn. I often use it
|
9
|
+
Looking through other people's code is a great way to learn. I often use it
|
10
|
+
when a gem's RDoc isn't as helpful as I'd like or just want to see how someone
|
11
|
+
put a library together. Gemedit just makes it easier to get to the code.
|
10
12
|
|
11
13
|
== INSTALLATION:
|
12
14
|
|
13
|
-
Gemedit
|
15
|
+
Gemedit is installed via RubyGems and is available as a gem command:
|
14
16
|
|
15
|
-
$
|
17
|
+
$ gem install gemedit
|
16
18
|
|
17
19
|
== USAGE:
|
18
20
|
|
19
21
|
If you want to see how gemedit works just install it and run this:
|
20
22
|
$ gem edit gemedit
|
21
23
|
|
22
|
-
Gemedit tries to use your favorite editor from your <tt>$GEMEDITOR</tt>,
|
24
|
+
Gemedit tries to use your favorite editor from your <tt>$GEMEDITOR</tt>,
|
25
|
+
<tt>$VISUAL</tt> or <tt>$EDITOR</tt> environment variable. It will fall back
|
26
|
+
to <em>everyone's</em> favorite editor: *vi*. You can specify the editor with
|
27
|
+
the <tt>-e/--editor</tt> switch. Run this to view the source for +rake+ in
|
28
|
+
TextMate[http://macromates.com]:
|
29
|
+
|
23
30
|
$ gem edit -e mate rake
|
24
31
|
|
25
32
|
And of course, help is available:
|
26
33
|
$ gem edit -h
|
27
34
|
$ gem edit --help
|
28
35
|
|
29
|
-
== DOCUMENTATION:
|
30
|
-
|
31
|
-
There isn't much more to document than what is on this page, but feel free to browse the RDoc[http://gemedit.rubyforge.org/rdoc/]. Or checkout the Rubyforge project page here[http://rubyforge.org/projects/gemedit/].
|
32
|
-
|
33
36
|
== SOURCE REPOSITORY:
|
34
37
|
|
35
|
-
The source is currently on github[
|
38
|
+
The source is currently on github[https://github.com/] at
|
39
|
+
https://github.com/lmarlow/gemedit. Feel free to fork it and submit pull
|
40
|
+
requests.
|
36
41
|
|
37
|
-
$ git clone
|
42
|
+
$ git clone https://github.com/lmarlow/gemedit.git
|
data/Rakefile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
Bundler::GemHelper.install_tasks
|
3
|
+
|
4
|
+
require 'rake/testtask'
|
5
|
+
Rake::TestTask.new do |t|
|
6
|
+
t.libs << 'lib'
|
7
|
+
t.pattern = 'test/**/*_test.rb'
|
8
|
+
t.verbose = false
|
9
|
+
end
|
10
|
+
|
11
|
+
require 'cucumber/rake/task'
|
12
|
+
Cucumber::Rake::Task.new
|
13
|
+
task :cucumber => :install
|
14
|
+
|
15
|
+
task :default => [:test, :cucumber]
|
data/lib/gemedit.rb
CHANGED
data/lib/gemedit/edit_command.rb
CHANGED
@@ -2,12 +2,13 @@ require 'rubygems/command'
|
|
2
2
|
require 'rubygems/version_option'
|
3
3
|
|
4
4
|
class Gem::Commands::EditCommand < Gem::Command
|
5
|
+
EDITOR_ENV_VARS = %w( GEMEDITOR BUNDLER_EDITOR VISUAL EDITOR )
|
5
6
|
|
6
7
|
OPTIONS = {
|
7
8
|
:version => Gem::Requirement.default,
|
8
9
|
:verbose => false,
|
9
10
|
:dryrun => false,
|
10
|
-
:editor =>
|
11
|
+
:editor => EDITOR_ENV_VARS.map { |var| ENV[var] }.compact.first || 'vi'
|
11
12
|
}
|
12
13
|
|
13
14
|
include Gem::VersionOption
|
@@ -19,8 +20,8 @@ class Gem::Commands::EditCommand < Gem::Command
|
|
19
20
|
|
20
21
|
add_option('-e', '--editor EDITOR', String,
|
21
22
|
'The editor to use to open the gems',
|
22
|
-
'GEMEDITOR, VISUAL and EDITOR
|
23
|
-
'are used to find the default',
|
23
|
+
'GEMEDITOR, BUNDLER_EDITOR, VISUAL and EDITOR',
|
24
|
+
'environment variables are used to find the default',
|
24
25
|
"Default: #{OPTIONS[:editor]}") do |editor, options|
|
25
26
|
options[:editor] = editor
|
26
27
|
end
|
@@ -28,7 +29,7 @@ class Gem::Commands::EditCommand < Gem::Command
|
|
28
29
|
add_option('-d', '--[no-]dry-run',
|
29
30
|
'Shows what command would be run without running it',
|
30
31
|
'Turns on verbose logging', "Default: #{OPTIONS[:dryrun]}") do |dryrun, options|
|
31
|
-
Gem.configuration.verbose
|
32
|
+
Gem.configuration.verbose = true if dryrun
|
32
33
|
options[:dryrun] = dryrun
|
33
34
|
end
|
34
35
|
end
|
@@ -48,27 +49,14 @@ class Gem::Commands::EditCommand < Gem::Command
|
|
48
49
|
def execute
|
49
50
|
version = options[:version] || OPTIONS[:version]
|
50
51
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
end
|
57
|
-
spec
|
58
|
-
}.compact
|
59
|
-
|
60
|
-
if gem_specs.size > 0
|
61
|
-
say "Opening the following gems with #{options[:editor]}:" if Gem.configuration.verbose
|
62
|
-
paths = gem_specs.map do |spec|
|
63
|
-
say " #{spec.full_name} #{spec.full_gem_path}" if Gem.configuration.verbose
|
64
|
-
%Q{"#{spec.full_gem_path}"}
|
65
|
-
end
|
66
|
-
cmd = "#{options[:editor]} #{paths.join(' ')}"
|
67
|
-
say "Running `#{cmd}`" if Gem.configuration.verbose
|
68
|
-
exec cmd unless options[:dryrun]
|
52
|
+
if spec = Gem.source_index.find_name(get_one_gem_name, version).last
|
53
|
+
say "Opening the #{spec.name} gem, version #{spec.version}, with #{options[:editor]} from #{spec.full_gem_path}" if Gem.configuration.verbose
|
54
|
+
cmd = "#{options[:editor]} ."
|
55
|
+
Dir.chdir(spec.full_gem_path) do
|
56
|
+
exec cmd
|
57
|
+
end unless options[:dryrun]
|
69
58
|
else
|
70
|
-
|
71
|
-
raise Gem::SystemExitException, 1
|
59
|
+
raise Gem::CommandLineError, "No gems found for #{options[:args].join(', ')}"
|
72
60
|
end
|
73
61
|
end
|
74
62
|
end
|
data/lib/gemedit/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gemedit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 23
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
- 0
|
10
|
+
version: 1.0.0
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Lee Marlow
|
@@ -9,65 +15,109 @@ autorequire:
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date:
|
18
|
+
date: 2011-01-11 00:00:00 -07:00
|
13
19
|
default_executable:
|
14
20
|
dependencies:
|
15
21
|
- !ruby/object:Gem::Dependency
|
16
|
-
name:
|
22
|
+
name: bundler
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 23
|
30
|
+
segments:
|
31
|
+
- 1
|
32
|
+
- 0
|
33
|
+
- 0
|
34
|
+
version: 1.0.0
|
17
35
|
type: :development
|
18
|
-
|
19
|
-
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: aruba
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 23
|
46
|
+
segments:
|
47
|
+
- 0
|
48
|
+
- 3
|
49
|
+
- 2
|
50
|
+
version: 0.3.2
|
51
|
+
type: :development
|
52
|
+
version_requirements: *id002
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: rspec
|
55
|
+
prerelease: false
|
56
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
20
58
|
requirements:
|
21
|
-
- -
|
59
|
+
- - ~>
|
22
60
|
- !ruby/object:Gem::Version
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
-
|
28
|
-
|
29
|
-
|
61
|
+
hash: 3
|
62
|
+
segments:
|
63
|
+
- 2
|
64
|
+
- 3
|
65
|
+
- 0
|
66
|
+
version: 2.3.0
|
67
|
+
type: :development
|
68
|
+
version_requirements: *id003
|
69
|
+
description: |
|
70
|
+
A utility to view a gem's source in your favorite editor
|
71
|
+
|
72
|
+
email: lee.marlow@gmail.com
|
73
|
+
executables: []
|
74
|
+
|
30
75
|
extensions: []
|
31
76
|
|
32
|
-
extra_rdoc_files:
|
33
|
-
|
34
|
-
- License.txt
|
35
|
-
- README.txt
|
77
|
+
extra_rdoc_files: []
|
78
|
+
|
36
79
|
files:
|
80
|
+
- README.txt
|
37
81
|
- History.txt
|
82
|
+
- Rakefile
|
38
83
|
- License.txt
|
39
|
-
- README.txt
|
40
|
-
- bin/gemedit
|
41
|
-
- lib/rubygems_plugin.rb
|
42
|
-
- lib/gemedit.rb
|
43
|
-
- lib/gemedit/version.rb
|
44
84
|
- lib/gemedit/edit_command.rb
|
45
|
-
|
46
|
-
|
85
|
+
- lib/gemedit/version.rb
|
86
|
+
- lib/gemedit.rb
|
87
|
+
- lib/rubygems_plugin.rb
|
88
|
+
has_rdoc: false
|
89
|
+
homepage: https://github.com/lmarlow/gemedit
|
47
90
|
licenses: []
|
48
91
|
|
49
92
|
post_install_message:
|
50
|
-
rdoc_options:
|
51
|
-
|
52
|
-
- README.txt
|
93
|
+
rdoc_options: []
|
94
|
+
|
53
95
|
require_paths:
|
54
96
|
- lib
|
55
97
|
required_ruby_version: !ruby/object:Gem::Requirement
|
98
|
+
none: false
|
56
99
|
requirements:
|
57
100
|
- - ">="
|
58
101
|
- !ruby/object:Gem::Version
|
102
|
+
hash: 3
|
103
|
+
segments:
|
104
|
+
- 0
|
59
105
|
version: "0"
|
60
|
-
version:
|
61
106
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
|
+
none: false
|
62
108
|
requirements:
|
63
109
|
- - ">="
|
64
110
|
- !ruby/object:Gem::Version
|
65
|
-
|
66
|
-
|
111
|
+
hash: 23
|
112
|
+
segments:
|
113
|
+
- 1
|
114
|
+
- 3
|
115
|
+
- 6
|
116
|
+
version: 1.3.6
|
67
117
|
requirements: []
|
68
118
|
|
69
119
|
rubyforge_project: gemedit
|
70
|
-
rubygems_version: 1.3.
|
120
|
+
rubygems_version: 1.3.7
|
71
121
|
signing_key:
|
72
122
|
specification_version: 3
|
73
123
|
summary: A utility to view a gem's source in your favorite editor
|