ruboty-github_status 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2d5895de8179372cd0cc7a22ba8ac650bdb82a5b
4
+ data.tar.gz: fb8a6b5b3b7c9e6b4d9cebb899e0fb94497b07ec
5
+ SHA512:
6
+ metadata.gz: f6ef4bd93bfbbf27ba3497c9097b20414b73622683abd9799c12a7028a9e904cd9514dc42aedb09d12bce4ac8a8326f8f4c67a90942764fccf8a34d5bb41aed2
7
+ data.tar.gz: a1f13efd73095d23a97bc13d49eb1584659f0182ee5e24b933a418203f9f1e5f1f68497ec60a3b3d880980d5c785dee7794c63df98a1814da89dc99aa6d7b802
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ /vendor/bundle
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in ruboty-github_status.gemspec
4
+ gemspec
@@ -0,0 +1,44 @@
1
+ # Ruboty::GithubStatus
2
+
3
+ Display current GitHub status with messages for Ruboty
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'ruboty'
11
+ gem 'ruboty-github_status'
12
+ ```
13
+
14
+ ## Usage
15
+
16
+ See `ruboty help` or the following:
17
+
18
+ - [lib/ruboty/handlers/github_status.rb](lib/ruboty/handlers/github_status.rb)
19
+
20
+ ## Contributing
21
+
22
+ 1. Fork it ( https://github.com/tacahilo/ruboty-github_status/fork )
23
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
24
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
25
+ 4. Push to the branch (`git push origin my-new-feature`)
26
+ 5. Create a new Pull Request
27
+
28
+ ## See Also
29
+
30
+ - GitHub System Statush
31
+
32
+ https://status.github.com/api
33
+
34
+ - github-status.coffee
35
+
36
+ https://github.com/github/hubot-scripts/blob/master/src/scripts/github-status.coffee
37
+
38
+ ## LICENSE
39
+
40
+ MIT: http://hfm.mit-license.org
41
+
42
+ ## AUTHOR
43
+
44
+ OKUMURA Takahiro hfm@gmail.com
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,3 @@
1
+ require "ruboty/handlers/github_status"
2
+ require "ruboty/github_status/version"
3
+ require "ruboty/github_status/actions/github_status"
@@ -0,0 +1,36 @@
1
+ require 'open-uri'
2
+ require 'json'
3
+
4
+ module Ruboty
5
+ module GithubStatus
6
+ module Actions
7
+ class GithubStatus < Ruboty::Actions::Base
8
+ def status
9
+ html = open('https://status.github.com/api/status.json').read
10
+ json = JSON.parser.new(html).parse
11
+ now = Time.now
12
+ date = Time.parse(json['last_updated']).getlocal
13
+ p now
14
+ p date
15
+ seconds_ago = (now - date).to_i
16
+
17
+ msg = "Status: #{json['status']} (#{seconds_ago} seconds ago)"
18
+
19
+ message.reply(msg)
20
+ end
21
+
22
+ def last_message
23
+ html = open('https://status.github.com/api/last-message.json').read
24
+ json = JSON.parser.new(html).parse
25
+ date = Time.parse(json['created_on']).getlocal
26
+
27
+ msg = "Status: #{json['status']}\n"
28
+ msg += "Message: #{json['body']}\n"
29
+ msg += "Date: #{date}"
30
+
31
+ message.reply(msg)
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,5 @@
1
+ module Ruboty
2
+ module GithubStatus
3
+ VERSION = "1.0.0"
4
+ end
5
+ end
@@ -0,0 +1,25 @@
1
+ module Ruboty
2
+ module Handlers
3
+ class GithubStatus < Base
4
+ on(
5
+ /github status$/,
6
+ name: 'status',
7
+ description: 'Returns the current status with timestamp'
8
+ )
9
+
10
+ on(
11
+ /github status last$/,
12
+ name: 'last_message',
13
+ description: 'Returns the last human communication, status, and timestamp'
14
+ )
15
+
16
+ def status(message)
17
+ Ruboty::GithubStatus::Actions::GithubStatus.new(message).status
18
+ end
19
+
20
+ def last_message(message)
21
+ Ruboty::GithubStatus::Actions::GithubStatus.new(message).last_message
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'ruboty/github_status/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "ruboty-github_status"
8
+ spec.version = Ruboty::GithubStatus::VERSION
9
+ spec.authors = ["Takahiro OKUMURA"]
10
+ spec.email = ["hfm.garden@gmail.com"]
11
+ spec.summary = %q{Display current GitHub status with messages for Ruboty}
12
+ spec.description = %q{Display current GitHub status with messages for Ruboty}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_runtime_dependency "ruboty"
22
+ spec.add_development_dependency "bundler", "~> 1.8"
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ end
metadata ADDED
@@ -0,0 +1,95 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ruboty-github_status
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Takahiro OKUMURA
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-03-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: ruboty
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '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'
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.8'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.8'
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: Display current GitHub status with messages for Ruboty
56
+ email:
57
+ - hfm.garden@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - Gemfile
64
+ - README.md
65
+ - Rakefile
66
+ - lib/ruboty/github_status.rb
67
+ - lib/ruboty/github_status/actions/github_status.rb
68
+ - lib/ruboty/github_status/version.rb
69
+ - lib/ruboty/handlers/github_status.rb
70
+ - ruboty-github_status.gemspec
71
+ homepage: ''
72
+ licenses:
73
+ - MIT
74
+ metadata: {}
75
+ post_install_message:
76
+ rdoc_options: []
77
+ require_paths:
78
+ - lib
79
+ required_ruby_version: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ required_rubygems_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ requirements: []
90
+ rubyforge_project:
91
+ rubygems_version: 2.4.5
92
+ signing_key:
93
+ specification_version: 4
94
+ summary: Display current GitHub status with messages for Ruboty
95
+ test_files: []