blazing-passenger 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,5 +1,4 @@
1
1
  source "http://rubygems.org"
2
-
3
2
  # Specify your gem's dependencies in blazing-passenger.gemspec
4
3
  gemspec
5
4
 
@@ -7,7 +6,7 @@ gem 'rake', '0.8.7'
7
6
  gem 'rspec'
8
7
  gem 'ruby-debug19', :platforms => :ruby_19
9
8
  gem 'ruby-debug', :platforms => :ruby_18
10
- gem 'guard' , '0.4.0.rc'
9
+ gem 'guard'
11
10
  gem 'guard-rspec'
12
11
  gem 'growl'
13
12
  gem 'simplecov', '>= 0.4.0', :require => false, :group => :test, :platforms => :ruby_19
data/MIT-LICENCE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Felipe Kaufmann
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.
data/README.md ADDED
@@ -0,0 +1,25 @@
1
+ # Blazing Passenger
2
+
3
+ Passenger related recipes for [blazing](http://github.com/effkay/blazing)
4
+
5
+ ## Installation
6
+
7
+ Add `gem 'blazing-passenger'` to your `Gemfile`
8
+
9
+ ## Usage
10
+
11
+ Enable the recipes you want in your blazing configuration file:
12
+
13
+ * `recipe :passenger_restart` will touch tmp/restart.txt so passenger gets restarted after a deployment
14
+
15
+ * `recipe :passenger_kcikstart <URL>` will make a GET request on the given URL to kickstart passenger. Note: you must priovide the full URL including protocol (http/https...)
16
+
17
+ ## Authors
18
+
19
+ Felipe Kaufmann ([@effkay][])
20
+
21
+ ## License
22
+
23
+ See the [MIT-LICENSE file](https://github.com/effkay/blazing/blob/master/MIT-LICENCE)
24
+
25
+ [@effkay]: https://github.com/effkay
@@ -18,5 +18,6 @@ Gem::Specification.new do |s|
18
18
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
19
  s.require_paths = ["lib"]
20
20
 
21
+ s.add_dependency "blazing", '>= 0.2.0'
21
22
  s.add_dependency "httparty"
22
23
  end
@@ -1,16 +1,19 @@
1
1
  require 'httparty'
2
+ require 'blazing/recipe'
2
3
 
3
4
  class Blazing::Recipe::PassengerKickstart < Blazing::Recipe
4
5
 
5
- def run
6
- if options[:url]
7
- info "Kickstarting #{options[:url]}"
8
- HTTParty.get(options[:url])
6
+ def run(target_options = {})
7
+ super target_options
8
+
9
+ if @options && @options.has_key?(:url)
10
+ info "Kickstarting #{@options[:url]}"
11
+ HTTParty.get(@options[:url])
9
12
  else
10
13
  error "No URL was specified for Passenger Kickstart"
11
14
  end
12
15
  rescue
13
- error "Unable to perform a GET request on #{options[:url]}"
16
+ error "Unable to perform a GET request on #{@options[:url]}"
14
17
  end
15
18
 
16
19
  end
@@ -1,6 +1,9 @@
1
+ require 'blazing/recipe'
2
+
1
3
  class Blazing::Recipe::PassengerRestart < Blazing::Recipe
2
4
 
3
- def run
5
+ def run(target_options = {})
6
+ super target_options
4
7
  info 'Restarting passenger'
5
8
  Dir.mkdir('tmp') unless File.exists? 'tmp'
6
9
  system 'touch tmp/restart.txt'
@@ -1,5 +1,5 @@
1
1
  module Blazing
2
2
  module Passenger
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
@@ -0,0 +1,37 @@
1
+ require 'blazing-passenger/recipes/passenger_kickstart'
2
+
3
+ describe Blazing::Recipe::PassengerKickstart do
4
+
5
+ it 'is a blazing recipe' do
6
+ Blazing::Recipe::PassengerKickstart.superclass.should be Blazing::Recipe
7
+ end
8
+
9
+ describe 'run' do
10
+
11
+ before :each do
12
+ @recipe = Blazing::Recipe::PassengerKickstart.new
13
+ @recipe.stub(:info)
14
+ end
15
+
16
+ it 'logs an error message if no url was provided' do
17
+ @recipe.should_receive(:error)
18
+ @recipe.run
19
+ end
20
+
21
+ it 'performs a get request if the url was provided' do
22
+ url = 'http://www.google.com'
23
+ @recipe.instance_variable_set('@options', { :url => url })
24
+ HTTParty.should_receive(:get).with(url)
25
+ @recipe.run
26
+ end
27
+
28
+ it 'logs an error message if the url is invalid' do
29
+ url = 'blah'
30
+ @recipe.should_receive(:error).with("Unable to perform a GET request on #{url}")
31
+ @recipe.instance_variable_set('@options', { :url => url })
32
+ @recipe.run
33
+ end
34
+
35
+ end
36
+
37
+ end
@@ -0,0 +1,23 @@
1
+ require 'blazing-passenger/recipes/passenger_restart'
2
+
3
+ describe Blazing::Recipe::PassengerRestart do
4
+
5
+ it 'is a blazing recipe' do
6
+ Blazing::Recipe::PassengerRestart.superclass.should be Blazing::Recipe
7
+ end
8
+
9
+ describe 'run' do
10
+
11
+ before :each do
12
+ @recipe = Blazing::Recipe::PassengerRestart.new
13
+ @recipe.stub(:info)
14
+ end
15
+
16
+ it 'touches tmp/restart.txt' do
17
+ @recipe.should_receive(:system).with("touch tmp/restart.txt")
18
+ @recipe.run
19
+ end
20
+
21
+ end
22
+
23
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blazing-passenger
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 1
8
+ - 2
9
9
  - 0
10
- version: 0.1.0
10
+ version: 0.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Felipe Kaufmann
@@ -15,10 +15,26 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-10-24 00:00:00 Z
18
+ date: 2011-10-27 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  version_requirements: &id001 !ruby/object:Gem::Requirement
22
+ none: false
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ hash: 23
27
+ segments:
28
+ - 0
29
+ - 2
30
+ - 0
31
+ version: 0.2.0
32
+ prerelease: false
33
+ requirement: *id001
34
+ type: :runtime
35
+ name: blazing
36
+ - !ruby/object:Gem::Dependency
37
+ version_requirements: &id002 !ruby/object:Gem::Requirement
22
38
  none: false
23
39
  requirements:
24
40
  - - ">="
@@ -27,10 +43,10 @@ dependencies:
27
43
  segments:
28
44
  - 0
29
45
  version: "0"
30
- requirement: *id001
31
46
  prerelease: false
32
- name: httparty
47
+ requirement: *id002
33
48
  type: :runtime
49
+ name: httparty
34
50
  description: A collection of blazing recipes for passenger
35
51
  email:
36
52
  - felipekaufmann@gmail.com
@@ -43,12 +59,16 @@ extra_rdoc_files: []
43
59
  files:
44
60
  - .gitignore
45
61
  - Gemfile
62
+ - MIT-LICENCE
63
+ - README.md
46
64
  - Rakefile
47
65
  - blazing-passenger.gemspec
48
66
  - lib/blazing-passenger.rb
49
67
  - lib/blazing-passenger/recipes/passenger_kickstart.rb
50
68
  - lib/blazing-passenger/recipes/passenger_restart.rb
51
69
  - lib/blazing-passenger/version.rb
70
+ - spec/passenger_kickstart_spec.rb
71
+ - spec/passenger_restart_spec.rb
52
72
  homepage: https://github.com/effkay/blazing-passenger
53
73
  licenses: []
54
74
 
@@ -82,5 +102,6 @@ rubygems_version: 1.8.10
82
102
  signing_key:
83
103
  specification_version: 3
84
104
  summary: blazing recipes for passenger
85
- test_files: []
86
-
105
+ test_files:
106
+ - spec/passenger_kickstart_spec.rb
107
+ - spec/passenger_restart_spec.rb