glean 0.0.16 → 0.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ef361aff0e067fc8e6ca38c995e4a8d9e24f7057
4
- data.tar.gz: aec3ef4aa72bc1bb342401022721ecb61dccf9b4
3
+ metadata.gz: 850bd570e20bd6c5b16d56ff815d4ce8f17cadf2
4
+ data.tar.gz: 90dd0a4078f92a389a233cfc03fdad3898c025ee
5
5
  SHA512:
6
- metadata.gz: c306874b417f9bf273570177d2f8807279440519fd6496c070f809826613b32b7c5bff5257ac3b190377fee57ef32c26f06aae41b602b41ffad639635ead1c53
7
- data.tar.gz: ba09ff2706b7615ca981fac19dd5a2b8146b24d6be584a7ccc512ce7cdea439e634c1522da7e5e53d04c63eee86bf9504c10e7e14b1e5082ad0ffcf27085772b
6
+ metadata.gz: 1f15ca60742ff3daae487fa54fc14db9b5d9107e9ded7b149e1fe8387c7bd4777f8ec368c2e10d8251a8e33b9ead2b78a4957f8b8cd106c2f052ab39cfd3af2e
7
+ data.tar.gz: 0a77eccd354168bfa461db5b89c04a2a0265f2e47cb752f478758122e4bc2e1d2a328fdc59fa1b3970e8bcc1a8f3ee93be5b6c561cd859115e9084637312c636
data/README.md CHANGED
@@ -17,10 +17,15 @@ Each file represents one piece of data (a hash of hashes). Filenames and directo
17
17
  ## Sources
18
18
  Glean datasets are available from three distinct sources:
19
19
 
