Skip to content
This repository was archived by the owner on Apr 10, 2025. It is now read-only.

Commit 9a6ccdb

Browse files
committed
Initial commit. A hacked-up fork of the old Errplane gem.
0 parents  commit 9a6ccdb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1677
-0
lines changed

.gitignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.bundle
2+
.rvmrc
3+
*.gem
4+
Gemfile.lock
5+
gemfiles/*.lock
6+
pkg/*
7+
spec/support/rails2/log/*
8+
spec/support/rails3/log/*
9+
spec/support/rails4/log/*

.rspec

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
--format progress
2+
--color

.travis.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
language: ruby
2+
rvm:
3+
- 1.9.3
4+
- 1.8.7
5+
- ree
6+
- jruby-19mode
7+
- jruby-18mode
8+
gemfile:
9+
- gemfiles/Gemfile.rails-4.0.x
10+
- gemfiles/Gemfile.rails-3.2.x
11+
- gemfiles/Gemfile.rails-3.1.x
12+
- gemfiles/Gemfile.rails-3.0.x
13+
- gemfiles/Gemfile.rails-2.3.x
14+
matrix:
15+
exclude:
16+
- rvm: 1.8.7
17+
gemfile: gemfiles/Gemfile.rails-4.0.x
18+
- rvm: ree
19+
gemfile: gemfiles/Gemfile.rails-4.0.x
20+
- rvm: jruby-18mode
21+
gemfile: gemfiles/Gemfile.rails-4.0.x
22+
before_install:
23+
- gem update --system 1.8.25
24+
notifications:
25+
email:
26+
27+
on_success: change
28+
on_failure: always
29+
script: bundle exec rake spec

Gemfile

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source "https://rubygems.org"
2+
3+
gemspec

README.md

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Errplane
2+
========
3+
[![Build Status](https://secure.travis-ci.org/errplane/errplane-ruby.png)](http://travis-ci.org/errplane/errplane-ruby)
4+
5+
This gem integrates your applications with [Errplane](https://errplane.com), a service for real-time monitoring and alerting of applications and infrastructure.
6+
7+
This gem currently has support for Ruby on Rails (2.3.x, 3.x, 4.x), Sinatra, Resque, Sidekiq, and Capistrano.
8+
9+
Ready to get started? [Check out the docs!](https://errplane.com/documentation/ruby)
10+
11+
Support
12+
-------
13+
14+
Running into any issues? Get in touch with us at [[email protected]](mailto:[email protected]).
15+
16+
Contributing
17+
------------
18+
19+
We love contributions. Want to add support for something you don't already see here? Fork this repository, make your changes, and send us a pull request.
20+
21+
Copyright
22+
---------
23+
24+
Copyright (c) 2013 Errplane, Inc.

Rakefile

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# encoding: utf-8
2+
3+
if ENV["BUNDLE_GEMFILE"] == File.expand_path("Gemfile")
4+
ENV["BUNDLE_GEMFILE"] = "gemfiles/Gemfile.rails-3.2.x"
5+
end
6+
7+
require 'bundler'
8+
Bundler::GemHelper.install_tasks
9+
10+
begin
11+
targeted_files = ARGV.drop(1)
12+
file_pattern = targeted_files.empty? ? 'spec/**/*_spec.rb' : targeted_files
13+
14+
require 'rspec/core'
15+
require 'rspec/core/rake_task'
16+
17+
RSpec::Core::RakeTask.new(:spec) do |t|
18+
t.pattern = FileList[file_pattern]
19+
end
20+
21+
RSpec.configure do |config|
22+
config.color_enabled = true
23+
config.formatter = :documentation
24+
end
25+
rescue LoadError
26+
require 'spec/rake/spectask'
27+
28+
puts file_pattern
29+
30+
Spec::Rake::SpecTask.new(:spec) do |t|
31+
t.pattern = FileList[file_pattern]
32+
t.spec_opts += ["--color"]
33+
end
34+
end

config.ru

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
require 'rubygems'
2+
require 'bundler'
3+
4+
Bundler.require :default, :development
5+
6+
Combustion.initialize!
7+
run Combustion::Application

gemfiles/Gemfile.rails-3.0.x

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
source "https://rubygems.org"
2+
3+
gem "railties", "~> 3.0.15"
4+
gem 'actionpack', '~> 3.0.15'
5+
gem 'activesupport', '~> 3.0.15'
6+
gem 'rspec-rails', '>= 2.0'
7+
8+
gemspec :path => '../'

gemfiles/Gemfile.rails-3.1.x

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
source "https://rubygems.org"
2+
3+
gem "railties", "~> 3.1.5"
4+
gem 'actionpack', '~> 3.1.5'
5+
gem 'activesupport', '~> 3.1.5'
6+
gem 'rspec-rails', '>= 2.0'
7+
8+
gemspec :path => '../'

