fog-bouncer 0.0.8 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore CHANGED
@@ -6,7 +6,6 @@
6
6
  .yardoc
7
7
  Gemfile.lock
8
8
  InstalledFiles
9
- Makefile
10
9
  _yardoc
11
10
  coverage
12
11
  doc/
data/.travis.yml ADDED
@@ -0,0 +1,11 @@
1
+ env: NO_SIMPLECOV=true
2
+
3
+ language: ruby
4
+
5
+ rvm:
6
+ - 1.9.2
7
+ - 1.9.3
8
+ - jruby-19mode
9
+ - rbx-19mode
10
+
11
+ script: bundle exec rake test --trace
data/Makefile ADDED
@@ -0,0 +1,26 @@
1
+ VERSION=$(shell ruby -r./lib/fog/bouncer/version -e "puts Fog::Bouncer::VERSION")
2
+
3
+ # default the projcet name to the directory name
4
+ PROJECT?=$(notdir $(PWD))
5
+ GEM=$(PROJECT)-$(VERSION).gem
6
+
7
+ .PHONY: test
8
+ test:
9
+ bundle exec rake test
10
+
11
+ .PHONY: package
12
+ package: $(GEM)
13
+
14
+ # Always build the gem
15
+ .PHONY: $(GEM)
16
+ $(GEM):
17
+ gem build $(PROJECT).gemspec
18
+
19
+ .PHONY: install
20
+ install: $(GEM)
21
+ gem install $<
22
+
23
+ # Publish to gemgate
24
+ .PHONY: publish
25
+ publish: $(GEM)
26
+ gem push $(GEM)
data/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ![fog-bouncer](https://github.com/dylanegan/fog-bouncer/raw/master/bouncer.jpg)
4
4
 
5
+ [![Build Status](https://secure.travis-ci.org/dylanegan/fog-bouncer.png?branch=master)](http://travis-ci.org/dylanegan/fog-bouncer)
6
+
5
7
  A simple way to define and manage security groups for AWS with the backing support from fog.
6
8
 
7
9
  ## Usage
data/fog-bouncer.gemspec CHANGED
@@ -16,8 +16,9 @@ Gem::Specification.new do |gem|
16
16
  gem.version = Fog::Bouncer::VERSION
17
17
 
18
18
  gem.add_dependency "clamp", "~> 0.3.0"
19
- gem.add_dependency "fog", "~> 1.2.0"
19
+ gem.add_dependency "fog", "~> 1.2"
20
20
  gem.add_dependency "ipaddress", "~> 0.8.0"
21
+ gem.add_dependency "jruby-openssl", "~> 0.7.6" if RUBY_PLATFORM == "java"
21
22
  gem.add_dependency "rake"
22
23
  gem.add_dependency "scrolls", "~> 0.0.5"
23
24
 
data/lib/fog/bouncer.rb CHANGED
@@ -13,14 +13,38 @@ require "scrolls"
13
13
 
14
14
  module Fog
15
15
  module Bouncer
16
+ # Public: An AWS account ID
17
+ #
18
+ # Example
19
+ #
20
+ # Fog::Bouncer.aws_account_id
21
+ # # => "1234567890"
22
+ #
23
+ # Returns a String
16
24
  def self.aws_account_id
17
25
  ENV['AWS_ACCOUNT_ID']
18
26
  end
19
27
 
28
+ # Public: The available doorlists
29
+ #
30
+ # Example
31
+ #
32
+ # Fog::Bouncer.doorlists
33
+ # # => { :doorlist => Fog::Bouncer::Security }
34
+ #
35
+ # Returns a Hash
20
36
  def self.doorlists
21
37
  @doorlists ||= {}
22
38
  end
23
39
 
40
+ # Public: An establised fog AWS compute connection
41
+ #
42
+ # Example
43
+ #
44
+ # Fog::Bouncer.fog
45
+ # # => Fog::AWS::Compute
46
+ #
47
+ # Returns a Fog::AWS::Compute object
24
48
  def self.fog
25
49
  @fog ||= Fog::Compute.new(
26
50
  :provider => "AWS",
@@ -30,28 +54,64 @@ module Fog
30
54
  )
31
55
  end
32
56
 
57
+ # Public: Log data through Scrolls
58
+ #
59
+ # Example
60
+ #
61
+ # Fog::Bouncer.log(data_one: true, data_two: true)
62
+ #
63
+ # Returns nothing
33
64
  def self.log(data, &block)
34
65
  log! unless logging?
35
66
  Scrolls.log({ 'fog-bouncer' => true, 'pretending' => pretending? }.merge(data), &block)
36
67
  end
37
68
 
69
+ # Public: Start the Scrolls logger
70
+ #
71
+ # Example
72
+ #
73
+ # Fog::Bouncer.log!
74
+ #
75
+ # Returns nothing
38
76
  def self.log!
39
77
  Scrolls::Log.start(logger)
40
78
  @logging = true
41
79
  end
42
80
 
81
+ # Public: The logging location
82
+ #
83
+ # Returns an Object
43
84
  def self.logger
44
85
  @logger ||= STDOUT
45
86
  end
46
87
 
88
+ # Public: Set the logging location
89
+ #
90
+ # Returns nothing
47
91
  def self.logger=(logger)
48
92
  @logger = logger
49
93
  end
50
94
 
95
+ # Public: Check the logging state
96
+ #
97
+ # Example
98
+ #
99
+ # Fog::Bouncer.logging?
100
+ # # => true
101
+ #
102
+ # Returns false or true if logging has been started
51
103
  def self.logging?
52
104
  @logging ||= false
53
105
  end
54
106
 
107
+ # Public: Load a file for evaluation
108
+ #
109
+ # Example
110
+ #
111
+ # Fog::Bouncer.load('/tmp/doorlist.rb')
112
+ # # => Fog::Bouncer::Security
113
+ #
114
+ # Returns a Fog::Bouncer::Security object
55
115
  def self.load(file)
56
116
  if file && File.exists?(file)
57
117
  Fog::Bouncer.log(load: true, file: file) do
@@ -60,32 +120,68 @@ module Fog
60
120
  end
61
121
  end
62
122
 
63
- def self.pretend(&block)
64
- if block_given?
65
- @pretend = true
66
- yield
67
- @pretend = false
68
- else
69
- @pretend ||= false
70
- end
123
+ # Public: Check the pretend state
124
+ #
125
+ # Returns false or true if pretending
126
+ def self.pretend
127
+ @pretend ||= false
128
+ end
129
+
130
+ # Public: Pretend while evaluating the given block
131
+ #
132
+ # Example
133
+ #
134
+ # Fog::Bouncer.while_pretending do
135
+ # ...
136
+ # end
137
+ #
138
+ # Returns nothing
139
+ def self.while_pretending(&block)
140
+ @pretend = true
141
+ yield
142
+ @pretend = false
71
143
  end
72
144
 
145
+ # Public: Set the pretend state
146
+ #
147
+ # Returns the given state
73
148
  def self.pretend=(value)
74
149
  @pretend = value
75
150
  end
76
151
 
152
+ # Public: Start pretending
153
+ #
154
+ # Returns true
77
155
  def self.pretend!
78
156
  @pretend = true
79
157
  end
80
158
 
159
+ # Public: Evaluate the pretend state
160
+ #
161
+ # Returns true if pretending or false if not
81
162
  def self.pretending?
82
163
  !!pretend
83
164
  end
84
165
 
166
+ # Public: Empty the doorlists
167
+ #
168
+ # Returns an empty Hash
85
169
  def self.reset
86
170
  @doorlists = {}
87
171
  end
88
172
 
173
+ # Public: Create a doorlist
174
+ #
175
+ # Example
176
+ #
177
+ # Fog::Bouncer.security :private do
178
+ # group "name", "description" do
179
+ # ...
180
+ # end
181
+ # end
182
+ # # => Fog::Bouncer::Security
183
+ #
184
+ # Returns a Fog::Bouncer::Security object
89
185
  def self.security(name, &block)
90
186
  Fog::Bouncer.log(security: true, name: name) do
91
187
  doorlists[name] = Fog::Bouncer::Security.new(name, &block)
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module Bouncer
3
- VERSION = "0.0.8"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
data/spec/helper.rb CHANGED
@@ -1,4 +1,4 @@
1
- require "simplecov"
1
+ require "simplecov" unless ENV['NO_SIMPLECOV']
2
2
  require 'minitest/autorun'
3
3
 
4
4
  ENV['AWS_ACCESS_KEY_ID'] ||= "abcde1234"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fog-bouncer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-18 00:00:00.000000000 Z
12
+ date: 2012-04-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: clamp
@@ -34,7 +34,7 @@ dependencies:
34
34
  requirements:
35
35
  - - ~>
36
36
  - !ruby/object:Gem::Version
37
- version: 1.2.0
37
+ version: '1.2'
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
@@ -42,7 +42,7 @@ dependencies:
42
42
  requirements:
43
43
  - - ~>
44
44
  - !ruby/object:Gem::Version
45
- version: 1.2.0
45
+ version: '1.2'
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: ipaddress
48
48
  requirement: !ruby/object:Gem::Requirement
@@ -118,7 +118,9 @@ extra_rdoc_files: []
118
118
  files:
119
119
  - .gitignore
120
120
  - .simplecov
121
+ - .travis.yml
121
122
  - Gemfile
123
+ - Makefile
122
124
  - README.md
123
125
  - Rakefile
124
126
  - bin/fog-bouncer