open_gem 1.4.2 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7318defc2bd99156f620bd8e46e1013aae6f38d9
4
+ data.tar.gz: 0aded319821843c54825b5ab605cc340aad5ea28
5
+ SHA512:
6
+ metadata.gz: deb8a8e586350a7be60d43e111f4ce71d4d6fad0e64c075421d41227f655450271f9b39c827d728f00091097b19cf041cfeaed5f97c9980fdc90a7608758212b
7
+ data.tar.gz: bf59c2362a7c875d518dfc4cfb3ec57be41c022f5e6f938f837d00db1551ba9b749fa340104b147054ea2663f635b7ee9fe03964dc8b15e6014a2d1e035c1f87
@@ -1,5 +1,9 @@
1
1
  OpenGem
2
2
  ========
3
+ 1.5.0
4
+ ---
5
+ * Compatible with Rubygems 2.0+
6
+
3
7
  1.4.2
4
8
  ---
5
9
  * Respect the VISUAL environment variable above EDITOR. (cwninja)
@@ -11,13 +15,13 @@ OpenGem
11
15
 
12
16
  1.3
13
17
  ----
14
- * Added the read command for your reading pleasure.
18
+ * Added the read command for your reading pleasure.
15
19
  Very similar to open, except it will launch the rdoc files for the gem, or generate them.
16
-
20
+
17
21
  1.2
18
22
  ----
19
23
  * Fixed shell parsing so that commands can include arguments
20
24
 
21
25
  1.0
22
26
  ----
23
- * Initial release!
27
+ * Initial release!
@@ -11,20 +11,15 @@ If you just want to read documentation you can do:
11
11
 
12
12
  Installation:
13
13
  ------------
14
- OpenGem require rubygems 1.3.2 or higher. You may need
14
+ OpenGem require rubygems 1.3.6 or higher. You may need
15
15
  to update rubygems to take advantage of the new plugin support:
16
16
 
17
17
  gem update --system
18
18
 
19
- Just install like any normal gem:
19
+ Just install with gem:
20
20
 
21
21
  gem install open_gem
22
22
 
23
- Or for the edge version use GemCutter.org:
24
-
25
- gem sources -a http://gemcutter.org
26
- gem install open_gem
27
-
28
23
  For more help:
29
24
 
30
25
  gem open --help
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'rake'
2
2
  require 'rake/testtask'
3
- require 'rake/rdoctask'
3
+ require 'rdoc/task'
4
4
 
5
5
  begin
6
6
  require 'jeweler'
@@ -16,10 +16,11 @@ begin
16
16
  s.authors = ["Adam Sanderson"]
17
17
  s.has_rdoc = false
18
18
  s.files = FileList["[A-Z]*", "{bin,lib,test}/**/*"]
19
-
19
+ s.required_rubygems_version = ">= 1.8.0"
20
+ s.add_dependency 'launchy', '~> 2.0'
21
+
20
22
  # Testing
21
23
  s.test_files = FileList["test/**/*_test.rb"]
22
- s.add_dependency 'launchy', '~> 0.3.5'
23
24
  s.add_development_dependency 'mocha', '~> 0.9.5'
24
25
  end
25
26
 
@@ -1,4 +1,4 @@
1
- ---
2
- :minor: 4
3
- :patch: 2
1
+ ---
4
2
  :major: 1
3
+ :minor: 5
4
+ :patch: 0
@@ -13,24 +13,37 @@ module OpenGem
13
13
  options[:latest] = true
14
14
  end
15
15
  end
16
-
16
+
17
17
  def add_exact_match_option
18
18
  add_option('-x', '--exact',
19
19
  'Only list exact matches') do |value, options|
20
20
  options[:exact] = true
21
21
  end
22
22
  end
23
-
23
+
24
24
  def get_spec(name)
