omnibar 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b92696d806fad27d9518b1935f98a12d1ca8ceaa
4
- data.tar.gz: e412de9c590de961ddf2b01b7f2f309c53e25dde
3
+ metadata.gz: cde2fe41dbe7f67c545e0f41a77a37fd17e09297
4
+ data.tar.gz: a58f27bc5c2cc0a6f84c5132e90a4390d433e923
5
5
  SHA512:
6
- metadata.gz: 070515ddb8fb591a206a2c8c4fc00b368214131c3d8731a8fd4a208f4c3abd093f53a1329ab0c3911ca540e5dece082ec8837d4a9d8c8a6aa5b8115cdaa6d6ee
7
- data.tar.gz: ba2cab69ca8b67c3a95764634081af03c6aa38ff79e5cef0dbb064dda276ea6ef2315274110f61d7f418d4cdb2c4dfc6d3dc6815216169fc01df4eeb53ce6e98
6
+ metadata.gz: 2266d2f38a91eabf847239b609657f8056bfc5a1ab1c74a3acae3926844d17520428603385b23bd40ca110bb7952c0212e5e0e9cdbb97397768f13e8d0853b8c
7
+ data.tar.gz: 9143be880598bc1c52b20a9d7b42653be93db7826b28c141769c75ea9c022bfa9a6ebf6c6bd538ef0b574cc94beae6423c5c515efd84f316ccec5d1ab54d1243
data/Gemfile.lock CHANGED
@@ -2,10 +2,14 @@ PATH
2
2
  remote: .
3
3
  specs:
4
4
  omnibar (0.0.1)
5
+ dry-configurable (~> 0.7.0)
5
6
 
6
7
  GEM
7
8
  remote: https://rubygems.org/
8
9
  specs:
10
+ concurrent-ruby (1.0.5)
11
+ dry-configurable (0.7.0)
12
+ concurrent-ruby (~> 1.0)
9
13
  rake (10.5.0)
10
14
 
11
15
  PLATFORMS
data/README.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Omnibar
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/omnibar.svg)](https://badge.fury.io/rb/omnibar)
4
+ [![Maintainability](https://api.codeclimate.com/v1/badges/986aa321241fbeb4a9e1/maintainability)](https://codeclimate.com/github/shreve/omnibar/maintainability)
5
+
3
6
  Omnibar is a tool for quick access to multiple scripts and searches.
4
7
 
5
8
 
data/lib/omnibar.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'dry-configurable'
2
+
1
3
  require 'omnibar/version'
2
4
  require 'omnibar/app'
3
5
 
@@ -8,4 +10,14 @@ require 'omnibar/google'
8
10
  require 'omnibar/duck_duck_go'
9
11
 
10
12
  module Omnibar
13
+ extend Dry::Configurable
14
+
15
+ setting :github do
16
+ setting :repos, []
17
+ end
18
+
19
+ def self.load_config
20
+ load File.expand_path('~/.omnibar')
21
+ rescue LoadError => _
22
+ end
11
23
  end
data/lib/omnibar/app.rb CHANGED
@@ -20,6 +20,7 @@ module Omnibar
20
20
  def initialize
21
21
  @input = ''
22
22
  @selection = 0
23
+ Omnibar.load_config
23
24
  end
24
25
 
25
26
  def run
@@ -66,6 +67,7 @@ module Omnibar
66
67
  def perform_action!
67
68
  visible_queries[selection]&.perform!
68
69
  self.input = ""
70
+ # TODO: after_perform callback
69
71
  end
70
72
 
71
73
  def queries
@@ -7,19 +7,17 @@ end
7
7
  module Omnibar
8
8
  class Github < Query
9
9
  def repos
10
- %w(
11
- wellopp/dashboard
12
- wellopp/dispatch
13
- wellopp/magic-docs
14
- )
10
+ Omnibar.config.github.repos
15
11
  end
16
12
 
17
13
  def result
18
14
  repos.each do |repo|
19
15
  user, name = repo.split('/')
16
+ name ||= ''
20
17
  return repo if (input & repo or input & user or input & name)
21
18
  end
22
- nil
19
+
20
+ return input if input.match?(/^[\w-]+\/[\w-]+$/)
23
21
  end
24
22
 
25
23
  def perform!
@@ -28,3 +26,6 @@ module Omnibar
28
26
  end
29
27
  end
30
28
  end
29
+
30
+ # TODO: assume name/name is a github repo
31
+ # TODO: add task for fetching user's repos https://api.github.com/users/:username/repos
@@ -30,11 +30,11 @@ module Omnibar
30
30
  end
31
31
 
32
32
  def rpad(text, length = ANSI.size[:width])
33
- text + (' ' * (length - text.length))
33
+ text + (' ' * [0, (length - text.length)].max)
34
34
  end
35
35
 
36
36
  def lpad(text, length = ANSI.size[:width])
37
- (' ' * (length - text.length)) + text
37
+ (' ' * [0, (length - text.length)].max) + text
38
38
  end
39
39
 
40
40
  def max_label_length
@@ -1,3 +1,3 @@
1
1
  module Omnibar
2
- VERSION = '0.0.1'.freeze
2
+ VERSION = '0.0.2'.freeze
3
3
  end
data/omnibar.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
- lib = File.expand_path("../lib", __FILE__)
2
+ lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require "omnibar/version"
4
+ require 'omnibar/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'omnibar'
@@ -17,10 +17,11 @@ Gem::Specification.new do |spec|
17
17
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
18
  f.match(%r{^(test|spec|features)/})
19
19
  end
20
- spec.bindir = "exe"
20
+ spec.bindir = 'exe'
21
21
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
- spec.require_paths = ["lib"]
22
+ spec.require_paths = ['lib']
23
23
 
24
- spec.add_development_dependency "bundler", "~> 1.16.a"
25
- spec.add_development_dependency "rake", "~> 10.0"
24
+ spec.add_dependency 'dry-configurable', '~> 0.7.0'
25
+ spec.add_development_dependency 'bundler', '~> 1.16.a'
26
+ spec.add_development_dependency 'rake', '~> 10.0'
26
27
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omnibar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jacob Evan Shreve
@@ -10,6 +10,20 @@ bindir: exe
10
10
  cert_chain: []
11
11
  date: 2017-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: dry-configurable
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.7.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.7.0
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement