bushido 0.0.20 → 0.0.21

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.
@@ -1,36 +1,29 @@
1
1
  module Bushido
2
2
  class EnvsController < ApplicationController
3
- #GET /bushido/envs/:id
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
- return if ENV["BUSHIDO_KEY"] != params[:key]
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
- if @value != ENV[params[:id]]
25
- format.html{render :layout => false, :text => true, :status => :unprocessable_entity}
26
- format.json{render :status => :unprocessable_entity}
27
- else
28
- puts "omg calling fire method from controller"
29
- Bushido::Hooks.fire(params[:id], {params[:id] => ENV[params[:id]]})
30
- format.html{render :text => true}
31
- format.json{render :json => {params[:id] => ENV[params[:id]]}}
32
- end
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
@@ -1,4 +1,4 @@
1
1
  module Bushido
2
2
  # Current version of the Bushido gem
3
- VERSION = "0.0.20"
3
+ VERSION = "0.0.21"
4
4
  end
data/lib/rails/routes.rb CHANGED
@@ -4,7 +4,7 @@ module ActionDispatch::Routing
4
4
  def bushido_routes
5
5
  Rails.application.routes.draw do
6
6
  namespace 'bushido' do
7
- resources :envs, :only => [ :update, :show ]
7
+ resources :envs, :only => [ :update ]
8
8
  end
9
9
  end
10
10
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: bushido
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.20
5
+ version: 0.0.21
6
6
  platform: ruby
7
7
  authors:
8
8
  - Sean Grove