small updates and stuff
This commit is contained in:
parent
d71082bc8b
commit
e4fb2c8638
3
Gemfile
3
Gemfile
@ -1,7 +1,6 @@
|
||||
source :rubygems
|
||||
|
||||
gem 'ruby-avm-library', :git => 'git://github.com/johnbintz/ruby-avm-library.git'
|
||||
#gem 'ruby-avm-library', :path => '../ruby-avm-library'
|
||||
gem 'sinatra'
|
||||
gem 'haml'
|
||||
gem 'sinatra-flash'
|
||||
@ -14,5 +13,7 @@ group :development do
|
||||
gem 'autotest'
|
||||
gem 'rspec'
|
||||
gem 'capybara', :git => 'git://github.com/jnicklas/capybara.git'
|
||||
gem 'capybara-zombie', :git => 'https://github.com/plataformatec/capybara-zombie.git'
|
||||
gem 'yajl-ruby'
|
||||
end
|
||||
|
||||
|
17
Gemfile.lock
17
Gemfile.lock
@ -12,12 +12,21 @@ GIT
|
||||
|
||||
GIT
|
||||
remote: git://github.com/johnbintz/ruby-avm-library.git
|
||||
revision: b703ee1a550c8640fca5f2667c2883cb5f31c5f1
|
||||
revision: 864b3c2417cb61d52dc9299f1750024285504768
|
||||
specs:
|
||||
ruby-avm-library (0.0.1)
|
||||
ruby-avm-library (0.0.2)
|
||||
nokogiri
|
||||
thor
|
||||
|
||||
GIT
|
||||
remote: https://github.com/plataformatec/capybara-zombie.git
|
||||
revision: a94e87adc7bfe1dc537b457a1b3bb14ab90abe91
|
||||
specs:
|
||||
capybara-zombie (0.0.1)
|
||||
capybara (~> 0.4.1)
|
||||
childprocess (~> 0.1.7)
|
||||
multi_json (~> 0.0.5)
|
||||
|
||||
GEM
|
||||
remote: http://rubygems.org/
|
||||
specs:
|
||||
@ -34,6 +43,7 @@ GEM
|
||||
json_pure (1.5.1)
|
||||
mime-types (1.16)
|
||||
mocha (0.9.12)
|
||||
multi_json (0.0.5)
|
||||
nokogiri (1.4.4)
|
||||
rack (1.2.2)
|
||||
rack-test (0.5.7)
|
||||
@ -66,6 +76,7 @@ GEM
|
||||
tilt (1.2.2)
|
||||
xpath (0.1.3)
|
||||
nokogiri (~> 1.3)
|
||||
yajl-ruby (0.7.7)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
@ -73,6 +84,7 @@ PLATFORMS
|
||||
DEPENDENCIES
|
||||
autotest
|
||||
capybara!
|
||||
capybara-zombie!
|
||||
coderay
|
||||
haml
|
||||
mocha
|
||||
@ -82,3 +94,4 @@ DEPENDENCIES
|
||||
sinatra
|
||||
sinatra-content-for
|
||||
sinatra-flash
|
||||
yajl-ruby
|
||||
|
@ -6,6 +6,7 @@ Bundler.require
|
||||
$: << File.expand_path("lib")
|
||||
|
||||
require 'avm_example'
|
||||
require 'haml'
|
||||
|
||||
run AVMExample.new
|
||||
|
||||
|
@ -4,6 +4,7 @@ require 'sinatra/content_for'
|
||||
require 'avm/image'
|
||||
require 'coderay'
|
||||
require 'pp'
|
||||
require 'base64'
|
||||
|
||||
class AVMExample < Sinatra::Base
|
||||
use Rack::Session::Cookie, :key => 'avm.session',
|
||||
@ -36,8 +37,13 @@ class AVMExample < Sinatra::Base
|
||||
post '/upload' do
|
||||
redirect_with_warn("No file provided!") if !uploaded?
|
||||
|
||||
data = params[:file][:tempfile].read
|
||||
if settings.environment == :test
|
||||
data = Base64.decode64(data)
|
||||
end
|
||||
|
||||
begin
|
||||
@image = AVM::Image.from_xml(params[:file][:tempfile].read)
|
||||
@image = AVM::Image.from_xml(data)
|
||||
redirect_with_warn("Bad XMP file!") if !@image.valid?
|
||||
rescue StandardError => e
|
||||
redirect_with_warn("Error reading XMP file!")
|
||||
|
@ -1,5 +1,10 @@
|
||||
require 'mocha'
|
||||
require 'capybara/rspec'
|
||||
require 'capybara/zombie'
|
||||
|
||||
Capybara.default_driver = :zombie
|
||||
|
||||
ENV['RACK_ENV'] = 'test'
|
||||
|
||||
RSpec.configure do |config|
|
||||
config.mock_with :mocha
|
||||
|
Loading…
Reference in New Issue
Block a user