deploytracking 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,4 @@
1
+ pkg/*
2
+ *.gem
3
+ .bundle
4
+ .yardoc
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format documentation
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in deploytracking.gemspec
4
+ gemspec
5
+
6
+ gem 'rspec'
7
+ gem 'fakeweb'
@@ -0,0 +1,26 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ deploytracking (0.0.8)
5
+
6
+ GEM
7
+ remote: http://rubygems.org/
8
+ specs:
9
+ diff-lcs (1.1.2)
10
+ fakeweb (1.3.0)
11
+ rspec (2.5.0)
12
+ rspec-core (~> 2.5.0)
13
+ rspec-expectations (~> 2.5.0)
14
+ rspec-mocks (~> 2.5.0)
15
+ rspec-core (2.5.1)
16
+ rspec-expectations (2.5.0)
17
+ diff-lcs (~> 1.1.2)
18
+ rspec-mocks (2.5.0)
19
+
20
+ PLATFORMS
21
+ ruby
22
+
23
+ DEPENDENCIES
24
+ deploytracking!
25
+ fakeweb
26
+ rspec
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Andrew Nesbitt
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,37 @@
1
+ Deploy Tracker
2
+ ==============
3
+
4
+ Capistrano plugin for <http://deploytracking.com>
5
+
6
+ Install
7
+ ---------------
8
+
9
+ In your Gemfile add:
10
+
11
+ gem 'deploytracking'
12
+
13
+ Place the following line at the bottom config/deploy.rb:
14
+
15
+ set :deploy_tracking_api_key, 'YOURAPIKEY'
16
+ require 'deploytracking/capistrano'
17
+
18
+ Then run:
19
+
20
+ bundle install
21
+
22
+ Note on Patches/Pull Requests
23
+ -----------------------------
24
+
25
+ * Fork the project.
26
+ * Make your feature addition or bug fix.
27
+ * Add tests for it. This is important so I don't break it in a
28
+ future version unintentionally.
29
+ * Commit, do not mess with rakefile, version, or history.
30
+ (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
31
+ * Send me a pull request. Bonus points for topic branches.
32
+
33
+ Copyright
34
+ ---------
35
+
36
+
37
+ Copyright (c) 2011 Andrew Nesbitt. See LICENSE for details.
@@ -0,0 +1,8 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
3
+
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new('spec')
7
+
8
+ task :default => :spec
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "deploytracking/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "deploytracking"
7
+ s.version = DeployTracking::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Andrew Nesbitt"]
10
+ s.email = ["andrewnez@gmail.com"]
11
+ s.homepage = "http://deploytracking.com"
12
+ s.summary = %q{Track deployments to deploytracking.com}
13
+ s.description = %q{Keep a record of all your deployments with interesting stats and history of all deployments with capistrano}
14
+
15
+ s.files = `git ls-files`.split("\n")
16
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
+ s.require_paths = ["lib"]
19
+ end
@@ -0,0 +1,37 @@
1
+ require 'net/https'
2
+ require 'deploytracking/version'
3
+
4
+ module DeployTracking
5
+
6
+ # Send data via a secure socket
7
+ USE_SSL = true
8
+
9
+ # The domain name of the deploytracking web app
10
+ DEPLOY_TRACKING_HOST = 'deploytracking.heroku.com'
11
+
12
+ # The relative end point of the service
13
+ DEPLOY_TRACKING_PATH = '/deploys'
14
+
15
+ # SSL port number that the service is available on
16
+ DEPLOY_TRACKING_PORT = 443
17
+
18
+ # Notify the deploytracking webservice of a new deployment
19
+ # with a payload of data from capistrano.
20
+ def self.notify(api_key, data)
21
+ puts "[DeployTracking] Tracking Deployment to #{DEPLOY_TRACKING_HOST}"
22
+
23
+ params = {'api_key' => api_key, 'deploy["gem_version"]' => DeployTracking::VERSION}
24
+ data.each {|k,v| params["deploy[#{k}]"] = v }
25
+
26
+ http = Net::HTTP.new(DEPLOY_TRACKING_HOST, DEPLOY_TRACKING_PORT)
27
+ http.use_ssl = USE_SSL
28
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
29
+ request = Net::HTTP::Post.new(DEPLOY_TRACKING_PATH)
30
+ request.set_form_data(params)
31
+ response = http.request(request)
32
+
33
+ throw "[DeployTracking] Error posting to server." unless response.is_a?(Net::HTTPSuccess)
34
+ puts "[DeployTracking] Deployment tracked"
35
+ return response
36
+ end
37
+ end
@@ -0,0 +1,21 @@
1
+ require 'deploytracking'
2
+ Capistrano::Configuration.instance(:must_exist).load do
3
+ after "deploy", "deploy:track"
4
+ after "deploy:migrations", "deploy:track"
5
+
6
+ namespace :deploy do
7
+ desc "Send deployment to deploytracker.com"
8
+ task :track, :except => { :no_release => true } do
9
+ data = {}
10
+ data['user_email'] = fetch(:email, `git config --get user.email`.chomp)
11
+ data['github_username'] = fetch(:github_username, `git config --get github.user`.chomp)
12
+ data['environment'] = fetch(:rails_env, "production")
13
+ data['revision'] = fetch(:current_revision)
14
+ data['repository'] = fetch(:repository)
15
+ data['source'] = fetch(:deploy_source, 'capistrano')
16
+ data['branch'] = fetch(:branch, 'master')
17
+
18
+ DeployTracking.notify(fetch(:deploy_tracking_api_key), data)
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,3 @@
1
+ module DeployTracking
2
+ VERSION = "0.0.8"
3
+ end
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+ describe DeployTracking do
3
+ describe "notify" do
4
+ before(:each) do
5
+ FakeWeb.register_uri(:any, "https://deploytracking.heroku.com/deploys", :body => "response for any HTTP method")
6
+ end
7
+ it "should post to deploytracking.com" do
8
+ DeployTracking.notify('api_key', {}).should be_true
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,4 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+ require 'deploytracking'
4
+ require 'fakeweb'
metadata ADDED
@@ -0,0 +1,81 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: deploytracking
3
+ version: !ruby/object:Gem::Version
4
+ hash: 15
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 8
10
+ version: 0.0.8
11
+ platform: ruby
12
+ authors:
13
+ - Andrew Nesbitt
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-02-24 00:00:00 +00:00
19
+ default_executable:
20
+ dependencies: []
21
+
22
+ description: Keep a record of all your deployments with interesting stats and history of all deployments with capistrano
23
+ email:
24
+ - andrewnez@gmail.com
25
+ executables: []
26
+
27
+ extensions: []
28
+
29
+ extra_rdoc_files: []
30
+
31
+ files:
32
+ - .gitignore
33
+ - .rspec
34
+ - Gemfile
35
+ - Gemfile.lock
36
+ - LICENSE
37
+ - README.markdown
38
+ - Rakefile
39
+ - deploytracking.gemspec
40
+ - lib/deploytracking.rb
41
+ - lib/deploytracking/capistrano.rb
42
+ - lib/deploytracking/version.rb
43
+ - spec/notify_spec.rb
44
+ - spec/spec_helper.rb
45
+ has_rdoc: true
46
+ homepage: http://deploytracking.com
47
+ licenses: []
48
+
49
+ post_install_message:
50
+ rdoc_options: []
51
+
52
+ require_paths:
53
+ - lib
54
+ required_ruby_version: !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ hash: 3
60
+ segments:
61
+ - 0
62
+ version: "0"
63
+ required_rubygems_version: !ruby/object:Gem::Requirement
64
+ none: false
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ hash: 3
69
+ segments:
70
+ - 0
71
+ version: "0"
72
+ requirements: []
73
+
74
+ rubyforge_project:
75
+ rubygems_version: 1.3.7
76
+ signing_key:
77
+ specification_version: 3
78
+ summary: Track deployments to deploytracking.com
79
+ test_files:
80
+ - spec/notify_spec.rb
81
+ - spec/spec_helper.rb