bitbar 0.1.0
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 +7 -0
- data/.gitignore +9 -0
- data/Gemfile +4 -0
- data/README.md +50 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/bitbar.gemspec +23 -0
- data/lib/bitbar.rb +5 -0
- data/lib/bitbar/base.rb +21 -0
- data/lib/bitbar/item.rb +26 -0
- data/lib/bitbar/menu.rb +8 -0
- data/lib/bitbar/separator.rb +11 -0
- data/lib/bitbar/version.rb +3 -0
- metadata +98 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c17eaacca2e36142249c7f2773214442d0f6d4b4
|
4
|
+
data.tar.gz: 9bcf72892103f08f325109e667d3ab7dbda32768
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 789f5007e9fc4ea3e342780b0301f87b1e1e4ca28096d622cbad7c4ff185b444bcffeb63b2d5240135957d68eaa7fc9753929f5ecfe050e26275afd0554869d4
|
7
|
+
data.tar.gz: 107514ba34fd234882ea00ead73997d558060b69690706ed50f65a0a9a026543c312f43735e8420100c2b98ae4a2e9fcfdd0508c614dcaced39bc9dbfa9055d7
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# BitBar Ruby
|
2
|
+
|
3
|
+
bitbar-ruby helps you build BitBar plugins faster.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'bitbar'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install bitbar
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
require 'bitbar'
|
25
|
+
require 'open-uri'
|
26
|
+
require 'base64'
|
27
|
+
|
28
|
+
BitBar::Menu.new do
|
29
|
+
item "One", size: 18
|
30
|
+
item "Two"
|
31
|
+
separator
|
32
|
+
item "Dropdown" do
|
33
|
+
item "Three"
|
34
|
+
item "Four"
|
35
|
+
end
|
36
|
+
separator
|
37
|
+
item image: Base64.strict_encode64(open("https://assets-cdn.github.com/images/modules/logos_page/GitHub-Mark.png").read)
|
38
|
+
end
|
39
|
+
```
|
40
|
+
|
41
|
+
|
42
|
+
## Development
|
43
|
+
|
44
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
45
|
+
|
46
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
47
|
+
|
48
|
+
## Contributing
|
49
|
+
|
50
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/knoopx/bitbar.
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "bitbar"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/bitbar.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'bitbar/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "bitbar"
|
8
|
+
spec.version = BitBar::VERSION
|
9
|
+
spec.authors = ["Victor Martinez"]
|
10
|
+
spec.email = ["knoopx@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Library for quick BitBar plugin development in ruby}
|
13
|
+
spec.homepage = "http://github.com/knoopx/bitbar-ruby"
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
16
|
+
spec.bindir = "exe"
|
17
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_dependency "activesupport", ">= 4"
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.12"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
end
|
data/lib/bitbar.rb
ADDED
data/lib/bitbar/base.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
module BitBar
|
2
|
+
class Base
|
3
|
+
def initialize(indent_level = -1, &block)
|
4
|
+
@indent_level = indent_level
|
5
|
+
@output = []
|
6
|
+
instance_eval(&block) if block
|
7
|
+
end
|
8
|
+
|
9
|
+
def separator
|
10
|
+
@output << Separator.new(@indent_level + 1)
|
11
|
+
end
|
12
|
+
|
13
|
+
def item(*args, &block)
|
14
|
+
@output << Item.new(@indent_level + 1, *args, &block)
|
15
|
+
end
|
16
|
+
|
17
|
+
def to_s
|
18
|
+
@output.map(&:to_s).join("\r\n")
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/bitbar/item.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'active_support/core_ext/array/extract_options'
|
2
|
+
|
3
|
+
module BitBar
|
4
|
+
class Item < Base
|
5
|
+
class Options < SimpleDelegator
|
6
|
+
def initialize(opts = {})
|
7
|
+
super(opts)
|
8
|
+
end
|
9
|
+
|
10
|
+
def to_s
|
11
|
+
__getobj__.inject([]){|out, tuple| out << tuple.join("=") }.join(" ")
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def initialize(*args, &block)
|
16
|
+
@opts = Options.new(args.extract_options!)
|
17
|
+
@indent_level, @title = args
|
18
|
+
super(@indent_level, &block)
|
19
|
+
end
|
20
|
+
|
21
|
+
def to_s
|
22
|
+
prefix = ("--" * @indent_level) + @title.to_s
|
23
|
+
[@opts.any? ? [prefix, @opts].join("|") : prefix, *@output.map(&:to_s)].join("\r\n")
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/bitbar/menu.rb
ADDED
metadata
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bitbar
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Victor Martinez
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-07-20 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.12'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.12'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
description:
|
56
|
+
email:
|
57
|
+
- knoopx@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- Gemfile
|
64
|
+
- README.md
|
65
|
+
- Rakefile
|
66
|
+
- bin/console
|
67
|
+
- bin/setup
|
68
|
+
- bitbar.gemspec
|
69
|
+
- lib/bitbar.rb
|
70
|
+
- lib/bitbar/base.rb
|
71
|
+
- lib/bitbar/item.rb
|
72
|
+
- lib/bitbar/menu.rb
|
73
|
+
- lib/bitbar/separator.rb
|
74
|
+
- lib/bitbar/version.rb
|
75
|
+
homepage: http://github.com/knoopx/bitbar-ruby
|
76
|
+
licenses: []
|
77
|
+
metadata: {}
|
78
|
+
post_install_message:
|
79
|
+
rdoc_options: []
|
80
|
+
require_paths:
|
81
|
+
- lib
|
82
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
87
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
requirements: []
|
93
|
+
rubyforge_project:
|
94
|
+
rubygems_version: 2.5.1
|
95
|
+
signing_key:
|
96
|
+
specification_version: 4
|
97
|
+
summary: Library for quick BitBar plugin development in ruby
|
98
|
+
test_files: []
|