gembeat 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/LICENSE.txt +22 -0
- data/README.md +46 -0
- data/Rakefile +1 -0
- data/data/ca-certificates.crt +3828 -0
- data/gembeat.gemspec +31 -0
- data/lib/gembeat.rb +65 -0
- data/lib/gembeat/version.rb +3 -0
- metadata +56 -0
data/gembeat.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'gembeat/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "gembeat"
|
8
|
+
gem.version = Gembeat::VERSION
|
9
|
+
gem.authors = ["Blake Mesdag"]
|
10
|
+
gem.email = ["blakemesdag@gmail.com"]
|
11
|
+
gem.description = "A gem for enabling you to publish your apps gems on deploy to a central server"
|
12
|
+
gem.summary = "Enables you to send a pulse to a gembeat server for tracking all your gems"
|
13
|
+
gem.homepage = "http://github.com/BlakeMesdag/gembeat"
|
14
|
+
|
15
|
+
gem.extra_rdoc_files = [
|
16
|
+
"README.md"
|
17
|
+
]
|
18
|
+
|
19
|
+
gem.files = [
|
20
|
+
".gitignore",
|
21
|
+
"LICENSE.txt",
|
22
|
+
"README.md",
|
23
|
+
"Rakefile",
|
24
|
+
"gembeat.gemspec",
|
25
|
+
"data/ca-certificates.crt",
|
26
|
+
"lib/gembeat.rb",
|
27
|
+
"lib/gembeat/version.rb"
|
28
|
+
]
|
29
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
30
|
+
gem.require_paths = ["lib"]
|
31
|
+
end
|
data/lib/gembeat.rb
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
##require "gembeat/version"
|
2
|
+
require 'net/http'
|
3
|
+
require 'uri'
|
4
|
+
require 'json'
|
5
|
+
require 'yaml'
|
6
|
+
|
7
|
+
module Gembeat
|
8
|
+
[:token, :use_ssl, :pulse_url].each do |name|
|
9
|
+
class_eval "
|
10
|
+
@@#{name} = nil unless defined? @@#{name}
|
11
|
+
|
12
|
+
def self.#{name}
|
13
|
+
@@#{name}
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.#{name}=(value)
|
17
|
+
@@#{name} = value
|
18
|
+
end
|
19
|
+
"
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.specs
|
23
|
+
@specs ||= Gem.loaded_specs
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.dependencies_hash
|
27
|
+
@depencies_hash ||= self.specs.map do |name, spec|
|
28
|
+
{:name => name, :version => spec.version.to_s}
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.application_hash
|
33
|
+
{
|
34
|
+
:application => {
|
35
|
+
:token => self.token, :dependencies => self.dependencies_hash
|
36
|
+
}
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.gembeat_uri
|
41
|
+
@uri ||= URI.parse(self.pulse_url)
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.ca_file
|
45
|
+
@cert ||= File.expand_path("../../data/ca-certificates.crt", __FILE__)
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.ca_file=(value)
|
49
|
+
@cert = value
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.send_pulse
|
53
|
+
http = Net::HTTP.new(self.gembeat_uri.host, self.gembeat_uri.port)
|
54
|
+
request = Net::HTTP::Post.new(self.gembeat_uri.request_uri, initheader = {'Content-Type' => "application/json"})
|
55
|
+
request.body = self.application_hash.to_json
|
56
|
+
|
57
|
+
if self.use_ssl
|
58
|
+
http.use_ssl = true
|
59
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
60
|
+
http.ca_file = http.ca_path = self.ca_file
|
61
|
+
end
|
62
|
+
|
63
|
+
response = http.request(request)
|
64
|
+
end
|
65
|
+
end
|
metadata
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gembeat
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Blake Mesdag
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-02-15 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: A gem for enabling you to publish your apps gems on deploy to a central
|
15
|
+
server
|
16
|
+
email:
|
17
|
+
- blakemesdag@gmail.com
|
18
|
+
executables: []
|
19
|
+
extensions: []
|
20
|
+
extra_rdoc_files:
|
21
|
+
- README.md
|
22
|
+
files:
|
23
|
+
- .gitignore
|
24
|
+
- LICENSE.txt
|
25
|
+
- README.md
|
26
|
+
- Rakefile
|
27
|
+
- gembeat.gemspec
|
28
|
+
- data/ca-certificates.crt
|
29
|
+
- lib/gembeat.rb
|
30
|
+
- lib/gembeat/version.rb
|
31
|
+
homepage: http://github.com/BlakeMesdag/gembeat
|
32
|
+
licenses: []
|
33
|
+
post_install_message:
|
34
|
+
rdoc_options: []
|
35
|
+
require_paths:
|
36
|
+
- lib
|
37
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
38
|
+
none: false
|
39
|
+
requirements:
|
40
|
+
- - ! '>='
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0'
|
43
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
44
|
+
none: false
|
45
|
+
requirements:
|
46
|
+
- - ! '>='
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
requirements: []
|
50
|
+
rubyforge_project:
|
51
|
+
rubygems_version: 1.8.23
|
52
|
+
signing_key:
|
53
|
+
specification_version: 3
|
54
|
+
summary: Enables you to send a pulse to a gembeat server for tracking all your gems
|
55
|
+
test_files: []
|
56
|
+
has_rdoc:
|