gemfiles/Gemfile.rails-3.2.x

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
source "https://rubygems.org"
2+
3+
gem "railties", "~> 3.2.3"
4+
gem 'actionpack', '~> 3.2.3'
5+
gem 'activesupport', '~> 3.2.3'
6+
gem 'rspec-rails', '>= 2.0'
7+
8+
gemspec :path => '../'

gemfiles/Gemfile.rails-4.0.x

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
source "https://rubygems.org"
2+
3+
gem 'actionpack', '~> 4.0.0'
4+
gem 'activesupport', '~> 4.0.0'
5+
gem 'activemodel', '~> 4.0.0'
6+
gem 'rspec-rails', '>= 2.0'
7+
8+
gemspec :path => '../'
+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
class ErrplaneGenerator < Rails::Generator::Base
2+
def add_options!(option)
3+
option.on("-k", "--api-key=API_KEY", String, "API key for your Errplane organization") {|v| options[:api_key] = v}
4+
option.on("-a", "--application-id=APP_ID", String, "Your Errplane application id (optional)") {|v| options[:application_id] = v}
5+
end
6+
7+
def manifest
8+
if options[:api_key].blank?
9+
puts "You must provide an API key using -k or --api-key."
10+
exit
11+
end
12+
13+
begin
14+
puts "Contacting Errplane API"
15+
application_name = "ApplicationName"
16+
api_key = options[:api_key]
17+
18+
connection = Net::HTTP.new("errplane.com", 443)
19+
connection.use_ssl = true
20+
connection.verify_mode = OpenSSL::SSL::VERIFY_NONE
21+
url = "/api/v1/applications?api_key=#{api_key}&name=#{application_name}"
22+
response = connection.post(url, nil)
23+
24+
@application = JSON.parse(response.body)
25+
26+
unless response.is_a?(Net::HTTPSuccess)
27+
raise "The Errplane API returned an error: #{response.inspect}"
28+
end
29+
rescue => e
30+
puts "We ran into a problem creating your application via the API!"
31+
puts "If this issue persists, contact us at [email protected] with the following details:"
32+
puts "API Key: #{e.class}: #{options[:api_key]}"
33+
puts "#{e.class}: #{e.message}"
34+
end
35+
36+
record do |m|
37+
m.template "initializer.rb", "config/initializers/errplane.rb",
38+
:assigns => {
39+
:application_id => options[:application_id] || @application["key"] || secure_random.hex(4),
40+
:api_key => options[:api_key]
41+
}
42+
end
43+
end
44+
45+
def secure_random
46+
defined?(SecureRandom) ? SecureRandom : ActiveSupport::SecureRandom
47+
end
48+
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
require "errplane"
2+
3+
Errplane.configure do |config|
4+
config.api_key = "<%= api_key %>"
5+
config.application_id = "<%= application_id %>"
6+
end

influxdb-rails.gemspec

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# -*- encoding: utf-8 -*-
2+
$:.push File.expand_path("../lib", __FILE__)
3+
require "influxdb/rails/version"
4+
5+
Gem::Specification.new do |s|
6+
s.name = "influxdb-rails"
7+
s.version = InfluxDB::Rails::VERSION
8+
s.authors = ["Todd Persen"]
9+
s.email = ["[email protected]"]
10+
s.homepage = "http://influxdb.com"
11+
s.summary = %q{InfluxDB bindings for Ruby on Rails.}
12+
s.description = %q{This gem automatically instruments your Ruby on Rails 3.x/4.x applications using InfluxDB for storage.}
13+
14+
s.rubyforge_project = "influxdb-rails"
15+
16+
s.files = Dir.glob('**/*')
17+
s.test_files = Dir.glob('test/**/*') + Dir.glob('spec/**/*') + Dir.glob('features/**/*')
18+
s.executables = Dir.glob('bin/**/*').map {|f| File.basename(f)}
19+
s.require_paths = ["lib"]
20+
21+
s.licenses = ['MIT']
22+
23+
s.add_runtime_dependency 'json'
24+
s.add_runtime_dependency 'influxdb'
25+
26+
s.add_development_dependency 'bundler', ['>= 1.0.0']
27+
s.add_development_dependency 'fakeweb', ['>= 0']
28+
s.add_development_dependency 'guard', ['>= 0']
29+
s.add_development_dependency 'guard-rspec', ['>= 0']
30+
s.add_development_dependency 'rake', ['>= 0']
31+
s.add_development_dependency 'rdoc', ['>= 0']
32+
s.add_development_dependency 'rspec', ['>= 0']
33+
s.add_development_dependency 'tzinfo', ['>= 0']
34+
end

0 commit comments

Comments
 (0)