chili_presentations 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,4 +1,10 @@
1
- == 0.1.0 2012-09-24
1
+ === 0.1.1 / 2012-09-25
2
+
3
+ * 1 bug fix:
4
+
5
+ * Fixed incorrect X-Accel-Redirect header path
6
+
7
+ === 0.1.0 2012-09-24
2
8
 
3
9
  * 1 major enhancement:
4
10
  * Initial release
data/README.md CHANGED
@@ -58,6 +58,23 @@ of that project's presentations.
58
58
 
59
59
  ## INSTALL:
60
60
 
61
+ ### In nginx
62
+
63
+ Add the following block to your ChiliProject nginx config (inside your `server`
64
+ block):
65
+
66
+ ```
67
+ location ~ /contents/ {
68
+ # NOTE: Below, `root` is NOT set to `RAILS_ROOT/public`!
69
+ root RAILS_ROOT/uploaded_presentations;
70
+ internal;
71
+ }
72
+ ```
73
+
74
+ Cycle `nginx`.
75
+
76
+ ### In ChiliProject
77
+
61
78
  ```
62
79
  gem install chili_presentations
63
80
  ```
@@ -28,7 +28,7 @@ class PresentationsController < ApplicationController
28
28
  redirect_to(project_presentations_path(@project))
29
29
  end
30
30
 
31
- head :x_accel_redirect => presentation.path_to(params[:static_asset_path]), :content_type => requested_content_type
31
+ head :x_accel_redirect => presentation.x_accel_redirect_path_to(params[:static_asset_path]), :content_type => requested_content_type
32
32
  end
33
33
 
34
34
  def destroy
@@ -68,7 +68,7 @@ class PresentationsController < ApplicationController
68
68
  end
69
69
 
70
70
  def requested_content_type
71
- case presentation.path_to(params[:static_asset_path])
71
+ case presentation.x_accel_redirect_path_to(params[:static_asset_path])
72
72
  when /\.css$/ then "text/css"
73
73
  when /\.js$/ then "text/javascript"
74
74
  else "text/html"
@@ -1,4 +1,5 @@
1
1
  class Presentation < ActiveRecord::Base
2
+ UPLOAD_BASE_DIR = File.join(Rails.root, "uploaded_presentations")
2
3
  INDEX_FILENAME = "index.html"
3
4
  UNPACKED_DIRNAME = "unpacked"
4
5
 
@@ -8,7 +9,7 @@ class Presentation < ActiveRecord::Base
8
9
 
9
10
  has_friendly_id :title, :use_slug => true
10
11
  has_attached_file :contents,
11
- :path => ":rails_root/uploaded_presentations/:attachment/:id_partition/:style/:filename"
12
+ :path => "#{UPLOAD_BASE_DIR}/:attachment/:id_partition/:style/:filename"
12
13
 
13
14
  has_attached_file :alternative_format
14
15
 
@@ -20,11 +21,11 @@ class Presentation < ActiveRecord::Base
20
21
 
21
22
 
22
23
  def index_path
23
- File.join(UNPACKED_DIRNAME, INDEX_FILENAME)
24
+ File.join(path_without_upload_base_dir, UNPACKED_DIRNAME, INDEX_FILENAME)
24
25
  end
25
26
 
26
- def path_to(some_asset)
27
- some_asset.blank? ? index_path : File.join(UNPACKED_DIRNAME, *some_asset)
27
+ def x_accel_redirect_path_to(some_asset)
28
+ some_asset.blank? ? index_path : File.join(path_without_upload_base_dir, UNPACKED_DIRNAME, *some_asset)
28
29
  end
29
30
 
30
31
  def permalink
@@ -34,4 +35,9 @@ class Presentation < ActiveRecord::Base
34
35
  def to_s
35
36
  title
36
37
  end
38
+
39
+ def path_without_upload_base_dir
40
+ File.dirname(contents.path.sub(/#{UPLOAD_BASE_DIR}/, ''))
41
+ end
42
+ private :path_without_upload_base_dir
37
43
  end
@@ -1,4 +1,4 @@
1
1
  module ChiliPresentations
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
4
4
 
@@ -32,7 +32,7 @@ class ContributorTasks < Rake::TaskLib
32
32
  puts "#####################"
33
33
  puts "For the twitters"
34
34
  puts "#####################"
35
- puts "[ANN] chili_presentations v#{ChiliPresentations::VERSION} released. Changes: [link], Repo: [link] #chiliproject"
35
+ puts "[ANN] chili_presentations v#{ChiliPresentations::VERSION} released. Changes: http://bit.ly/chili_presentation_changes, Repo: http://bit.ly/chili_presentations #chiliproject"
36
36
  puts "#####################"
37
37
 
38
38
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chili_presentations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
metadata.gz.sig CHANGED
Binary file