bushido 0.0.20 → 0.0.21
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/bushido/envs_controller.rb +22 -29
- data/lib/bushido/version.rb +1 -1
- data/lib/rails/routes.rb +1 -1
- metadata +1 -1
@@ -1,36 +1,29 @@
|
|
1
1
|
module Bushido
|
2
2
|
class EnvsController < ApplicationController
|
3
|
-
#
|
4
|
-
def show
|
5
|
-
@value = ENV[params[:id]]
|
6
|
-
respond_to do |format|
|
7
|
-
if @value.nil?
|
8
|
-
format.html{render :file => "#{Rails.root}/public/404.html", :status => :not_found}
|
9
|
-
format.json{render :status => :not_found}
|
10
|
-
else
|
11
|
-
format.html{render :text => @value}
|
12
|
-
format.json{render :json => {params[:id] => ENV[params[:id]]}}
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
#PUT /bushido/envs/:id
|
3
|
+
# PUT /bushido/envs/:id
|
18
4
|
def update
|
19
|
-
|
20
|
-
ENV[params[:id]] = params[:v]
|
21
|
-
@value = ENV[params[:id]]
|
22
|
-
|
5
|
+
if ENV["BUSHIDO_KEY"] != params[:key] or params[:id] == "BUSHIDO_KEY"
|
23
6
|
respond_to do |format|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
7
|
+
format.html { render :layout => false, :text => true, :status => :forbidden }
|
8
|
+
format.json { render :status => :unprocessable_entity }
|
9
|
+
return
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
ENV[params[:id]] = params[:value]
|
14
|
+
@value = ENV[params[:id]]
|
15
|
+
|
16
|
+
respond_to do |format|
|
17
|
+
if @value != ENV[params[:id]]
|
18
|
+
format.html{render :layout => false, :text => true, :status => :unprocessable_entity}
|
19
|
+
format.json{render :status => :unprocessable_entity}
|
20
|
+
else
|
21
|
+
puts "Firing update hooks method from controller"
|
22
|
+
Bushido::Hooks.fire(params[:id], {params[:id] => ENV[params[:id]]})
|
23
|
+
format.html{render :text => true}
|
24
|
+
format.json{render :json => {params[:id] => ENV[params[:id]]}}
|
33
25
|
end
|
26
|
+
end
|
34
27
|
end
|
35
28
|
end
|
36
|
-
end
|
29
|
+
end
|
data/lib/bushido/version.rb
CHANGED
data/lib/rails/routes.rb
CHANGED