initial commit

This commit is contained in:
John Bintz 2011-03-23 14:42:54 -04:00
commit 5f7bc6a403
18 changed files with 680 additions and 0 deletions

6
.autotest Normal file
View File

@ -0,0 +1,6 @@
Autotest.add_hook(:initialize) do |at|
at.add_mapping(%r{views/.*\.haml}, true) do |filename, matches|
[ 'spec/avm_example_spec.rb' ]
end
end

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
.sass-cache

2
.rspec Normal file
View File

@ -0,0 +1,2 @@
-c

18
Gemfile Normal file
View File

@ -0,0 +1,18 @@
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'
gem 'coderay'
gem 'sinatra-content-for'
group :development do
gem 'shotgun'
gem 'mocha'
gem 'autotest'
gem 'rspec'
gem 'capybara', :git => 'git://github.com/jnicklas/capybara.git'
end

83
Gemfile.lock Normal file
View File

@ -0,0 +1,83 @@
GIT
remote: git://github.com/jnicklas/capybara.git
revision: 549e67336c712a1ef2119ce5ff64dbbc7542480f
specs:
capybara (0.4.1.1)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
selenium-webdriver (>= 0.0.27)
xpath (~> 0.1.3)
PATH
remote: ../ruby-avm-library
specs:
ruby-avm-library (0.0.1)
nokogiri
thor
GEM
remote: http://rubygems.org/
specs:
ZenTest (4.5.0)
autotest (4.4.6)
ZenTest (>= 4.4.1)
childprocess (0.1.8)
ffi (~> 1.0.6)
coderay (0.9.7)
diff-lcs (1.1.2)
ffi (1.0.7)
rake (>= 0.8.7)
haml (3.0.25)
json_pure (1.5.1)
mime-types (1.16)
mocha (0.9.12)
nokogiri (1.4.4)
rack (1.2.2)
rack-test (0.5.7)
rack (>= 1.0)
rake (0.8.7)
rspec (2.5.0)
rspec-core (~> 2.5.0)
rspec-expectations (~> 2.5.0)
rspec-mocks (~> 2.5.0)
rspec-core (2.5.1)
rspec-expectations (2.5.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.5.0)
rubyzip (0.9.4)
selenium-webdriver (0.1.4)
childprocess (>= 0.1.7)
ffi (>= 1.0.7)
json_pure
rubyzip
shotgun (0.9)
rack (>= 1.0)
sinatra (1.2.1)
rack (~> 1.1)
tilt (>= 1.2.2, < 2.0)
sinatra-content-for (0.2)
sinatra
sinatra-flash (0.3.0)
sinatra (>= 1.0.0)
thor (0.14.6)
tilt (1.2.2)
xpath (0.1.3)
nokogiri (~> 1.3)
PLATFORMS
ruby
DEPENDENCIES
autotest
capybara!
coderay
haml
mocha
rspec
ruby-avm-library!
shotgun
sinatra
sinatra-content-for
sinatra-flash

1
autotest/discover.rb Normal file
View File

@ -0,0 +1 @@
Autotest.add_discovery { 'rspec2' }

3
config.rb Normal file
View File

@ -0,0 +1,3 @@
http_path = "/"
css_dir = "public"
sass_dir = "sass"

6
config.ru Normal file
View File

@ -0,0 +1,6 @@
$: << File.expand_path("lib")
require 'avm_example'
run AVMExample.new

63
lib/avm_example.rb Normal file
View File

@ -0,0 +1,63 @@
require 'sinatra/base'
require 'sinatra/flash'
require 'sinatra/content_for'
require 'avm/image'
require 'coderay'
require 'pp'
class AVMExample < Sinatra::Base
use Rack::Session::Cookie, :key => 'avm.session',
:path => '/',
:expire_after => 60
register Sinatra::Flash
helpers Sinatra::ContentFor
helpers do
def uploaded?
@is_uploaded ||= ensure_uploaded_xmp
end
def tempfile
ensure_uploaded_xmp
@tempfile
end
def filename
ensure_uploaded_xmp
@filename
end
end
post '/upload' do
redirect_with_warn("No file provided!") if !uploaded?
begin
@image = AVM::Image.from_xml(params[:file][:tempfile].read)
redirect_with_warn("Bad XMP file!") if !@image.valid?
rescue StandardError => e
redirect_with_warn("Error reading XMP file!")
$stderr.puts e.to_s
end
flash[:info] = %{File processed! Data structure is <a href="#data">below</a>.}
haml :print_data
end
get %r{/?} do
haml :index
end
private
def redirect_with_warn(warning)
flash[:warn] = warning
redirect '/'
end
def ensure_uploaded_xmp
return false if !params[:file]
return false if !(@tempfile = params[:file][:tempfile])
return false if !(@filename = params[:file][:filename])
true
end
end

