glean 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/bin/glean +4 -9
- data/lib/glean/dataset.rb +1 -9
- data/lib/glean/glean.rb +2 -0
- data/lib/glean/source/contrib.rb +9 -0
- data/lib/glean/source/core.rb +12 -0
- data/lib/glean/source/user.rb +9 -0
- data/lib/glean/source.rb +22 -0
- data/lib/glean/version.rb +1 -1
- data/lib/glean.rb +8 -3
- metadata +6 -1
data/Gemfile.lock
CHANGED
data/bin/glean
CHANGED
@@ -32,13 +32,8 @@ desc 'Show dataset information'
|
|
32
32
|
arg_name '<dataset>'
|
33
33
|
command :info do |c|
|
34
34
|
c.action do |global_options,options,args|
|
35
|
-
identifier = Glean::
|
36
|
-
|
37
|
-
readme = Octokit.readme(identifier)
|
38
|
-
puts Base64.decode64(readme.content)
|
39
|
-
rescue
|
40
|
-
puts "No extended information available"
|
41
|
-
end
|
35
|
+
identifier = Glean::Source.resolve_identifier(args[0])
|
36
|
+
puts Glean::Source.info(identifier)
|
42
37
|
end
|
43
38
|
end
|
44
39
|
|
@@ -46,8 +41,8 @@ desc 'Search for datasets'
|
|
46
41
|
arg_name '<query>'
|
47
42
|
command :search do |c|
|
48
43
|
c.action do |global_options,options,args|
|
49
|
-
|
50
|
-
puts "#{
|
44
|
+
Glean::Source.search(args[0]).each do |datasource|
|
45
|
+
puts "#{datasource.name} -- #{datasource.description}"
|
51
46
|
end
|
52
47
|
end
|
53
48
|
end
|
data/lib/glean/dataset.rb
CHANGED
@@ -2,16 +2,8 @@ module Glean
|
|
2
2
|
class Dataset
|
3
3
|
attr_reader :identifier
|
4
4
|
|
5
|
-
def self.resolve_identifier(identifier)
|
6
|
-
if identifier.include?("/")
|
7
|
-
identifier
|
8
|
-
else
|
9
|
-
"glean/#{identifier}"
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
5
|
def initialize(identifier, dir="~")
|
14
|
-
@identifier =
|
6
|
+
@identifier = Glean::Source.resolve_identifier(identifier)
|
15
7
|
@dir = dir
|
16
8
|
sync
|
17
9
|
end
|
data/lib/glean/glean.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
module Glean
|
2
|
+
module Source
|
3
|
+
module Core
|
4
|
+
def self.search(query)
|
5
|
+
query = "" if query.nil?
|
6
|
+
Octokit.organization_repositories('glean').select do |repo|
|
7
|
+
"#{repo.name} #{repo.description}".include?(query) unless repo.name =~ /^glean.*$/
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
data/lib/glean/source.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
module Glean
|
2
|
+
module Source
|
3
|
+
def self.resolve_identifier(identifier)
|
4
|
+
if identifier.include?("/")
|
5
|
+
identifier
|
6
|
+
else
|
7
|
+
"glean/#{identifier}"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.search(query)
|
12
|
+
(Core.search(query) + Contrib.search(query) + User.search(query)).sort
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.info(identifier)
|
16
|
+
readme = Octokit.readme(identifier)
|
17
|
+
Base64.decode64(readme.content)
|
18
|
+
rescue
|
19
|
+
"No extended information available"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/glean/version.rb
CHANGED
data/lib/glean.rb
CHANGED
@@ -1,9 +1,14 @@
|
|
1
|
-
require 'glean/
|
1
|
+
require 'glean/glean'
|
2
2
|
require 'glean/dataset'
|
3
|
+
require 'glean/source'
|
4
|
+
require 'glean/source/core'
|
5
|
+
require 'glean/source/contrib'
|
6
|
+
require 'glean/source/user'
|
7
|
+
require 'glean/version'
|
3
8
|
|
4
9
|
require 'git'
|
5
|
-
require 'toml'
|
6
|
-
require 'octokit'
|
7
10
|
require 'hashie/mash'
|
11
|
+
require 'octokit'
|
12
|
+
require 'toml'
|
8
13
|
# Add requires for other files you add to your project here, so
|
9
14
|
# you just need to require this one file in your bin file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glean
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -220,6 +220,11 @@ files:
|
|
220
220
|
- glean.gemspec
|
221
221
|
- lib/glean.rb
|
222
222
|
- lib/glean/dataset.rb
|
223
|
+
- lib/glean/glean.rb
|
224
|
+
- lib/glean/source.rb
|
225
|
+
- lib/glean/source/contrib.rb
|
226
|
+
- lib/glean/source/core.rb
|
227
|
+
- lib/glean/source/user.rb
|
223
228
|
- lib/glean/version.rb
|
224
229
|
- spec/glean/models/dataset_spec.rb
|
225
230
|
- spec/spec_helper.rb
|