reditor 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/reditor.rb +6 -0
- data/lib/reditor/bundler_support.rb +13 -0
- data/lib/reditor/library_locator.rb +3 -5
- data/lib/reditor/library_search_query.rb +3 -5
- data/lib/reditor/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e3a3e78643b67565aba490e50fe8a344fc184acd
|
4
|
+
data.tar.gz: 786e29b67ccb308bb8ee8a7790502d15413799c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94a67614ae240c50a48360b4cbadb1b661cd73160636f1413ce418c0eae61d16e7b739135106947ec82641a59cd77bc354032bb79aa875ae3865ac90ed1a3ec4
|
7
|
+
data.tar.gz: 2c1d4b315238d886ec6d3dc0da1c59ec026998c0371c09f3737f305b7b724f4e4430f24ee6afd88d600af7163b4a89b6ef175a4ddb0f473a6badafe194b31c78
|
data/lib/reditor.rb
CHANGED
@@ -1,10 +1,16 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
|
3
|
+
# load all dependencies (https://github.com/hibariya/reditor/issues/4)
|
4
|
+
require 'hotwater'
|
5
|
+
require 'thor'
|
6
|
+
require 'rake'
|
7
|
+
|
3
8
|
module Reditor
|
4
9
|
class LibraryNotFound < LoadError; end
|
5
10
|
|
6
11
|
autoload :LibraryLocator, 'reditor/library_locator'
|
7
12
|
autoload :LibrarySearchQuery, 'reditor/library_search_query'
|
13
|
+
autoload :BundlerSupport, 'reditor/bundler_support'
|
8
14
|
autoload :Command, 'reditor/command'
|
9
15
|
autoload :VERSION, 'reditor/version'
|
10
16
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Reditor
|
2
|
+
# Reditor doesn't depend on bundler, But use it if available.
|
3
|
+
module BundlerSupport
|
4
|
+
# **available** bundler specs
|
5
|
+
def bundler_specs
|
6
|
+
require 'bundler'
|
7
|
+
|
8
|
+
Bundler.load.specs
|
9
|
+
rescue LoadError, NameError, Bundler::GemNotFound, Bundler::GemfileNotFound, Bundler::GitError
|
10
|
+
[] # bundler isn't available here
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -3,6 +3,8 @@ require 'pathname'
|
|
3
3
|
# TODO: care version specification
|
4
4
|
module Reditor
|
5
5
|
class LibraryLocator
|
6
|
+
include BundlerSupport
|
7
|
+
|
6
8
|
def self.detect(name)
|
7
9
|
new(name.to_s).detect
|
8
10
|
end
|
@@ -18,13 +20,9 @@ module Reditor
|
|
18
20
|
end
|
19
21
|
|
20
22
|
def detect_from_bundler
|
21
|
-
|
22
|
-
|
23
|
-
return nil unless spec = Bundler.load.specs.find {|spec| spec.name == name }
|
23
|
+
return nil unless spec = bundler_specs.find {|spec| spec.name == name }
|
24
24
|
|
25
25
|
Pathname(spec.full_gem_path)
|
26
|
-
rescue NameError, Bundler::GemNotFound, Bundler::GemfileNotFound
|
27
|
-
# NOP (probably it's not available bundler project)
|
28
26
|
end
|
29
27
|
|
30
28
|
def detect_from_loadpath
|
@@ -3,6 +3,8 @@ require 'hotwater'
|
|
3
3
|
|
4
4
|
module Reditor
|
5
5
|
class LibrarySearchQuery
|
6
|
+
include BundlerSupport
|
7
|
+
|
6
8
|
def self.search(query, limit = 20)
|
7
9
|
new(query).search(limit)
|
8
10
|
end
|
@@ -44,11 +46,7 @@ module Reditor
|
|
44
46
|
end
|
45
47
|
|
46
48
|
def availables_from_bundler
|
47
|
-
|
48
|
-
|
49
|
-
Bundler.load.specs.map(&:name)
|
50
|
-
rescue NameError, Bundler::GemNotFound, Bundler::GemfileNotFound
|
51
|
-
[]
|
49
|
+
bundler_specs.map(&:name)
|
52
50
|
end
|
53
51
|
|
54
52
|
def availables_from_gem
|
data/lib/reditor/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reditor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- hibariya
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-08-
|
11
|
+
date: 2013-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hotwater
|
@@ -125,6 +125,7 @@ files:
|
|
125
125
|
- Rakefile
|
126
126
|
- bin/reditor
|
127
127
|
- lib/reditor.rb
|
128
|
+
- lib/reditor/bundler_support.rb
|
128
129
|
- lib/reditor/command.rb
|
129
130
|
- lib/reditor/library_locator.rb
|
130
131
|
- lib/reditor/library_search_query.rb
|
@@ -166,3 +167,4 @@ test_files:
|
|
166
167
|
- spec/samples/bundler_project/Gemfile
|
167
168
|
- spec/samples/bundler_project_without_lockfile/Gemfile
|
168
169
|
- spec/spec_helper.rb
|
170
|
+
has_rdoc:
|