77
public/index.css Normal file
View File

@ -0,0 +1,77 @@
@charset "UTF-8";
/* line 3, ../sass/index.scss */
body {
background-color: #bbb;
}
/* line 7, ../sass/index.scss */
pre {
border: solid #333 1px;
background-color: #222;
padding: 10px;
overflow: auto;
color: #ddd;
}
/* line 14, ../sass/index.scss */
pre .sy {
color: #a40;
}
/* line 15, ../sass/index.scss */
pre .dl {
color: #0c7;
}
/* line 16, ../sass/index.scss */
pre .k {
color: #970;
}
/* line 17, ../sass/index.scss */
pre .co, pre .i {
color: #05c;
}
/* line 18, ../sass/index.scss */
pre .fl {
color: #3c1;
}
/* line 21, ../sass/index.scss */
#container {
width: 30%;
margin: 10% auto;
text-align: center;
border: solid #555 1px;
padding: 50px;
-moz-box-shadow: 0 0 10px 10px #ccccdd;
-webkit-box-shadow: 0 0 10px 10px #ccccdd;
-o-box-shadow: 0 0 10px 10px #ccccdd;
box-shadow: 0 0 10px 10px #ccccdd;
background-color: #f0f0f0;
}
/* line 30, ../sass/index.scss */
#container h2 {
margin: 0 0 10px;
}
/* line 34, ../sass/index.scss */
#container .flash {
border-style: solid;
border-color: #ccc;
border-width: 1px 0;
padding: 3px 0;
}
/* line 42, ../sass/index.scss */
#container .flash#warning {
color: #a00;
font-weight: bold;
}
/* line 47, ../sass/index.scss */
#container .flash#info {
color: #363;
}
/* line 53, ../sass/index.scss */
#footer {
font-size: 80%;
text-align: center;
padding: 10px;
margin-top: 10px;
color: #555;
}

59
sass/index.scss Normal file
View File

