BBenezech-papermill 0.4.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1,10 +1,16 @@
1
1
  = Papermill
2
2
 
3
- Asset management made easy.. Painfully easy.
3
+ Asset management made easy.
4
4
 
5
- == Try the demo to get the idea:
5
+ == Install the gem!
6
+
7
+ $ gem sources -a http://gems.github.com
8
+ $ sudo gem install BBenezech-papermill
9
+
10
+ == Try the demo!
6
11
 
7
- rails -m http://gist.github.com/177714.txt papermill-example
12
+ $ sudo gem install sqlite3-ruby
13
+ $ rails -m http://gist.github.com/177714.txt papermill-example
8
14
 
9
15
  == Papermill comes in 2 flavors:
10
16
 
@@ -17,32 +23,26 @@ Asset management made easy.. Painfully easy.
17
23
  === Association specific declaration
18
24
 
19
25
  papermill :my_association, {my_option_hash} # in your papermilled assetable model
20
- assets_upload(my_association, {optional_option_hash}) # form helper call
26
+ assets_upload(:my_association, {optional_option_hash}) # form helper call
21
27
  @assetable.my_association # data access in your view
22
28
 
23
29
  In both case, you can specify a PapermillAsset subclass to use with :class_name => MyPapermillAssetSubclass in the option hash
30
+ You can have a catch-all declaration and as many specific association as you want in your model (as long as they use different keys)
24
31
 
25
32
  See papermill_module.rb for the complete list of options.
26
33
 
27
34
  == Installation
28
35
 
29
36
  === You'll need something like this in your environment.rb:
30
-
31
- config.gem 'rsl-stringex', :lib => 'stringex', :source => 'http://gems.github.com'
37
+
38
+ config.gem 'rsl-stringex', :lib => 'stringex'
32
39
  config.gem 'paperclip'
33
- config.gem 'authlogic'
34
40
  config.gem 'mime-types', :lib => 'mime/types'
35
- config.gem 'ryanb-acts-as-list', :lib => 'acts_as_list', :source => 'http://gems.github.com'
36
- config.gem 'BBenezech-papermill', :lib => 'papermill', :source => 'http://gems.github.com'
41
+ config.gem 'ryanb-acts-as-list', :lib => 'acts_as_list'
42
+ config.gem 'BBenezech-papermill', :lib => 'papermill'
43
+
44
+ === Then you can generate a migration and copy a couple of static assets:
37
45
 
38
- === Then you can the whole thing:
39
-
40
- $ sudo gem install ryanb-acts-as-list -s http://gems.github.com
41
- $ sudo gem install paperclip
42
- $ sudo rake gems:install
43
- # will install the others gem.
44
- # You need to install paperclip & acts_as_list first, because of a dependency mayhem.
45
- # Next version of gem will use gem dependencies
46
46
  $ ./script/generate papermill PapermillMigration
47
47
  # will generate a migration named PapermillMigration and copy a couple of static assets
48
48
  $ rake db:migrate
data/Rakefile CHANGED
@@ -26,11 +26,15 @@ begin
26
26
  require 'jeweler'
27
27
  Jeweler::Tasks.new do |gemspec|
28
28
  gemspec.name = "papermill"
29
- gemspec.summary = "Paperclip wrapper"
30
- gemspec.description = "Paperclip wrapper"
29
+ gemspec.summary = "Paperclip Swfupload UploadHelper wrapper"
30
+ gemspec.description = "Paperclip Swfupload UploadHelper wrapper"
31
31
  gemspec.email = "benoit.benezech@gmail.com"
32
32
  gemspec.homepage = "http://github.com/BBenezech/papermill"
33
33
  gemspec.authors = ["Benoit Bénézech"]
34
+ gemspec.add_dependency('paperclip', '>= 2.1.2')
35
+ gemspec.add_dependency('mime-types', '>= 1.16')
36
+ gemspec.add_dependency('rsl-stringex', '>= 1.0.0')
37
+ gemspec.add_dependency('ryanb-acts-as-list', '>= 0.1.2')
34
38
  end
35
39
  rescue LoadError
36
40
  puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.1
