merb-photos 0.1
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.
- data/LICENSE +20 -0
- data/README +62 -0
- data/Rakefile +69 -0
- data/app/controllers/application.rb +5 -0
- data/app/controllers/photos.rb +33 -0
- data/app/helpers/application_helper.rb +45 -0
- data/app/helpers/global_helpers.rb +7 -0
- data/app/views/photos/index.html.erb +14 -0
- data/app/views/photos/photo.html.erb +5 -0
- data/lib/merb-photos/merbtasks.rb +103 -0
- data/lib/merb-photos/slicetasks.rb +18 -0
- data/lib/merb-photos/spectasks.rb +65 -0
- data/lib/merb-photos.rb +80 -0
- metadata +90 -0
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2008 Jamie Hoover
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
Prerequisite:
|
2
|
+
|
3
|
+
http://github.com/uipoet/merb-ui/tree/master
|
4
|
+
|
5
|
+
------------------------------------------------------------------------------
|
6
|
+
|
7
|
+
Installation:
|
8
|
+
|
9
|
+
1.) Install merb-photos gem.
|
10
|
+
git clone git://github.com/uipoet/merb-photos.git
|
11
|
+
cd merb-photos
|
12
|
+
sudo rake install
|
13
|
+
|
14
|
+
2.) Navigate to your merb application.
|
15
|
+
cd ~/your_merb_app/
|
16
|
+
|
17
|
+
3.) Add to your dependencies file.
|
18
|
+
vim config/dependencies.rb
|
19
|
+
a
|
20
|
+
|
21
|
+
dependency 'merb-photos'
|
22
|
+
|
23
|
+
esc : wq
|
24
|
+
|
25
|
+
4.) Add options to your init file in the before_app_loads callback.
|
26
|
+
vim config/init.rb
|
27
|
+
a
|
28
|
+
|
29
|
+
Merb::BootLoader.before_app_loads do
|
30
|
+
Merb::Slices::config[:merb_photos][:title] = 'Photos' #Title of the index page and/or tab.
|
31
|
+
Merb::Slices::config[:merb_photos][:flickr_user_name] = 'your_user_name' #Flickr user name.
|
32
|
+
Merb::Slices::config[:merb_photos][:flickr_api_key] = '********************************' #Flickr API key.
|
33
|
+
Merb::Slices::config[:merb_photos][:flickr_shared_secret] = '****************' #Flickr shared secret.
|
34
|
+
end
|
35
|
+
|
36
|
+
esc : wq
|
37
|
+
|
38
|
+
5.) Add to your router file.
|
39
|
+
vim config/router.rb
|
40
|
+
a
|
41
|
+
|
42
|
+
slice(:merb_photos)
|
43
|
+
|
44
|
+
esc : wq
|
45
|
+
|
46
|
+
6.) Start your merb application and browse.
|
47
|
+
http://your_domain/photos
|
48
|
+
|
49
|
+
------------------------------------------------------------------------------
|
50
|
+
|
51
|
+
Advanced:
|
52
|
+
|
53
|
+
# List all available tasks:
|
54
|
+
rake -T slices:merb_photos
|
55
|
+
|
56
|
+
# Put your application-level overrides in:
|
57
|
+
host-app/slices/merb-photos/
|
58
|
+
|
59
|
+
# Templates are located in this order:
|
60
|
+
1. host-app/slices/merb-photos/app/views/*
|
61
|
+
2. gems/merb-photos/app/views/*
|
62
|
+
3. host-app/app/views/*
|
data/Rakefile
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake/gempackagetask'
|
3
|
+
|
4
|
+
require 'merb-core'
|
5
|
+
require 'merb-core/tasks/merb'
|
6
|
+
|
7
|
+
GEM_NAME = "merb-photos"
|
8
|
+
AUTHOR = "uipoet"
|
9
|
+
EMAIL = "dont.tase@me.com"
|
10
|
+
HOMEPAGE = "http://uipoet.com/"
|
11
|
+
SUMMARY = "Flickr photo gallery for Merb."
|
12
|
+
GEM_VERSION = "0.1"
|
13
|
+
|
14
|
+
spec = Gem::Specification.new do |s|
|
15
|
+
s.rubyforge_project = "mui"
|
16
|
+
s.name = GEM_NAME
|
17
|
+
s.version = GEM_VERSION
|
18
|
+
s.platform = Gem::Platform::RUBY
|
19
|
+
s.has_rdoc = true
|
20
|
+
s.extra_rdoc_files = ["README", "LICENSE"]
|
21
|
+
s.summary = SUMMARY
|
22
|
+
s.description = s.summary
|
23
|
+
s.author = AUTHOR
|
24
|
+
s.email = EMAIL
|
25
|
+
s.homepage = HOMEPAGE
|
26
|
+
s.add_dependency('merb-ui', '>= 0.1')
|
27
|
+
s.add_dependency('flickraw', '>= 0.5')
|
28
|
+
s.require_path = 'lib'
|
29
|
+
s.files = %w(LICENSE README Rakefile) + Dir.glob("{lib,app,public}/**/*")
|
30
|
+
end
|
31
|
+
|
32
|
+
Rake::GemPackageTask.new(spec) do |pkg|
|
33
|
+
pkg.gem_spec = spec
|
34
|
+
end
|
35
|
+
|
36
|
+
desc "Install the gem"
|
37
|
+
task :install do
|
38
|
+
Merb::RakeHelper.install(GEM_NAME, :version => GEM_VERSION)
|
39
|
+
end
|
40
|
+
|
41
|
+
desc "Uninstall the gem"
|
42
|
+
task :uninstall do
|
43
|
+
Merb::RakeHelper.uninstall(GEM_NAME, :version => GEM_VERSION)
|
44
|
+
end
|
45
|
+
|
46
|
+
desc "Release the gem to rubyforge"
|
47
|
+
task :release do
|
48
|
+
require 'rubyforge'
|
49
|
+
# require 'rake/contrib/rubyforgepublisher'
|
50
|
+
sh %{sudo rake package}
|
51
|
+
begin
|
52
|
+
sh %{rubyforge login}
|
53
|
+
sh %{rubyforge add_release #{AUTHOR} #{GEM_NAME} #{GEM_VERSION} pkg/#{GEM_NAME}-#{GEM_VERSION}.gem}
|
54
|
+
rescue Exception => e
|
55
|
+
puts "Release failed: #{e.message}"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
desc "Create a gemspec file"
|
60
|
+
task :gemspec do
|
61
|
+
File.open("#{GEM_NAME}.gemspec", "w") do |file|
|
62
|
+
file.puts spec.to_ruby
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
require 'spec/rake/spectask'
|
67
|
+
require 'merb-core/test/tasks/spectasks'
|
68
|
+
desc 'Default: run spec examples'
|
69
|
+
task :default => 'spec'
|
@@ -0,0 +1,33 @@
|
|
1
|
+
class MerbPhotos::Photos < MerbPhotos::Application
|
2
|
+
|
3
|
+
load_dependency 'flickraw'
|
4
|
+
|
5
|
+
FlickRaw.api_key = MerbPhotos[:flickr_api_key]
|
6
|
+
FlickRaw.shared_secret = MerbPhotos[:flickr_shared_secret]
|
7
|
+
|
8
|
+
def index
|
9
|
+
@photosets = flickr.photosets.getList :user_id => user_id
|
10
|
+
photoset_id = params[:photoset_id] || @photosets.first.id
|
11
|
+
@photoset = flickr.photosets.getInfo(:photoset_id => photoset_id)
|
12
|
+
@photos = flickr.photosets.getPhotos(:photoset_id => photoset_id).photo
|
13
|
+
display @photosets
|
14
|
+
end
|
15
|
+
|
16
|
+
def photo
|
17
|
+
@photoset_id = params[:photoset_id]
|
18
|
+
@photo_id = params[:photo_id]
|
19
|
+
sizes = flickr.photos.getSizes(:photo_id => params[:photo_id])
|
20
|
+
@photo = sizes.find {|s| s.label == 'Medium'}
|
21
|
+
context = flickr.photosets.getContext(:photo_id => params[:photo_id], :photoset_id => params[:photoset_id])
|
22
|
+
@next_id = context.nextphoto.id unless context.nextphoto.id == 0
|
23
|
+
@previous_id = context.prevphoto.id unless context.prevphoto.id == 0
|
24
|
+
display(@photo, :layout => false)
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def user_id
|
30
|
+
flickr.people.findByUsername(:username => MerbPhotos[:flickr_user_name]).nsid
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module Merb::MerbPhotos::ApplicationHelper
|
2
|
+
|
3
|
+
def merb_photos_button(options = {})
|
4
|
+
attributes = {}
|
5
|
+
attributes[:class] = 'mui_button mui_button_tone_neutral mui_click_window_open'
|
6
|
+
farm = options[:farm]
|
7
|
+
photo = options[:photo]
|
8
|
+
attributes[:id] = slice_url(:photo, :photo_id => photo.id, :photoset_id => @photoset.id)
|
9
|
+
image = mui_image(:url => "http://farm#{@photoset.farm}.static.flickr.com/#{photo.server}/#{photo.id}_#{photo.secret}_s.jpg", :height => 75, :width => 75)
|
10
|
+
attributes[:style] = 'float:left;margin:1em;'
|
11
|
+
tag(:button, image, attributes)
|
12
|
+
end
|
13
|
+
|
14
|
+
def merb_photos_javascript
|
15
|
+
tag(:script, :src => slice_url(:javascript), :type => 'text/javascript')
|
16
|
+
end
|
17
|
+
|
18
|
+
def merb_photos_navigation
|
19
|
+
navigation = ''
|
20
|
+
navigation << mui_button(:name => 'previous', :title => '←', :url => slice_url(:photo, :photo_id => @previous_id, :photoset_id => @photoset_id), :window => 'redirect') if @previous_id
|
21
|
+
navigation << mui_button(:name => 'next', :title => '→', :url => slice_url(:photo, :photo_id => @next_id, :photoset_id => @photoset_id), :window => 'redirect') if @next_id
|
22
|
+
navigation
|
23
|
+
end
|
24
|
+
|
25
|
+
def merb_photos_photo
|
26
|
+
mui_image(:height => @photo.height, :url => merb_photos_source(@photo.source), :width => @photo.width)
|
27
|
+
end
|
28
|
+
|
29
|
+
def merb_photos_source(string)
|
30
|
+
string.gsub(/ |\\/, '')
|
31
|
+
end
|
32
|
+
|
33
|
+
def merb_photos_tab(options = {})
|
34
|
+
photoset = options[:photoset]
|
35
|
+
image = mui_image(:url => "http://farm#{photoset.farm}.static.flickr.com/#{photoset.server}/#{photoset.primary}_#{photoset.secret}_s.jpg", :height => 75, :width => 75)
|
36
|
+
attributes = {}
|
37
|
+
attributes[:class] = 'mui_button mui_button_tone_neutral mui_click'
|
38
|
+
attributes[:class] << ' mui_selected' if photoset.id == @photoset.id
|
39
|
+
attributes[:id] = slice_url(:index, :photoset_id => photoset.id)
|
40
|
+
attributes[:style] = 'width:100%'
|
41
|
+
content = tag(:table, tag(:tr, tag(:td, image) + tag(:td, photoset.title)))
|
42
|
+
tag(:button, content, attributes)
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<%= mui_grid(:columns => 2) do %>
|
2
|
+
<%= mui_cell(:width => '100%') do %>
|
3
|
+
<% @photos.each do |photo| %>
|
4
|
+
<%= merb_photos_button(:photo => photo) %>
|
5
|
+
<% end %>
|
6
|
+
<% end =%>
|
7
|
+
<%= mui_cell do %>
|
8
|
+
<%= mui_block(:type => 'tray') do %>
|
9
|
+
<% @photosets.each do |photoset| %>
|
10
|
+
<%= merb_photos_tab(:photoset => photoset) %>
|
11
|
+
<% end %>
|
12
|
+
<% end =%>
|
13
|
+
<% end =%>
|
14
|
+
<% end =%>
|
@@ -0,0 +1,103 @@
|
|
1
|
+
namespace :slices do
|
2
|
+
namespace :merb_photos do
|
3
|
+
|
4
|
+
desc "Install MerbPhotos"
|
5
|
+
task :install => [:preflight, :setup_directories, :copy_assets, :migrate]
|
6
|
+
|
7
|
+
desc "Test for any dependencies"
|
8
|
+
task :preflight do # see slicetasks.rb
|
9
|
+
end
|
10
|
+
|
11
|
+
desc "Setup directories"
|
12
|
+
task :setup_directories do
|
13
|
+
puts "Creating directories for host application"
|
14
|
+
MerbPhotos.mirrored_components.each do |type|
|
15
|
+
if File.directory?(MerbPhotos.dir_for(type))
|
16
|
+
if !File.directory?(dst_path = MerbPhotos.app_dir_for(type))
|
17
|
+
relative_path = dst_path.relative_path_from(Merb.root)
|
18
|
+
puts "- creating directory :#{type} #{File.basename(Merb.root) / relative_path}"
|
19
|
+
mkdir_p(dst_path)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
desc "Copy stub files to host application"
|
26
|
+
task :stubs do
|
27
|
+
puts "Copying stubs for MerbPhotos - resolves any collisions"
|
28
|
+
copied, preserved = MerbPhotos.mirror_stubs!
|
29
|
+
puts "- no files to copy" if copied.empty? && preserved.empty?
|
30
|
+
copied.each { |f| puts "- copied #{f}" }
|
31
|
+
preserved.each { |f| puts "! preserved override as #{f}" }
|
32
|
+
end
|
33
|
+
|
34
|
+
desc "Copy stub files and views to host application"
|
35
|
+
task :patch => [ "stubs", "freeze:views" ]
|
36
|
+
|
37
|
+
desc "Copy public assets to host application"
|
38
|
+
task :copy_assets do
|
39
|
+
puts "Copying assets for MerbPhotos - resolves any collisions"
|
40
|
+
copied, preserved = MerbPhotos.mirror_public!
|
41
|
+
puts "- no files to copy" if copied.empty? && preserved.empty?
|
42
|
+
copied.each { |f| puts "- copied #{f}" }
|
43
|
+
preserved.each { |f| puts "! preserved override as #{f}" }
|
44
|
+
end
|
45
|
+
|
46
|
+
desc "Migrate the database"
|
47
|
+
task :migrate do # see slicetasks.rb
|
48
|
+
end
|
49
|
+
|
50
|
+
desc "Freeze MerbPhotos into your app (only merb-photos/app)"
|
51
|
+
task :freeze => [ "freeze:app" ]
|
52
|
+
|
53
|
+
namespace :freeze do
|
54
|
+
|
55
|
+
desc "Freezes MerbPhotos by installing the gem into application/gems"
|
56
|
+
task :gem do
|
57
|
+
ENV["GEM"] ||= "merb-photos"
|
58
|
+
Rake::Task['slices:install_as_gem'].invoke
|
59
|
+
end
|
60
|
+
|
61
|
+
desc "Freezes MerbPhotos by copying all files from merb-photos/app to your application"
|
62
|
+
task :app do
|
63
|
+
puts "Copying all merb-photos/app files to your application - resolves any collisions"
|
64
|
+
copied, preserved = MerbPhotos.mirror_app!
|
65
|
+
puts "- no files to copy" if copied.empty? && preserved.empty?
|
66
|
+
copied.each { |f| puts "- copied #{f}" }
|
67
|
+
preserved.each { |f| puts "! preserved override as #{f}" }
|
68
|
+
end
|
69
|
+
|
70
|
+
desc "Freeze all views into your application for easy modification"
|
71
|
+
task :views do
|
72
|
+
puts "Copying all view templates to your application - resolves any collisions"
|
73
|
+
copied, preserved = MerbPhotos.mirror_files_for :view
|
74
|
+
puts "- no files to copy" if copied.empty? && preserved.empty?
|
75
|
+
copied.each { |f| puts "- copied #{f}" }
|
76
|
+
preserved.each { |f| puts "! preserved override as #{f}" }
|
77
|
+
end
|
78
|
+
|
79
|
+
desc "Freeze all models into your application for easy modification"
|
80
|
+
task :models do
|
81
|
+
puts "Copying all models to your application - resolves any collisions"
|
82
|
+
copied, preserved = MerbPhotos.mirror_files_for :model
|
83
|
+
puts "- no files to copy" if copied.empty? && preserved.empty?
|
84
|
+
copied.each { |f| puts "- copied #{f}" }
|
85
|
+
preserved.each { |f| puts "! preserved override as #{f}" }
|
86
|
+
end
|
87
|
+
|
88
|
+
desc "Freezes MerbPhotos as a gem and copies over merb-photos/app"
|
89
|
+
task :app_with_gem => [:gem, :app]
|
90
|
+
|
91
|
+
desc "Freezes MerbPhotos by unpacking all files into your application"
|
92
|
+
task :unpack do
|
93
|
+
puts "Unpacking MerbPhotos files to your application - resolves any collisions"
|
94
|
+
copied, preserved = MerbPhotos.unpack_slice!
|
95
|
+
puts "- no files to copy" if copied.empty? && preserved.empty?
|
96
|
+
copied.each { |f| puts "- copied #{f}" }
|
97
|
+
preserved.each { |f| puts "! preserved override as #{f}" }
|
98
|
+
end
|
99
|
+
|
100
|
+
end
|
101
|
+
|
102
|
+
end
|
103
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
namespace :slices do
|
2
|
+
namespace :merb_photos do
|
3
|
+
|
4
|
+
# add your own merb-photos tasks here
|
5
|
+
|
6
|
+
# implement this to test for structural/code dependencies
|
7
|
+
# like certain directories or availability of other files
|
8
|
+
desc "Test for any dependencies"
|
9
|
+
task :preflight do
|
10
|
+
end
|
11
|
+
|
12
|
+
# implement this to perform any database related setup steps
|
13
|
+
desc "Migrate the database"
|
14
|
+
task :migrate do
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
namespace :slices do
|
2
|
+
namespace :merb_photos do
|
3
|
+
|
4
|
+
desc "Run slice specs within the host application context"
|
5
|
+
task :spec => [ "spec:explain", "spec:default" ]
|
6
|
+
|
7
|
+
namespace :spec do
|
8
|
+
|
9
|
+
slice_root = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
|
10
|
+
|
11
|
+
task :explain do
|
12
|
+
puts "\nNote: By running MerbPhotos specs inside the application context any\n" +
|
13
|
+
"overrides could break existing specs. This isn't always a problem,\n" +
|
14
|
+
"especially in the case of views. Use these spec tasks to check how\n" +
|
15
|
+
"well your application conforms to the original slice implementation."
|
16
|
+
end
|
17
|
+
|
18
|
+
Spec::Rake::SpecTask.new('default') do |t|
|
19
|
+
t.spec_opts = ["--format", "specdoc", "--colour"]
|
20
|
+
t.spec_files = Dir["#{slice_root}/spec/**/*_spec.rb"].sort
|
21
|
+
end
|
22
|
+
|
23
|
+
desc "Run all model specs, run a spec for a specific Model with MODEL=MyModel"
|
24
|
+
Spec::Rake::SpecTask.new('model') do |t|
|
25
|
+
t.spec_opts = ["--format", "specdoc", "--colour"]
|
26
|
+
if(ENV['MODEL'])
|
27
|
+
t.spec_files = Dir["#{slice_root}/spec/models/**/#{ENV['MODEL']}_spec.rb"].sort
|
28
|
+
else
|
29
|
+
t.spec_files = Dir["#{slice_root}/spec/models/**/*_spec.rb"].sort
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
desc "Run all controller specs, run a spec for a specific Controller with CONTROLLER=MyController"
|
34
|
+
Spec::Rake::SpecTask.new('controller') do |t|
|
35
|
+
t.spec_opts = ["--format", "specdoc", "--colour"]
|
36
|
+
if(ENV['CONTROLLER'])
|
37
|
+
t.spec_files = Dir["#{slice_root}/spec/controllers/**/#{ENV['CONTROLLER']}_spec.rb"].sort
|
38
|
+
else
|
39
|
+
t.spec_files = Dir["#{slice_root}/spec/controllers/**/*_spec.rb"].sort
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
desc "Run all view specs, run specs for a specific controller (and view) with CONTROLLER=MyController (VIEW=MyView)"
|
44
|
+
Spec::Rake::SpecTask.new('view') do |t|
|
45
|
+
t.spec_opts = ["--format", "specdoc", "--colour"]
|
46
|
+
if(ENV['CONTROLLER'] and ENV['VIEW'])
|
47
|
+
t.spec_files = Dir["#{slice_root}/spec/views/**/#{ENV['CONTROLLER']}/#{ENV['VIEW']}*_spec.rb"].sort
|
48
|
+
elsif(ENV['CONTROLLER'])
|
49
|
+
t.spec_files = Dir["#{slice_root}/spec/views/**/#{ENV['CONTROLLER']}/*_spec.rb"].sort
|
50
|
+
else
|
51
|
+
t.spec_files = Dir["#{slice_root}/spec/views/**/*_spec.rb"].sort
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
desc "Run all specs and output the result in html"
|
56
|
+
Spec::Rake::SpecTask.new('html') do |t|
|
57
|
+
t.spec_opts = ["--format", "html"]
|
58
|
+
t.libs = ['lib', 'server/lib' ]
|
59
|
+
t.spec_files = Dir["#{slice_root}/spec/**/*_spec.rb"].sort
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
end
|
data/lib/merb-photos.rb
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
if defined?(Merb::Plugins)
|
2
|
+
|
3
|
+
$:.unshift File.dirname(__FILE__)
|
4
|
+
|
5
|
+
load_dependency 'merb-ui'
|
6
|
+
Merb::Plugins.add_rakefiles "merb-photos/merbtasks", "merb-photos/slicetasks", "merb-photos/spectasks"
|
7
|
+
|
8
|
+
# Register the Slice for the current host application
|
9
|
+
Merb::Slices::register(__FILE__)
|
10
|
+
|
11
|
+
# Slice configuration - set this in a before_app_loads callback.
|
12
|
+
# By default a Slice uses its own layout, so you can swicht to
|
13
|
+
# the main application layout or no layout at all if needed.
|
14
|
+
#
|
15
|
+
# Configuration options:
|
16
|
+
# :layout - the layout to use; defaults to :merb-photos
|
17
|
+
# :mirror - which path component types to use on copy operations; defaults to all
|
18
|
+
Merb::Slices::config[:merb_photos][:layout] ||= :application
|
19
|
+
|
20
|
+
# All Slice code is expected to be namespaced inside a module
|
21
|
+
module MerbPhotos
|
22
|
+
|
23
|
+
# Slice metadata
|
24
|
+
self.description = "Merb UI Photos"
|
25
|
+
self.version = "1.0"
|
26
|
+
self.author = "UI Poet"
|
27
|
+
|
28
|
+
# Stub classes loaded hook - runs before LoadClasses BootLoader
|
29
|
+
# right after a slice's classes have been loaded internally.
|
30
|
+
def self.loaded
|
31
|
+
end
|
32
|
+
|
33
|
+
# Initialization hook - runs before AfterAppLoads BootLoader
|
34
|
+
def self.init
|
35
|
+
end
|
36
|
+
|
37
|
+
# Activation hook - runs after AfterAppLoads BootLoader
|
38
|
+
def self.activate
|
39
|
+
end
|
40
|
+
|
41
|
+
# Deactivation hook - triggered by Merb::Slices.deactivate(MerbPhotos)
|
42
|
+
def self.deactivate
|
43
|
+
end
|
44
|
+
|
45
|
+
# Setup routes inside the host application
|
46
|
+
#
|
47
|
+
# @param scope<Merb::Router::Behaviour>
|
48
|
+
# Routes will be added within this scope (namespace). In fact, any
|
49
|
+
# router behaviour is a valid namespace, so you can attach
|
50
|
+
# routes at any level of your router setup.
|
51
|
+
#
|
52
|
+
# @note prefix your named routes with :merb_photos_
|
53
|
+
# to avoid potential conflicts with global named routes.
|
54
|
+
def self.setup_router(scope)
|
55
|
+
scope.to(:controller => 'photos') do |p|
|
56
|
+
p.match('/photo').to(:action => 'photo').name(:photo)
|
57
|
+
p.match('/photos').to(:action => 'index').name(:index)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
# Setup the slice layout for MerbPhotos
|
64
|
+
#
|
65
|
+
# Use MerbPhotos.push_path and MerbPhotos.push_app_path
|
66
|
+
# to set paths to merb-photos-level and app-level paths. Example:
|
67
|
+
#
|
68
|
+
# MerbPhotos.push_path(:application, MerbPhotos.root)
|
69
|
+
# MerbPhotos.push_app_path(:application, Merb.root / 'slices' / 'merb-photos')
|
70
|
+
# ...
|
71
|
+
#
|
72
|
+
# Any component path that hasn't been set will default to MerbPhotos.root
|
73
|
+
#
|
74
|
+
# Or just call setup_default_structure! to setup a basic Merb MVC structure.
|
75
|
+
MerbPhotos.setup_default_structure!
|
76
|
+
|
77
|
+
# Add dependencies for other MerbPhotos classes below. Example:
|
78
|
+
# dependency "merb-photos/other"
|
79
|
+
|
80
|
+
end
|
metadata
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: merb-photos
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: "0.1"
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- uipoet
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-11-25 00:00:00 -08:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: merb-ui
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0.1"
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: flickraw
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "0.5"
|
34
|
+
version:
|
35
|
+
description: Flickr photo gallery for Merb.
|
36
|
+
email: dont.tase@me.com
|
37
|
+
executables: []
|
38
|
+
|
39
|
+
extensions: []
|
40
|
+
|
41
|
+
extra_rdoc_files:
|
42
|
+
- README
|
43
|
+
- LICENSE
|
44
|
+
files:
|
45
|
+
- LICENSE
|
46
|
+
- README
|
47
|
+
- Rakefile
|
48
|
+
- lib/merb-photos
|
49
|
+
- lib/merb-photos/merbtasks.rb
|
50
|
+
- lib/merb-photos/slicetasks.rb
|
51
|
+
- lib/merb-photos/spectasks.rb
|
52
|
+
- lib/merb-photos.rb
|
53
|
+
- app/controllers
|
54
|
+
- app/controllers/application.rb
|
55
|
+
- app/controllers/photos.rb
|
56
|
+
- app/helpers
|
57
|
+
- app/helpers/application_helper.rb
|
58
|
+
- app/helpers/global_helpers.rb
|
59
|
+
- app/views
|
60
|
+
- app/views/photos
|
61
|
+
- app/views/photos/index.html.erb
|
62
|
+
- app/views/photos/photo.html.erb
|
63
|
+
has_rdoc: true
|
64
|
+
homepage: http://uipoet.com/
|
65
|
+
post_install_message:
|
66
|
+
rdoc_options: []
|
67
|
+
|
68
|
+
require_paths:
|
69
|
+
- lib
|
70
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: "0"
|
75
|
+
version:
|
76
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: "0"
|
81
|
+
version:
|
82
|
+
requirements: []
|
83
|
+
|
84
|
+
rubyforge_project: mui
|
85
|
+
rubygems_version: 1.3.1
|
86
|
+
signing_key:
|
87
|
+
specification_version: 2
|
88
|
+
summary: Flickr photo gallery for Merb.
|
89
|
+
test_files: []
|
90
|
+
|