25
- dep = Gem::Dependency.new(name, options[:version])
26
- specs = Gem.source_index.search(dep)
25
+ version = options[:version] || Gem::Version.new(">= 0")
26
+ exact = options[:exact]
27
+
28
+ specs = Gem::Specification.find_all do |s|
29
+ if name.is_a? String
30
+ name_match = s.name == name
31
+ else
32
+ name_match = s.name[name]
33
+ end
34
+
35
+ name_match && version.satisfied_by?(s.version)
36
+ end
37
+
27
38
  if block_given?
28
39
  specs = specs.select{|spec| yield spec}
29
40
  end
30
-
41
+
42
+ specs = specs.sort
43
+
31
44
  if specs.length == 0
32
45
  # If we have not tried to do a pattern match yet, fall back on it.
33
- if(!options[:exact] && !name.is_a?(Regexp))
46
+ if(!exact && !name.is_a?(Regexp))
34
47
  pattern = /#{Regexp.escape name}/
35
48
  get_spec(pattern)
36
49
  else
@@ -49,4 +62,4 @@ module OpenGem
49
62
  end
50
63
  end
51
64
  end
52
- end
65
+ end
@@ -1,20 +1,24 @@
1
+ require 'rubygems/command'
2
+ require 'rubygems/version_option'
3
+ require 'open_gem/common_options'
4
+
1
5
  # OpenCommand will open a gem's source path
2
6
  class Gem::Commands::OpenCommand < Gem::Command
3
- include OpenGem::CommonOptions
7
+ include ::OpenGem::CommonOptions
4
8
  include Gem::VersionOption
5
-
9
+
6
10
  def initialize
7
- super 'open', "Opens the gem's source directory with $GEM_OPEN_EDITOR or $EDITOR",
8
- :command => nil,
11
+ super 'open', "Opens the gem's source directory with $GEM_OPEN_EDITOR or $EDITOR",
12
+ :command => nil,
9
13
  :version=> Gem::Requirement.default,
10
14
  :latest=> false
11
-
15
+
12
16
  add_command_option
13
17
  add_latest_version_option
14
18
  add_version_option
15
19
  add_exact_match_option
16
20
  end
17
-
21
+
18
22
  def arguments # :nodoc:
19
23
  "GEMNAME gem to open"
20
24
  end
@@ -22,10 +26,10 @@ class Gem::Commands::OpenCommand < Gem::Command
22
26
  def execute
23
27
  name = get_one_gem_name
24
28
  path = get_path(name)
25
-
29
+
26
30
  open_gem(path) if path
27
31
  end
28
-
32
+
29
33
  def get_path(name)
30
34
  if spec = get_spec(name)
31
35
  spec.full_gem_path
@@ -40,9 +44,9 @@ class Gem::Commands::OpenCommand < Gem::Command
40
44
  command_parts = Shellwords.shellwords(editor)
41
45
  command_parts << path
42
46
  success = system(*command_parts)
43
- if !success
47
+ if !success
44
48
  raise Gem::CommandLineError, "Could not run '#{editor} #{path}', exit code: #{$?.exitstatus}"
45
49
  end
46
50
  end
47
51
  end
48
- end
52
+ end
@@ -3,19 +3,19 @@ require 'launchy'
3
3
  class Gem::Commands::ReadCommand < Gem::Command
4
4
  include OpenGem::CommonOptions
5
5
  include Gem::VersionOption
6
-
6
+
7
7
  def initialize
8
- super 'read', "Opens the gem's documentation",
9
- :command => nil,
8
+ super 'read', "Opens the gem's documentation",
9
+ :command => nil,
10
10
  :version=> Gem::Requirement.default,
11
11
  :latest=> false
12
-
12
+
13
13
  add_command_option "Application to read rdoc with"
14
14
  add_latest_version_option
15
15
  add_version_option
16
16
  add_exact_match_option
17
17
  end
18
-
18
+
19
19
  def arguments # :nodoc:
20
20
  "GEMNAME gem to read"
21
21
  end
@@ -32,26 +32,26 @@ class Gem::Commands::ReadCommand < Gem::Command
32
32
  end
33
33
  end
34
34
  end
35
-
35
+
36
36
  def get_path(spec)
37
37
  File.join(spec.installation_path, "doc", spec.full_name, 'rdoc','index.html')