1
+ 0.5.0
@@ -0,0 +1,129 @@
1
+ gem 'paperclip'
2
+ gem 'ryanb-acts-as-list', :lib => 'acts_as_list'
3
+ gem 'sqlite3-ruby', :lib => "sqlite3" # for the demo
4
+ gem 'mime-types', :lib => 'mime/types'
5
+ gem "rsl-stringex", :lib => "stringex"
6
+ gem 'BBenezech-papermill', :lib => 'papermill'
7
+
8
+ generate :papermill, "PapermillMigration"
9
+ generate :scaffold, "article title:string"
10
+ rake "db:migrate"
11
+
12
+ file "app/models/article.rb", <<-END
13
+ class Article < ActiveRecord::Base
14
+ validates_presence_of :title
15
+ papermill :thumbnail => {:width => 50, :height => 50} # catch-all for non-specified associations
16
+ papermill :image_gallery, :class_name => ImageAsset, :images_only => true, :thumbnail => {:width => 75, :height => 100}
17
+ # image_gallery association (set with define_method)
18
+ end
19
+ END
20
+
21
+ file "app/models/image_asset.rb", <<-END
22
+ class ImageAsset < PapermillAsset
23
+ validates_attachment_content_type :file, :content_type => ['image/jpeg', 'image/pjpeg', 'image/jpg', 'image/png', 'image/gif']
24
+ end
25
+ END
26
+
27
+ file "app/views/articles/edit.html.erb", <<-END
28
+ <h1>Editing article</h1>
29
+ <%= render :partial => "form" %>
30
+ <%= link_to 'Show', @article %> |
31
+ <%= link_to 'Back', articles_path %>
32
+ END
33
+
34
+ file "app/views/articles/new.html.erb", <<-END
35
+ <h1>New article</h1>
36
+ <%= render :partial => "form" %>
37
+ <%= link_to 'Back', articles_path %>
38
+ END
39
+
40
+ file "app/views/articles/_form.html.erb", <<-END
41
+ <% form_for(@article) do |f| %>
42
+ <%= f.error_messages %>
43
+ <p>
44
+ <%= f.label :title %><br />
45
+ <%= f.text_field :title %>
46
+ </p>
47
+ <p>
48
+ <%= f.label :image_gallery %><br />
49
+ <%= f.images_upload(:image_gallery) %>
50
+ </p>
51
+ <p>
52
+ <%= f.label :my_other_image %><br />
53
+ <%= f.image_upload(:my_other_image) %>
54
+ </p>
55
+ <p>
56
+ <%= f.label :my_assets %><br />
57
+ <%= f.assets_upload(:my_assets) %>
58
+ </p>
59
+ <p>
60
+ <%= f.label :my_other_asset %><br />
61
+ <%= f.asset_upload(:my_other_asset) %>
62
+ </p>
63
+ <p>
64
+ <%= f.submit 'Send' %>
65
+ </p>
66
+ <% end %>
67
+ END
68
+
69
+
70
+ file "app/views/articles/show.html.erb", <<-END
71
+ <p>
72
+ <b>Title:</b>
73
+ <%=h @article.title %>
74
+ </p>
75
+ <br /><br />
76
+ <b>@article.image_gallery.each :</b>
77
+ <p>
78
+ <% @article.image_gallery.each do |image| %>
79
+ <%= link_to(image_tag(image.url("100x100#")), image.url) %>
80
+ <% end %>
81
+ </p>
82
+ <br /><br />
83
+ <b>@article.papermill_assets(:key => :my_other_image).first :</b>
84
+ <p>
85
+ <% image = @article.papermill_assets(:key => :my_other_image).first %>
86
+ <%= link_to(image_tag(image.url("100x100#")), image.url) if image %>
87
+ </p>
88
+ <br /><br />
89
+ <b>@article.papermill_assets(:key => :my_assets).each :</b>
90
+ <p>
91
+ <ul>
92
+ <% @article.papermill_assets(:key => :my_assets).each do |asset| %>
93
+ <li><%= link_to asset.name, asset.url %></li>
94
+ <% end %>
95
+ </ul>
96
+ </p>
97
+ <br /><br />
98
+ <b>@article.papermill_assets(:key => :my_other_asset).first :</b>
99
+ <p>
100
+ <% asset = @article.papermill_assets(:key => :my_other_asset).first %>
101
+ <%= link_to(asset.name, asset.url) if asset %>
102
+ </p>
103
+
104
+ <%= link_to 'Edit', edit_article_path(@article) %> |
105
+ <%= link_to 'Back', articles_path %>
106
+ END
107
+
108
+
109
+ file "app/views/layouts/application.html.erb", <<-END
110
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
111
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
112
+
113
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
114
+ <head>
115
+ <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
116
+ <title>Papermill Demo</title>
117
+ <%= stylesheet_link_tag 'scaffold' %>
118
+ <%= papermill_stylesheet_tag %>
119
+ </head>
120
+ <body>
121
+ <%= yield %>
122
+ </body>
123
+ <%= papermill_javascript_tag :with_jquery => true %>
124
+ </html>
125
+ END
126
+
127
+ run "rm app/views/layouts/articles.html.erb"
128
+ run "rm public/index.html"
129
+ route "map.root :controller => 'articles'"
data/papermill.gemspec CHANGED
@@ -5,12 +5,12 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{papermill}
8
- s.version = "0.4.1"
8
+ s.version = "0.5.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Benoit B\303\251n\303\251zech"]
12
- s.date = %q{2009-09-02}
13
- s.description = %q{Paperclip wrapper}
12
+ s.date = %q{2009-09-03}
13
+ s.description = %q{Paperclip Swfupload UploadHelper wrapper}
14
14
  s.email = %q{benoit.benezech@gmail.com}
