Skip to content

Commit

Permalink
feat: Minor dependencies update | Fix URI.escape bug (#36)
Browse files Browse the repository at this point in the history
* feat: Replace URI with CGI for escaping

* feat: Bump haml version

* feat: Update minimum ruby version

* feat: Update gem version
  • Loading branch information
Lokideos authored Feb 27, 2023
1 parent 4b12aeb commit 7c71984
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion lib/sinatra/stoplight_admin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def red(light)

def with_lights
[*params[:names]]
.map { |l| URI.unescape(l) }
.map { |l| CGI.unescape(l) }
.each { |l| yield(l) }
end
end
Expand Down
10 changes: 5 additions & 5 deletions lib/sinatra/views/index.haml
Original file line number Diff line number Diff line change
Expand Up @@ -36,31 +36,31 @@
%td.indicator
- if l[:color] == GREEN
%form{method: 'post', action: url('/red')}
%input{type: 'hidden', name: 'names', value: URI.escape(l[:name])}
%input{type: 'hidden', name: 'names', value: CGI.escape(l[:name])}
%button{type: 'submit', class: 'btn btn-success'}
G
%span.hidden-xs> REEN
- elsif l[:color] == YELLOW
%form{method: 'post', action: url('/green')}
%input{type: 'hidden', name: 'names', value: URI.escape(l[:name])}
%input{type: 'hidden', name: 'names', value: CGI.escape(l[:name])}
%button{type: 'submit', class: 'btn btn-warning'}
Y
%span.hidden-xs> ELLOW
- else
%form{method: 'post', action: url('/green')}
%input{type: 'hidden', name: 'names', value: URI.escape(l[:name])}
%input{type: 'hidden', name: 'names', value: CGI.escape(l[:name])}
%button{type: 'submit', class: 'btn btn-danger'}
R
%span.hidden-xs> ED
%td.locked
- if l[:locked]
%form{method: 'post', action: url('/unlock')}
%input{type: 'hidden', name: 'names', value: URI.escape(l[:name])}
%input{type: 'hidden', name: 'names', value: CGI.escape(l[:name])}
%button{type: 'submit', class: 'btn btn-link'}
%span{class: 'glyphicon glyphicon-lock'}
- else
%form{method: 'post', action: url('/lock')}
%input{type: 'hidden', name: 'names', value: URI.escape(l[:name])}
%input{type: 'hidden', name: 'names', value: CGI.escape(l[:name])}
%button{type: 'submit', class: 'btn btn-link'}
%span{class: 'glyphicon glyphicon-minus'}
%td.name
Expand Down
14 changes: 7 additions & 7 deletions stoplight-admin.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ $LOAD_PATH.push(lib) unless $LOAD_PATH.include?(lib)

Gem::Specification.new do |gem|
gem.name = 'stoplight-admin'
gem.version = '0.3.5'
gem.version = '0.3.6'
gem.summary = 'A simple administration interface for Stoplight.'
gem.description = gem.summary
gem.homepage = 'https://github.com/bolshakov/stoplight-admin'
Expand All @@ -23,10 +23,10 @@ Gem::Specification.new do |gem|
Dir.glob(File.join('lib', '**', '*.rb')) +
Dir.glob(File.join('lib', '**', '*.haml'))

gem.required_ruby_version = '>= 1.9.3'
gem.required_ruby_version = '>= 2.5.0'

{
'haml' => '5.0.4',
'haml' => '5.0',
'sinatra-contrib' => '2.2.3'
}.each do |name, version|
gem.add_dependency(name, "~> #{version}")
Expand All @@ -36,10 +36,10 @@ Gem::Specification.new do |gem|
gem.add_dependency 'stoplight', '>= 1.4'

{
'bundler' => '1.10',
'pry-byebug' => '3.7.0',
'rake' => '11.1',
'rspec' => '3.8.0'
'bundler' => '2.4',
'pry-byebug' => '3.10.0',
'rake' => '13.0',
'rspec' => '3.12.0'
}.each do |name, version|
gem.add_development_dependency(name, "~> #{version}")
end
Expand Down

0 comments on commit 7c71984

Please sign in to comment.