bushido 0.0.21 → 0.0.25

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.
@@ -0,0 +1,22 @@
1
+ module Bushido
2
+ class DataController < ApplicationController
3
+ # PUT /bushido/data/
4
+ def index
5
+ @key = params.delete(:key)
6
+ if ENV["BUSHIDO_KEY"] != @key
7
+ respond_to do |format|
8
+ format.html { render :layout => false, :text => true, :status => :forbidden }
9
+ format.json { render :status => :unprocessable_entity }
10
+ return
11
+ end
12
+
13
+ puts "OMG GOT DATA FROM BUSHIBUS"
14
+ puts params.inspect
15
+ Bushido::Data.fire(params)
16
+ respond_to do |format|
17
+ format.json {render :json =>{'acknowledged' => true} :status => 200}
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,40 @@
1
+ module Bushido
2
+ class Data #:nodoc:
3
+
4
+ @@hooks = {}
5
+
6
+ class << self
7
+ def fire *hooks, data
8
+ unless @@hooks[:global].nil?
9
+ @@hooks[:global].call('global', data)
10
+ end
11
+
12
+ if hooks.length > 0
13
+ hooks.each do |h|
14
+ unless @@hooks[h].nil?
15
+ @@hooks[h].call(h, data)
16
+ end
17
+ end
18
+ end
19
+ end
20
+
21
+ def listen *hooks, &block
22
+ if hooks.empty? and block_given?
23
+ @@hooks[:global] = block
24
+ elsif !hooks.nil? and block_given?
25
+ hooks.each do |h|
26
+ @@hooks[h] = block
27
+ end
28
+ end
29
+ end
30
+
31
+ def publish(model)
32
+ puts "bushido publishing model"
33
+ puts Bushido::Platform.host
34
+ RestClient.post(Bushido::Platform.host, model.to_json, :content_type => :json, :accept => :json)
35
+ end
36
+
37
+ end
38
+
39
+ end
40
+ end
@@ -1,12 +1,12 @@
1
1
  module Bushido
2
- class Hooks #:nodoc:
2
+ class Envs #:nodoc:
3
3
 
4
4
  @@hooks = {}
5
5
 
6
6
  class << self
7
- def fire *hooks, data
7
+ def fire *hooks
8
8
  unless @@hooks[:global].nil?
9
- @@hooks[:global].call('global', data)
9
+ @@hooks[:global].call('global')
10
10
  end
11
11
 
12
12
  if hooks.length > 0
@@ -1,4 +1,4 @@
1
1
  module Bushido
2
2
  # Current version of the Bushido gem
3
- VERSION = "0.0.21"
3
+ VERSION = "0.0.25"
4
4
  end
data/lib/bushido.rb CHANGED
@@ -12,6 +12,7 @@ module Bushido #:nodoc:
12
12
  require "bushido/user"
13
13
  require "bushido/event"
14
14
  require "bushido/version"
15
- require "bushido/hooks"
15
+ require "bushido/envs"
16
+ require "bushido/data"
16
17
  require "bushido/middleware"
17
18
  end
data/lib/rails/routes.rb CHANGED
@@ -5,6 +5,7 @@ module ActionDispatch::Routing
5
5
  Rails.application.routes.draw do
6
6
  namespace 'bushido' do
7
7
  resources :envs, :only => [ :update ]
8
+ match '/data' => "data#index"
8
9
  end
9
10
  end
10
11
  end
metadata CHANGED
@@ -1,8 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bushido
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.0.21
4
+ hash: 45
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 25
10
+ version: 0.0.25
6
11
  platform: ruby
7
12
  authors:
8
13
  - Sean Grove
@@ -11,7 +16,7 @@ autorequire:
11
16
  bindir: bin
12
17
  cert_chain: []
13
18
 
14
- date: 2011-06-11 00:00:00 -07:00
19
+ date: 2011-06-13 00:00:00 -07:00
15
20
  default_executable:
16
21
  dependencies:
17
22
  - !ruby/object:Gem::Dependency
@@ -22,6 +27,11 @@ dependencies:
22
27
  requirements:
23
28
  - - ">="
24
29
  - !ruby/object:Gem::Version
30
+ hash: 13
31
+ segments:
32
+ - 1
33
+ - 6
34
+ - 1
25
35
  version: 1.6.1
26
36
  type: :runtime
27
37
  version_requirements: *id001
@@ -33,6 +43,11 @@ dependencies:
33
43
  requirements:
34
44
  - - ">="
35
45
  - !ruby/object:Gem::Version
46
+ hash: 11
47
+ segments:
48
+ - 1
49
+ - 4
50
+ - 6
36
51
  version: 1.4.6
37
52
  type: :runtime
38
53
  version_requirements: *id002
@@ -44,6 +59,11 @@ dependencies:
44
59
  requirements:
45
60
  - - ">="
46
61
  - !ruby/object:Gem::Version
62
+ hash: 13
63
+ segments:
64
+ - 1
65
+ - 6
66
+ - 1
47
67
  version: 1.6.1
48
68
  type: :runtime
49
69
  version_requirements: *id003
@@ -61,6 +81,7 @@ files:
61
81
  - .gitignore
62
82
  - Gemfile
63
83
  - Rakefile
84
+ - app/controllers/bushido/data_controller.rb
64
85
  - app/controllers/bushido/envs_controller.rb
65
86
  - bin/bushido
66
87
  - bushido.gemspec
@@ -68,8 +89,9 @@ files:
68
89
  - lib/bushido.rb
69
90
  - lib/bushido/app.rb
70
91
  - lib/bushido/command.rb
92
+ - lib/bushido/data.rb
93
+ - lib/bushido/envs.rb
71
94
  - lib/bushido/event.rb
72
- - lib/bushido/hooks.rb
73
95
  - lib/bushido/middleware.rb
74
96
  - lib/bushido/platform.rb
75
97
  - lib/bushido/user.rb
@@ -93,17 +115,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
93
115
  requirements:
94
116
  - - ">="
95
117
  - !ruby/object:Gem::Version
118
+ hash: 3
119
+ segments:
120
+ - 0
96
121
  version: "0"
97
122
  required_rubygems_version: !ruby/object:Gem::Requirement
98
123
  none: false
99
124
  requirements:
100
125
  - - ">="
101
126
  - !ruby/object:Gem::Version
127
+ hash: 3
128
+ segments:
129
+ - 0
102
130
  version: "0"
103
131
  requirements: []
104
132
 
105
133
  rubyforge_project: bushido
106
- rubygems_version: 1.6.2
134
+ rubygems_version: 1.3.7
107
135
  signing_key:
108
136
  specification_version: 3
109
137
  summary: Bushido integration