38
38
  end
39
-
39
+
40
40
  def generate_rdoc spec
41
41
  Gem::DocManager.new(spec).generate_rdoc
42
42
  end
43
-
43
+
44
44
  def read_gem(path)
45
45
  if options[:command]
46
46
  command_parts = Shellwords.shellwords(options[:command])
47
47
  command_parts << path
48
48
  success = system(*command_parts)
49
- if !success
49
+ if !success
50
50
  raise Gem::CommandLineError, "Could not run '#{rdoc_reader} #{path}', exit code: #{$?.exitstatus}"
51
51
  end
52
52
  else
53
- Launchy::Browser.run("file://"+path)
53
+ Launchy.open("file://"+path)
54
54
  end
55
55
  end
56
-
56
+
57
57
  end
metadata CHANGED
@@ -1,59 +1,51 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: open_gem
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 1
7
- - 4
8
- - 2
9
- version: 1.4.2
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.5.0
10
5
  platform: ruby
11
- authors:
6
+ authors:
12
7
  - Adam Sanderson
13
8
  autorequire:
14
9
  bindir: bin
15
10
  cert_chain: []
16
-
17
- date: 2010-04-23 00:00:00 -07:00
18
- default_executable:
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
11
+ date: 2014-02-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
21
14
  name: launchy
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ~>
26
- - !ruby/object:Gem::Version
27
- segments:
28
- - 0
29
- - 3
30
- - 5
31
- version: 0.3.5
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
32
20
  type: :runtime
33
- version_requirements: *id001
34
- - !ruby/object:Gem::Dependency
35
- name: mocha
36
21
  prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
38
- requirements:
39
- - - ~>
40
- - !ruby/object:Gem::Version
41
- segments:
42
- - 0
43
- - 9
44
- - 5
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: mocha
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
45
33
  version: 0.9.5
46
34
  type: :development
47
- version_requirements: *id002
48
- description: " Open a gem's source directory with either the default editor, or a specified command.\n"
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.9.5
41
+ description: |2
42
+ Open a gem's source directory with either the default editor, or a specified command.
49
43
  email: netghost@gmail.com
50
44
  executables: []
51
-
52
45
  extensions: []
53
-
54
- extra_rdoc_files:
46
+ extra_rdoc_files:
55
47
  - README.markdown
56
- files:
48
+ files:
57
49
  - CHANGELOG.markdown
58
50
  - README.markdown
59
51
  - Rakefile
@@ -63,35 +55,28 @@ files:
63
55
  - lib/rubygems/commands/read_command.rb
64
56
  - lib/rubygems_plugin.rb
65
57
  - test/open_command_test.rb
66
- has_rdoc: false
67
58
  homepage: http://github.com/adamsanderson/open_gem
68
59
  licenses: []
69
-
60
+ metadata: {}
70
61
  post_install_message:
71
- rdoc_options:
72
- - --charset=UTF-8
73
- require_paths:
62
+ rdoc_options: []
63
+ require_paths:
74
64
  - lib
75
- required_ruby_version: !ruby/object:Gem::Requirement
76
- requirements:
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ requirements:
77
67
  - - ">="
78
- - !ruby/object:Gem::Version
79
- segments:
80
- - 0
81
- version: "0"
82
- required_rubygems_version: !ruby/object:Gem::Requirement
83
- requirements:
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ required_rubygems_version: !ruby/object:Gem::Requirement
71
+ requirements:
84
72
  - - ">="
85
- - !ruby/object:Gem::Version
86
- segments:
87
- - 0
88
- version: "0"
73
+ - !ruby/object:Gem::Version
74
+ version: 1.8.0
89
75
  requirements: []
90
-
91
76
  rubyforge_project: opengem
92
- rubygems_version: 1.3.6
77
+ rubygems_version: 2.2.1
93
78
  signing_key:
94
79
  specification_version: 3
95
80
  summary: Gem Command to easily open a ruby gem with the editor of your choice.
96
- test_files:
81
+ test_files:
97
82
  - test/open_command_test.rb