@ -0,0 +1,59 @@
@import 'compass/css3';
body {
background-color: #bbb;
}
pre {
border: solid #333 1px;
background-color: #222;
padding: 10px;
overflow: auto;
color: #ddd;
.sy { color: #a40 }
.dl { color: #0c7 }
.k { color: #970 }
.co, .i { color: #05c }
.fl { color: #3c1 }
}
#container {
width: 30%;
margin: 10% auto;
text-align: center;
border: solid #555 1px;
padding: 50px;
@include single-box-shadow(#ccd, 0, 0, 10px, 10px);
background-color: #f0f0f0;
h2 {
margin: 0 0 10px;
}
.flash {
border: {
style: solid;
color: #ccc;
width: 1px 0;
}
padding: 3px 0;
&#warning {
color: #a00;
font-weight: bold;
}
&#info {
color: #363;
}
}
}
#footer {
font-size: 80%;
text-align: center;
padding: 10px;
margin-top: 10px;
color: #555;
}

View File

@ -0,0 +1,53 @@
require 'spec_helper'
require 'avm_example'
describe AVMExample do
before { Capybara.app = self.class.describes }
let(:title) { 'Upload an XMP file' }
describe 'GET "index"' do
it "should return a form" do
visit '/'
page.should have_content(title)
page.should have_xpath('//form[@action="/upload" and @method="post" and @enctype="multipart/form-data"]')
within('form') do
page.should have_selector('input[type="file"][name="file"]')
page.should have_selector('input[type="submit"]')
end
end
end
describe 'POST "upload"' do
before { visit '/' }
context 'no file' do
it "should fail" do
click_button("Upload")
page.should have_content(title)
page.should have_content("No file provided!")
end
end
context 'bad xmp file' do
it "should fail" do
attach_file('file', 'spec/xmp/bad.xmp')
click_button("Upload")
page.should have_content(title)
page.should have_content("Bad XMP file!")
end
end
context 'good xmp file' do
it "should fail" do
attach_file('file', 'spec/xmp/good.xmp')
click_button("Upload")
page.should have_content(title)
page.should have_content("Arp's Loop")
page.should have_content("NASA, ESA, and D.")
end
end
end
end

8
spec/spec_helper.rb Normal file
View File

@ -0,0 +1,8 @@
require 'mocha'
require 'capybara/rspec'
RSpec.configure do |config|
config.mock_with :mocha
config.include Capybara
end

1
spec/xmp/bad.xmp Normal file
View File

@ -0,0 +1 @@
<this <is a ><bad <![CSAdslkfjasdsl;jf alksdjfkl;jasdl;jfklajsdljf a

273
spec/xmp/good.xmp Normal file
View File

@ -0,0 +1,273 @@
<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 4.2.2-c063 53.352624, 2008/07/30-18:05:41 ">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about=""
xmlns:photoshop="http://ns.adobe.com/photoshop/1.0/">
<photoshop:LegacyIPTCDigest>48DFC39DCAA99A18E444091BA6C7B52F</photoshop:LegacyIPTCDigest>
<photoshop:Source>STScI</photoshop:Source>
<photoshop:DateCreated>2008-01-08</photoshop:DateCreated>
<photoshop:Credit>NASA, ESA, and D. de Mello (Catholic University of America and GSFC;NASA, ESA, and the Hubble Heritage Team (STScI/AURA)</photoshop:Credit>
<photoshop:Headline>Arp's Loop, imaged by the Hubble Space Telescope. It is located 12 million light-years away in the constellation Ursa Major.</photoshop:Headline>
<photoshop:History>2007-11-28T13:25:46-05:00&#x9;File M82IsB071127.psd opened&#xA;2007-11-28T13:43:26-05:00&#x9;File M82IsB071127.psd saved&#xA;2007-12-12T12:35:16-05:00&#x9;File M82IsB071127.psd opened&#xA;2007-12-12T14:52:31-05:00&#x9;File M82IsB071212.psd saved&#xA;2007-12-12T16:54:03-05:00&#x9;File M82IsB071212.psd saved&#xA;2007-12-12T17:15:01-05:00&#x9;File BlueBlobs071212flat.psd saved&#xA;2007-12-13T09:43:34-05:00&#x9;File BlueBlobs071212flat.psd opened&#xA;2007-12-13T09:44:33-05:00&#x9;File BlueBlobs16.tif saved&#xA;2007-12-13T14:24:48-05:00&#x9;File BlueBlobs16crop_cln.psd opened&#xA;2007-12-13T14:34:30-05:00&#x9;File BlueBlobs16crop_cln.psd saved&#xA;2007-12-13T14:35:46-05:00&#x9;File p0802a1.tif saved&#xA;2007-12-13T14:40:44-05:00&#x9;File p0802a1.tif saved&#xA;2007-12-13T14:41:28-05:00&#x9;File BlueBlobs071213clean.psd saved&#xA;2007-12-13T14:41:59-05:00&#x9;File p0802a1 opened&#xA;2007-12-13T14:42:28-05:00&#x9;File p0802a1.tif saved&#xA;</photoshop:History>
<photoshop:ColorMode>3</photoshop:ColorMode>
<photoshop:ICCProfile>Adobe RGB (1998)</photoshop:ICCProfile>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:xmp="http://ns.adobe.com/xap/1.0/">
<xmp:CreatorTool>Adobe Photoshop CS5 Macintosh</xmp:CreatorTool>
<xmp:MetadataDate>2011-03-03T14:24:10-05:00</xmp:MetadataDate>
<xmp:ModifyDate>2011-02-16T13:31:55-05:00</xmp:ModifyDate>
<xmp:CreateDate>2007-12-13T14:41:28-05:00</xmp:CreateDate>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/"
xmlns:stRef="http://ns.adobe.com/xap/1.0/sType/ResourceRef#"
xmlns:stEvt="http://ns.adobe.com/xap/1.0/sType/ResourceEvent#">
<xmpMM:DocumentID>uuid:C660B4051BABDC11B13CB5CC852C8B0A</xmpMM:DocumentID>
<xmpMM:InstanceID>xmp.iid:03EF56B1B9206811AFFD8085DBA8F510</xmpMM:InstanceID>
<xmpMM:OriginalDocumentID>uuid:C660B4051BABDC11B13CB5CC852C8B0A</xmpMM:OriginalDocumentID>
<xmpMM:DerivedFrom rdf:parseType="Resource">
<stRef:instanceID>xmp.iid:02EF56B1B9206811AFFD8085DBA8F510</stRef:instanceID>
<stRef:documentID>uuid:C660B4051BABDC11B13CB5CC852C8B0A</stRef:documentID>
<stRef:originalDocumentID>uuid:C660B4051BABDC11B13CB5CC852C8B0A</stRef:originalDocumentID>
</xmpMM:DerivedFrom>
<xmpMM:History>
<rdf:Seq>
<rdf:li rdf:parseType="Resource">
<stEvt:action>saved</stEvt:action>
<stEvt:instanceID>xmp.iid:01EF56B1B9206811AFFD8085DBA8F510</stEvt:instanceID>
<stEvt:when>2011-02-16T13:31:55-05:00</stEvt:when>
<stEvt:softwareAgent>Adobe Photoshop CS5 Macintosh</stEvt:softwareAgent>
<stEvt:changed>/</stEvt:changed>
</rdf:li>
<rdf:li rdf:parseType="Resource">
<stEvt:action>saved</stEvt:action>
<stEvt:instanceID>xmp.iid:02EF56B1B9206811AFFD8085DBA8F510</stEvt:instanceID>
<stEvt:when>2011-02-16T13:31:55-05:00</stEvt:when>
<stEvt:softwareAgent>Adobe Photoshop CS5 Macintosh</stEvt:softwareAgent>
<stEvt:changed>/</stEvt:changed>
</rdf:li>
<rdf:li rdf:parseType="Resource">
<stEvt:action>derived</stEvt:action>
<stEvt:parameters>converted from image/tiff to image/jpeg</stEvt:parameters>
</rdf:li>
<rdf:li rdf:parseType="Resource">
<stEvt:action>saved</stEvt:action>
<stEvt:instanceID>xmp.iid:03EF56B1B9206811AFFD8085DBA8F510</stEvt:instanceID>
<stEvt:when>2011-02-16T13:31:55-05:00</stEvt:when>
<stEvt:softwareAgent>Adobe Photoshop CS5 Macintosh</stEvt:softwareAgent>
<stEvt:changed>/</stEvt:changed>
</rdf:li>
</rdf:Seq>
</xmpMM:History>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:format>image/jpeg</dc:format>
<dc:rights>
<rdf:Alt>
<rdf:li xml:lang="x-default">Public</rdf:li>
</rdf:Alt>
</dc:rights>
<dc:creator>
<rdf:Seq>
<rdf:li>Space Telescope Science Institute Office of Public Outreach</rdf:li>
</rdf:Seq>
</dc:creator>
<dc:description>
<rdf:Alt>
<rdf:li xml:lang="x-default">A Hubble Space Telescope image of an area in the neighborhood of the interacting galaxies, M81 and M82, which lie 12 million light-years away in the constellation Ursa Major. The gravity from each galaxy dramatically affected the other during their last close encounter, 200 million years ago. Gas density waves rippling around M81 make it a grand design spiral. M82 is undergoing a starburst at its core, creating glowing fingers of hydrogen. The visible light Hubble image shows bright blue star clusters found along a wispy bridge of gas that was tidally stretched between the two galaxies, and a third companion galaxy. Turbulence in the normally low-density gas may have enhanced the density locally to trigger starbirth. The so-called "blue blobs" are clumped together in a structure called Arp's Loop. Hubble reveals the clusters contain the equivalent of five Orion Nebulae. Hubble's Advanced Camera for Surveys imaged the region in blue and infrared light in September of 2006.</rdf:li>
</rdf:Alt>
</dc:description>
<dc:subject>
<rdf:Bag>
<rdf:li>Arp's Loop</rdf:li>
<rdf:li>A0952+69</rdf:li>
</rdf:Bag>
</dc:subject>
<dc:title>
<rdf:Alt>
<rdf:li xml:lang="x-default">Hubble View of Arp's Loop</rdf:li>
</rdf:Alt>
</dc:title>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:avm="http://www.communicatingastronomy.org/avm/1.0/">
<avm:MetadataVersion>1.2</avm:MetadataVersion>
<avm:Spatial.CoordsystemProjection>TAN</avm:Spatial.CoordsystemProjection>
<avm:Spatial.Equinox>J2000</avm:Spatial.Equinox>
<avm:Type>Observation</avm:Type>
<avm:Spatial.Quality>Full</avm:Spatial.Quality>
<avm:Spatial.CoordinateFrame>ICRS</avm:Spatial.CoordinateFrame>
<avm:Spatial.Rotation>31.32</avm:Spatial.Rotation>
<avm:PublisherID>vamp://stsci</avm:PublisherID>
<avm:Publisher>STScI</avm:Publisher>
<avm:Image.ProductQuality>Good</avm:Image.ProductQuality>
<avm:Temporal.IntegrationTime>2250;2265</avm:Temporal.IntegrationTime>
<avm:Spectral.Notes>Galaxy &gt; Dwarf;September 22,2006</avm:Spectral.Notes>
<avm:DatasetID>J9RA1B010;J9RA1B020</avm:DatasetID>
<avm:Temporal.StartTime>2006-09-22;2006-09-22</avm:Temporal.StartTime>
<avm:Spectral.CentralWavelength>475;814</avm:Spectral.CentralWavelength>
<avm:Spectral.Bandpass>g;I</avm:Spectral.Bandpass>
<avm:Spectral.Band>Optical;Optical</avm:Spectral.Band>
<avm:Spectral.ColorAssignment>Blue;Red</avm:Spectral.ColorAssignment>
<avm:Instrument>ACS;ACS</avm:Instrument>
<avm:Facility>HST;HST</avm:Facility>
<avm:ProposalID>10915</avm:ProposalID>
<avm:ID>STScI-PRC-2008-02-b</avm:ID>
<avm:ReferenceURL>http://hubblesite.org/newscenter/archive/releases/2008/02/image/b</avm:ReferenceURL>
<avm:Distance.Notes>12 million light-years (3.6 Megaparsecs)</avm:Distance.Notes>
<avm:Distance>3700000</avm:Distance>
<avm:Subject.Category>X.Galaxy &gt; Dwarf</avm:Subject.Category>
<avm:RelatedResources>http://hubblesite.org/newscenter/archive/releases/2008/02</avm:RelatedResources>
<avm:ResourceID>hs-2008-02-b-full-jpg.jpg</avm:ResourceID>
<avm:ResourceURL>http://archive.stsci.edu/pub/stpr/hs-2008-02-b-full-jpg.jpg</avm:ResourceURL>
<avm:MetadataDate>03/03/11</avm:MetadataDate>
<avm:FL.WhiteLevel>
<rdf:Seq>
<rdf:li>2.76212980700322</rdf:li>
</rdf:Seq>
</avm:FL.WhiteLevel>
<avm:FL.BlackLevel>
<rdf:Seq>
<rdf:li>0.00000000000000</rdf:li>
</rdf:Seq>
</avm:FL.BlackLevel>
<avm:FL.ScaledPeakLevel>
<rdf:Seq>
<rdf:li>5.00000000000000</rdf:li>
</rdf:Seq>
</avm:FL.ScaledPeakLevel>
<avm:FL.ScaledBackgroundLevel>
<rdf:Seq>
<rdf:li>0.00000000000000</rdf:li>
</rdf:Seq>
</avm:FL.ScaledBackgroundLevel>
<avm:FL.PeakLevel>
<rdf:Seq>
<rdf:li>500.00000000000000</rdf:li>
</rdf:Seq>
</avm:FL.PeakLevel>
<avm:FL.BackgroundLevel>
<rdf:Seq>
<rdf:li>-41.81356223064012</rdf:li>
</rdf:Seq>
</avm:FL.BackgroundLevel>
<avm:FL.StretchFunction>
<rdf:Seq>
<rdf:li>ArcSinh(x)</rdf:li>
</rdf:Seq>
</avm:FL.StretchFunction>
<avm:Spatial.Scale>
<rdf:Seq>
<rdf:li>1.3902e-05</rdf:li>
<rdf:li>1.3902008e-05</rdf:li>
</rdf:Seq>
</avm:Spatial.Scale>
<avm:Spatial.ReferencePixel>
<rdf:Seq>
<rdf:li>1294.0</rdf:li>
<rdf:li>968.5</rdf:li>
</rdf:Seq>
</avm:Spatial.ReferencePixel>
<avm:Spatial.ReferenceDimension>
<rdf:Seq>
<rdf:li>2586.0</rdf:li>
<rdf:li>1935.0</rdf:li>
</rdf:Seq>
</avm:Spatial.ReferenceDimension>
<avm:Spatial.ReferenceValue>
<rdf:Seq>
<rdf:li>149.3752491</rdf:li>
<rdf:li>69.2787976</rdf:li>
</rdf:Seq>
</avm:Spatial.ReferenceValue>
<avm:Spatial.CDMatrix>
<rdf:Seq>
<rdf:li>-1.1866504188e-05</rdf:li>
<rdf:li>-7.2270075932e-06</rdf:li>
<rdf:li>-7.1871389407e-06</rdf:li>
<rdf:li>1.1875865591e-05</rdf:li>
</rdf:Seq>
</avm:Spatial.CDMatrix>
<avm:Spatial.Notes>
<rdf:Alt>
<rdf:li xml:lang="x-default">WCS retrieved using CXCs PinpointWCS</rdf:li>
</rdf:Alt>
</avm:Spatial.Notes>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:crs="http://ns.adobe.com/camera-raw-settings/1.0/">
<crs:AlreadyApplied>True</crs:AlreadyApplied>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:xmpRights="http://ns.adobe.com/xap/1.0/rights/">
<xmpRights:WebStatement>http://hubblesite.org/copyright/</xmpRights:WebStatement>
<xmpRights:UsageTerms>
<rdf:Alt>
<rdf:li xml:lang="x-default">http://hubblesite.org/copyright/</rdf:li>
</rdf:Alt>
</xmpRights:UsageTerms>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:exif="http://ns.adobe.com/exif/1.0/">
<exif:ExifVersion>0221</exif:ExifVersion>
<exif:PixelXDimension>2586</exif:PixelXDimension>
<exif:PixelYDimension>1935</exif:PixelYDimension>
<exif:ColorSpace>65535</exif:ColorSpace>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:tiff="http://ns.adobe.com/tiff/1.0/">
<tiff:Orientation>1</tiff:Orientation>
<tiff:ImageWidth>2586</tiff:ImageWidth>
<tiff:ImageLength>1935</tiff:ImageLength>
<tiff:PhotometricInterpretation>2</tiff:PhotometricInterpretation>
<tiff:SamplesPerPixel>3</tiff:SamplesPerPixel>
<tiff:XResolution>300/1</tiff:XResolution>
<tiff:YResolution>300/1</tiff:YResolution>
<tiff:ResolutionUnit>2</tiff:ResolutionUnit>
<tiff:BitsPerSample>
<rdf:Seq>
<rdf:li>8</rdf:li>
<rdf:li>8</rdf:li>
<rdf:li>8</rdf:li>
</rdf:Seq>
</tiff:BitsPerSample>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:Iptc4xmpCore="http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/">
<Iptc4xmpCore:CreatorContactInfo rdf:parseType="Resource">
<Iptc4xmpCore:CiAdrExtadr>3700 San Martin Drive</Iptc4xmpCore:CiAdrExtadr>
<Iptc4xmpCore:CiAdrCity>Baltimore</Iptc4xmpCore:CiAdrCity>
<Iptc4xmpCore:CiAdrRegion>MD</Iptc4xmpCore:CiAdrRegion>
<Iptc4xmpCore:CiAdrPcode>21218</Iptc4xmpCore:CiAdrPcode>
<Iptc4xmpCore:CiAdrCtry>USA</Iptc4xmpCore:CiAdrCtry>
<Iptc4xmpCore:CiTelWork>410-338-4444</Iptc4xmpCore:CiTelWork>
<Iptc4xmpCore:CiEmailWork>outreach@stsci.edu</Iptc4xmpCore:CiEmailWork>
<Iptc4xmpCore:CiUrlWork>http://hubblesite.org</Iptc4xmpCore:CiUrlWork>
</Iptc4xmpCore:CreatorContactInfo>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>
<?xpacket end="w"?>

4
views/index.haml Normal file
View File

@ -0,0 +1,4 @@
%h2 Upload an XMP file
%form{:action => '/upload', :method => :post, :enctype => 'multipart/form-data'}
%input{:type => :file, :name => :file}
%input{:type => :submit, :value => "Upload"}

17
views/layout.haml Normal file
View File

@ -0,0 +1,17 @@
!!!
%html
%head
%title AVM Test
%link{:rel => :stylesheet, :href => 'index.css', :type => 'text/css'}
%body
#container
- if flash[:warn]
.flash#warning= flash[:warn]
- if flash[:info]
.flash#info= flash[:info]
= yield
%a{:name => "data"}
#data
= yield_content :data
#footer
Example usage application for the <a href="http://github.com/johnbintz/ruby-avm-library/">Ruby AVM Library</a>. <a href="https://github.com/johnbintz/avm-example-app/">Get the source</a>.

4
views/print_data.haml Normal file
View File

@ -0,0 +1,4 @@
- content_for :data do
%pre= CodeRay.scan(@image.to_h.pretty_inspect, :ruby).html
= haml :index