20
- * [Core](http://github.com/glean) - Available via search, hosted on the Glean GitHub organization
21
- * TODO
22
- * Contrib - Available via search (using --contrib)
23
- * User - Directly available via URL
20
+ 1. [Core](http://github.com/glean)
21
+ * Available via search
22
+ * Hosted on the Glean GitHub organization
23
+ 1. [Contrib](https://github.com/glean/glean-contrib)
24
+ * Available via search using --contrib
25
+ * Hosted on GitHub and cataloged by [Glean Contrib](https://github.com/glean/glean-contrib)
26
+ 1. User
27
+ * TODO
28
+ * Directly available via URL
24
29
 
25
30
  ## Installation
26
31
  ```
@@ -55,6 +60,7 @@ COMMANDS
55
60
  ```
56
61
 
57
62
  ### Examples
63
+ __Core:__
58
64
  ```
59
65
  $ glean export countries --format=json
60
66
  {"name":"Andorra","code":"ad"}
@@ -75,6 +81,14 @@ name: Arkansas
75
81
  abbreviation: ar
76
82
  ...
77
83
  ```
84
+ __Contrib:__
85
+ ```
86
+ $ glean export lagalaxy/trophies --format=json
87
+ {"competition":"MLS Supporters' Shield","year":1998}
88
+ {"competition":"CONCACAF Champions' League","year":2000}
89
+ {"competition":"Lamar Hunt U.S. Open Cup","year":2001}
90
+ ...
91
+ ```
78
92
 
79
93
  ## Rails
80
94
 
data/bin/glean CHANGED
@@ -44,8 +44,10 @@ end
44
44
  desc 'Search for datasets'
45
45
  arg_name '<query>'
46
46
  command :search do |c|
47
+ c.switch :contrib
47
48
  c.action do |global_options,options,args|
48
- Glean::Source.search(args[0]).each do |datasource|
49
+ source = options[:contrib] ? :contrib : :core
50
+ Glean::Source.search(args[0], source).each do |datasource|
49
51
  puts "#{datasource.name} -- #{datasource.description}"
50
52
  end
51
53
  end
@@ -5,13 +5,12 @@ spec = Gem::Specification.new do |s|
5
5
  s.version = Glean::VERSION
6
6
  s.author = 'John Britton'
7
7
  s.email = 'public@johndbritton.com'
8
- s.homepage = 'http://github.com/johndbritton/glean'
8
+ s.homepage = 'http://github.com/glean/glean'
9
9
  s.platform = Gem::Platform::RUBY
10
10
  s.summary = 'A description of your project'
11
11
  s.files = `git ls-files`.split($/)
12
12
  s.require_paths << 'lib'
13
- s.has_rdoc = true
14
- s.rdoc_options << '--title' << 'glean' << '--main' << 'README.rdoc' << '-ri'
13
+ s.rdoc_options << '--title' << 'glean' << '--main' << 'README.rdoc'
15
14
  s.bindir = 'bin'
16
15
  s.executables << 'glean'
17
16
  s.add_development_dependency('rake')
@@ -1,5 +1,7 @@
1
1
  module Glean
2
2
  class Dataset
3
+ include Enumerable
4
+
3
5
  attr_reader :identifier
4
6
 
5
7
  def initialize(identifier, dir="~")
@@ -8,8 +8,8 @@ module Glean
8
8
  end
9
9
  end
10
10
 
11
- def self.search(query)
12
- (Core.search(query) + Contrib.search(query) + User.search(query)).sort { |a, b| a.name <=> b.name }
11
+ def self.search(query, source)
12
+ self.const_get(source.capitalize).search(query).sort { |a, b| a.name <=> b.name }
13
13
  end
14
14
 
15
15
  def self.info(identifier)
@@ -1,8 +1,17 @@
1
1
  module Glean
2
2
  module Source
3
3
  module Contrib
4
+
5
+ class SearchResult < Struct.new(:name, :description)
6
+ end
7
+
4
8
  def self.search(query)
5
- []
9
+ query = "" if query.nil?
10
+ Glean::Dataset.new('glean/glean-contrib').each_with_object([]) do |source, results|
11
+ name = source.identifier
12
+ description = "#{source.name}: #{source.description}"
13
+ results << SearchResult.new(name, description) if description.include?(query)
14
+ end
6
15
  end
7
16
  end
8
17
  end
@@ -1,3 +1,3 @@
1
1
  module Glean
2
- VERSION = '0.0.16'
2
+ VERSION = '0.0.17'
3
3
  end
@@ -0,0 +1,19 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Glean::Source::Contrib" do
4
+
5
+ describe "#search" do
6
+ let(:name) { "lagalaxy/trophies" }
7
+ let(:description) { "lagalaxy trophies: Major trophies won by the LA Galaxy" }
8
+
9
+ subject(:result) { Glean::Source::Contrib.search("galaxy").first }
10
+
11
+ it "should find lagalaxy trophies source" do
12
+ expect(result.name).to eq(name)
13
+ end
14
+
15
+ it "and provide a description" do
16
+ expect(result.description).to eq(description)
17
+ end
18
+ end
19
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glean
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.16
4
+ version: 0.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Britton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-26 00:00:00.000000000 Z
11
+ date: 2014-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -204,8 +204,9 @@ files:
204
204
  - lib/glean/source/user.rb
205
205
  - lib/glean/version.rb
206
206
  - spec/glean/models/dataset_spec.rb
207
+ - spec/glean/source/contrib_spec.rb
207
208
  - spec/spec_helper.rb
208
- homepage: http://github.com/johndbritton/glean
209
+ homepage: http://github.com/glean/glean
209
210
  licenses: []
210
211
  metadata: {}
211
212
  post_install_message:
@@ -214,7 +215,6 @@ rdoc_options:
214
215
  - glean
215
216
  - --main
216
217
  - README.rdoc
217
- - -ri
218
218
  require_paths:
219
219
  - lib
220
220
  - lib
@@ -235,3 +235,4 @@ signing_key:
235
235
  specification_version: 4
236
236
  summary: A description of your project
237
237
  test_files: []
238
+ has_rdoc: