irfsdash 0.0.1
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.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +57 -0
- data/Rakefile +1 -0
- data/irfsdash.gemspec +21 -0
- data/lib/irfsdash/version.rb +3 -0
- data/lib/irfsdash.rb +55 -0
- metadata +87 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 James Harrison
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# IRFSDash
|
2
|
+
|
3
|
+
IRFSDash is a handy little Ruby library that lets you, a noble application developer, easily push content to the IRFS office dashboard. It does simple checking to make sure your stuff complies with the API requirements.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'irfsdash'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install irfsdash
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
Add to your gemfile:
|
22
|
+
|
23
|
+
gem 'irfsdash'
|
24
|
+
|
25
|
+
In an initializer:
|
26
|
+
|
27
|
+
IRFSDash.setup(source: 'My Application')
|
28
|
+
# you can add color: and icon: to add default colors/icons to your stuff
|
29
|
+
|
30
|
+
Publish to the activity feed:
|
31
|
+
|
32
|
+
IRFSDash.activity(content: 'Hello, world!', type: 'string')
|
33
|
+
IRFSDash.activity(content: 4, label: 'clips in the last hour', type: 'number')
|
34
|
+
|
35
|
+
Publish a project update:
|
36
|
+
|
37
|
+
IRFSDash.project(project: 'Snippets', happy: false)
|
38
|
+
IRFSDash.project(project: 'Snippets', happy: false, label: 'Build failing')
|
39
|
+
|
40
|
+
Publish to the tickers:
|
41
|
+
|
42
|
+
IRFSDash.ticker(content: 'This will scroll across the screen', ticker_type: 'main')
|
43
|
+
IRFSDash.ticker(content: 'This will scroll across the screen below that', ticker_type: 'small')
|
44
|
+
|
45
|
+
Publish a widget:
|
46
|
+
|
47
|
+
IRFSDash.widget(content: '<strong>Hello</strong> world')
|
48
|
+
IRFSDash.widget(url: 'http://some-url')
|
49
|
+
|
50
|
+
|
51
|
+
## Contributing
|
52
|
+
|
53
|
+
1. Fork it
|
54
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
55
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
56
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
57
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/irfsdash.gemspec
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'irfsdash/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "irfsdash"
|
8
|
+
gem.version = IRFSDash::VERSION
|
9
|
+
gem.authors = ["James Harrison"]
|
10
|
+
gem.email = ["james.harrison2@bbc.co.uk"]
|
11
|
+
gem.description = %q{Interface gem for the BBC Research and Development IRFS Dashboard}
|
12
|
+
gem.summary = %q{This gem lets you easily push messages to be displayed on the IRFS Dashboard system}
|
13
|
+
gem.homepage = "http://gitlab.prototype0.net/irfsdash"
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
gem.add_dependency('amqp', '>= 0.9.8')
|
20
|
+
gem.add_dependency('json', '>= 1.7.5')
|
21
|
+
end
|
data/lib/irfsdash.rb
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
require "irfsdash/version"
|
2
|
+
|
3
|
+
module IRFSDash
|
4
|
+
# Returns an AMQP channel
|
5
|
+
def self.amqp_channel
|
6
|
+
@amqp_connection ||= AMQP.connect(:host => '127.0.0.1')
|
7
|
+
@amqp_channel ||= AMQP::Channel.new(@amqp_connection)
|
8
|
+
return @amqp_channel
|
9
|
+
end
|
10
|
+
def self.amqp_exchange(name, opts={})
|
11
|
+
@amqp_exchanges ||= {}
|
12
|
+
@amqp_exchanges[name] ||= AMQP::Exchange.new(name, opts)
|
13
|
+
return @amqp_exchanges[name]
|
14
|
+
end
|
15
|
+
# Setup the library's defaults
|
16
|
+
def self.setup(opts={})
|
17
|
+
@defaults = opts
|
18
|
+
end
|
19
|
+
# Publish to the activity stream
|
20
|
+
# Minimum: :source, :content
|
21
|
+
def self.activity(opts={})
|
22
|
+
msg = opts.merge!(@defaults)
|
23
|
+
raise ArgumentError, "No source specified" unless msg[:source]
|
24
|
+
raise ArgumentError, "No content specified" unless msg[:content]
|
25
|
+
raise ArgumentError, "No type specified" unless msg[:type]
|
26
|
+
self.amqp_channel.fanout("irfs-dashboard.activity").publish(JSON.dump(msg))
|
27
|
+
end
|
28
|
+
# Publish a project update
|
29
|
+
# Minimum: :source, :project, :happy
|
30
|
+
def self.project(opts={})
|
31
|
+
msg = opts.merge!(@defaults)
|
32
|
+
raise ArgumentError, "No source specified" unless msg[:source]
|
33
|
+
raise ArgumentError, "No project specified" unless msg[:project]
|
34
|
+
raise ArgumentError, "No happy specified" unless msg[:happy]
|
35
|
+
self.amqp_channel.fanout("irfs-dashboard.projects").publish(JSON.dump(msg))
|
36
|
+
end
|
37
|
+
# Publish to the ticker
|
38
|
+
# Minimum: :source, :content, :ticker_type
|
39
|
+
def self.ticker(opts={})
|
40
|
+
msg = opts.merge!(@defaults)
|
41
|
+
raise ArgumentError, "No source specified" unless msg[:source]
|
42
|
+
raise ArgumentError, "No content specified" unless msg[:content]
|
43
|
+
raise ArgumentError, "No ticker type specified" unless msg[:ticker_type]
|
44
|
+
self.amqp_channel.fanout("irfs-dashboard.tickers").publish(JSON.dump(msg))
|
45
|
+
end
|
46
|
+
# Publish a widget
|
47
|
+
# Minimum: :source, (:content OR :url)
|
48
|
+
def self.project(opts={})
|
49
|
+
msg = opts.merge!(@defaults)
|
50
|
+
raise ArgumentError, "No source specified" unless msg[:source]
|
51
|
+
raise ArgumentError, "No content or URL specified" unless msg[:url] or msg[:content]
|
52
|
+
self.amqp_channel.fanout("irfs-dashboard.widgets").publish(JSON.dump(msg))
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
metadata
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: irfsdash
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- James Harrison
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-10-25 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: amqp
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.9.8
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.9.8
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: json
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 1.7.5
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.7.5
|
46
|
+
description: Interface gem for the BBC Research and Development IRFS Dashboard
|
47
|
+
email:
|
48
|
+
- james.harrison2@bbc.co.uk
|
49
|
+
executables: []
|
50
|
+
extensions: []
|
51
|
+
extra_rdoc_files: []
|
52
|
+
files:
|
53
|
+
- .gitignore
|
54
|
+
- Gemfile
|
55
|
+
- LICENSE.txt
|
56
|
+
- README.md
|
57
|
+
- Rakefile
|
58
|
+
- irfsdash.gemspec
|
59
|
+
- lib/irfsdash.rb
|
60
|
+
- lib/irfsdash/version.rb
|
61
|
+
homepage: http://gitlab.prototype0.net/irfsdash
|
62
|
+
licenses: []
|
63
|
+
post_install_message:
|
64
|
+
rdoc_options: []
|
65
|
+
require_paths:
|
66
|
+
- lib
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
none: false
|
69
|
+
requirements:
|
70
|
+
- - ! '>='
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ! '>='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
requirements: []
|
80
|
+
rubyforge_project:
|
81
|
+
rubygems_version: 1.8.24
|
82
|
+
signing_key:
|
83
|
+
specification_version: 3
|
84
|
+
summary: This gem lets you easily push messages to be displayed on the IRFS Dashboard
|
85
|
+
system
|
86
|
+
test_files: []
|
87
|
+
has_rdoc:
|