bushido 0.0.25 → 0.0.26
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/app/controllers/bushido/data_controller.rb +5 -5
- data/lib/bushido/data.rb +5 -5
- data/lib/bushido/envs.rb +5 -5
- data/lib/bushido/version.rb +1 -1
- metadata +4 -4
@@ -3,20 +3,20 @@ module Bushido
|
|
3
3
|
# PUT /bushido/data/
|
4
4
|
def index
|
5
5
|
@key = params.delete(:key)
|
6
|
-
if ENV["
|
6
|
+
if ENV["BUSHIDO_APP_KEY"] != @key
|
7
7
|
respond_to do |format|
|
8
8
|
format.html { render :layout => false, :text => true, :status => :forbidden }
|
9
|
-
format.json { render :status =>
|
9
|
+
format.json { render :status => 401 }
|
10
10
|
return
|
11
11
|
end
|
12
|
+
end
|
12
13
|
|
13
14
|
puts "OMG GOT DATA FROM BUSHIBUS"
|
14
15
|
puts params.inspect
|
15
|
-
Bushido::Data.fire(params)
|
16
|
+
Bushido::Data.fire('global', params)
|
16
17
|
respond_to do |format|
|
17
|
-
format.json {render :json =>{'acknowledged' => true} :status => 200}
|
18
|
+
format.json {render :json => {'acknowledged' => true}, :status => 200}
|
18
19
|
end
|
19
|
-
end
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
data/lib/bushido/data.rb
CHANGED
@@ -4,20 +4,20 @@ module Bushido
|
|
4
4
|
@@hooks = {}
|
5
5
|
|
6
6
|
class << self
|
7
|
-
def fire *hooks
|
7
|
+
def fire(data, *hooks)
|
8
8
|
unless @@hooks[:global].nil?
|
9
|
-
@@hooks[:global].call('global'
|
9
|
+
@@hooks[:global].call(data, 'global')
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
if hooks.length > 0
|
13
13
|
hooks.each do |h|
|
14
14
|
unless @@hooks[h].nil?
|
15
|
-
@@hooks[h].call(
|
15
|
+
@@hooks[h].call(data, hook)
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
def listen *hooks, &block
|
22
22
|
if hooks.empty? and block_given?
|
23
23
|
@@hooks[:global] = block
|
data/lib/bushido/envs.rb
CHANGED
@@ -4,20 +4,20 @@ module Bushido
|
|
4
4
|
@@hooks = {}
|
5
5
|
|
6
6
|
class << self
|
7
|
-
def fire *hooks
|
7
|
+
def fire(data, *hooks)
|
8
8
|
unless @@hooks[:global].nil?
|
9
|
-
@@hooks[:global].call('global')
|
9
|
+
@@hooks[:global].call(data, 'global')
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
if hooks.length > 0
|
13
13
|
hooks.each do |h|
|
14
14
|
unless @@hooks[h].nil?
|
15
|
-
@@hooks[h].call(
|
15
|
+
@@hooks[h].call(data, hook)
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
def listen *hooks, &block
|
22
22
|
if hooks.empty? and block_given?
|
23
23
|
@@hooks[:global] = block
|
data/lib/bushido/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bushido
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 43
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 26
|
10
|
+
version: 0.0.26
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Sean Grove
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-06-
|
19
|
+
date: 2011-06-17 00:00:00 -07:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|