15
15
  s.extra_rdoc_files = [
16
16
  "README.rdoc"
@@ -32,6 +32,7 @@ Gem::Specification.new do |s|
32
32
  "generators/papermill/templates/migrate/papermill_migration.rb.erb",
33
33
  "init.rb",
34
34
  "install.rb",
35
+ "installation-template.txt",
35
36
  "lib/core_extensions.rb",
36
37
  "lib/papermill.rb",
37
38
  "lib/papermill/form_builder.rb",
@@ -59,8 +60,8 @@ Gem::Specification.new do |s|
59
60
  s.homepage = %q{http://github.com/BBenezech/papermill}
60
61
  s.rdoc_options = ["--charset=UTF-8"]
61
62
  s.require_paths = ["lib"]
62
- s.rubygems_version = %q{1.3.5}
63
- s.summary = %q{Paperclip wrapper}
63
+ s.rubygems_version = %q{1.3.4}
64
+ s.summary = %q{Paperclip Swfupload UploadHelper wrapper}
64
65
  s.test_files = [
65
66
  "test/papermill_test.rb",
66
67
  "test/test_helper.rb"
@@ -71,8 +72,20 @@ Gem::Specification.new do |s|
71
72
  s.specification_version = 3
72
73
 
73
74
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
75
+ s.add_runtime_dependency(%q<paperclip>, [">= 2.1.2"])
76
+ s.add_runtime_dependency(%q<mime-types>, [">= 1.16"])
77
+ s.add_runtime_dependency(%q<rsl-stringex>, [">= 1.0.0"])
78
+ s.add_runtime_dependency(%q<ryanb-acts-as-list>, [">= 0.1.2"])
74
79
  else
80
+ s.add_dependency(%q<paperclip>, [">= 2.1.2"])
81
+ s.add_dependency(%q<mime-types>, [">= 1.16"])
82
+ s.add_dependency(%q<rsl-stringex>, [">= 1.0.0"])
83
+ s.add_dependency(%q<ryanb-acts-as-list>, [">= 0.1.2"])
75
84
  end
76
85
  else
86
+ s.add_dependency(%q<paperclip>, [">= 2.1.2"])
87
+ s.add_dependency(%q<mime-types>, [">= 1.16"])
88
+ s.add_dependency(%q<rsl-stringex>, [">= 1.0.0"])
89
+ s.add_dependency(%q<ryanb-acts-as-list>, [">= 0.1.2"])
77
90
  end
78
91
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: BBenezech-papermill
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Benoit B\xC3\xA9n\xC3\xA9zech"
@@ -9,11 +9,50 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-09-02 00:00:00 -07:00
12
+ date: 2009-09-03 00:00:00 -07:00
13
13
  default_executable:
14
- dependencies: []
15
-
16
- description: Paperclip wrapper
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: paperclip
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 2.1.2
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: mime-types
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: "1.16"
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: rsl-stringex
37
+ type: :runtime
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 1.0.0
44
+ version:
45
+ - !ruby/object:Gem::Dependency
46
+ name: ryanb-acts-as-list
47
+ type: :runtime
48
+ version_requirement:
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: 0.1.2
54
+ version:
55
+ description: Paperclip Swfupload UploadHelper wrapper
17
56
  email: benoit.benezech@gmail.com
18
57
  executables: []
19
58
 
@@ -38,6 +77,7 @@ files:
38
77
  - generators/papermill/templates/migrate/papermill_migration.rb.erb
39
78
  - init.rb
40
79
  - install.rb
80
+ - installation-template.txt
41
81
  - lib/core_extensions.rb
42
82
  - lib/papermill.rb
43
83
  - lib/papermill/form_builder.rb
@@ -86,7 +126,7 @@ rubyforge_project:
86
126
  rubygems_version: 1.2.0
87
127
  signing_key:
88
128
  specification_version: 3
89
- summary: Paperclip wrapper
129
+ summary: Paperclip Swfupload UploadHelper wrapper
90
130
  test_files:
91
131
  - test/papermill_test.rb
92
132
  - test/test_helper.rb