sunrise-cms 0.6.10 → 0.6.11
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/README.md +10 -0
- data/app/controllers/sunrise/manager_controller.rb +3 -3
- data/lib/generators/sunrise/install_generator.rb +2 -1
- data/lib/generators/sunrise/templates/config/nginx-passenger +50 -0
- data/lib/generators/sunrise/templates/config/{nginx-config → nginx-unicorn} +0 -0
- data/lib/sunrise/models/asset.rb +2 -2
- data/lib/sunrise/version.rb +1 -1
- data/spec/generators/install_generator_spec.rb +1 -1
- metadata +4 -3
data/README.md
CHANGED
@@ -102,6 +102,16 @@ class SunriseProduct < Sunrise::AbstractModel
|
|
102
102
|
end
|
103
103
|
```
|
104
104
|
|
105
|
+
Assets uploading detect ccurrent user by request.env['warden'].user. To overwrite it use:
|
106
|
+
|
107
|
+
```ruby
|
108
|
+
class Asset
|
109
|
+
def uploader_user(request)
|
110
|
+
request.env['warden'].user(:account) || request.env['warden'].user(:user)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
```
|
114
|
+
|
105
115
|
### Export data
|
106
116
|
|
107
117
|
#### XML, JSON, CSV
|
@@ -35,7 +35,7 @@ module Sunrise
|
|
35
35
|
|
36
36
|
def create
|
37
37
|
@record.update_attributes(model_params)
|
38
|
-
respond_with(@record, :location => redirect_after_update)
|
38
|
+
respond_with(@record, :location => redirect_after_update(@record))
|
39
39
|
end
|
40
40
|
|
41
41
|
def edit
|
@@ -46,7 +46,7 @@ module Sunrise
|
|
46
46
|
|
47
47
|
def update
|
48
48
|
@record.update_attributes(model_params)
|
49
|
-
respond_with(@record, :location => redirect_after_update)
|
49
|
+
respond_with(@record, :location => redirect_after_update(@record))
|
50
50
|
end
|
51
51
|
|
52
52
|
def destroy
|
@@ -154,7 +154,7 @@ module Sunrise
|
|
154
154
|
index_path(query.merge(options))
|
155
155
|
end
|
156
156
|
|
157
|
-
def redirect_after_update
|
157
|
+
def redirect_after_update(record = nil)
|
158
158
|
if abstract_model.without_list?
|
159
159
|
index_path(:model_name => abstract_model.plural)
|
160
160
|
else
|
@@ -26,7 +26,8 @@ module Sunrise
|
|
26
26
|
|
27
27
|
template('config/database.yml', 'config/database.yml.sample')
|
28
28
|
template('config/logrotate-config', 'config/logrotate-config.sample')
|
29
|
-
template('config/nginx-
|
29
|
+
template('config/nginx-unicorn', 'config/nginx-unicorn.sample')
|
30
|
+
template('config/nginx-passenger', 'config/nginx-passenger.sample')
|
30
31
|
end
|
31
32
|
|
32
33
|
# copy models
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# <%= app_name %>
|
2
|
+
#
|
3
|
+
|
4
|
+
server {
|
5
|
+
listen 5.9.144.130:80;
|
6
|
+
server_name <%= app_name %>.fodojo.com;
|
7
|
+
|
8
|
+
access_log off;
|
9
|
+
error_log off;
|
10
|
+
server_tokens off;
|
11
|
+
|
12
|
+
root /var/www/<%= app_name %>/public;
|
13
|
+
|
14
|
+
try_files $uri $uri.html $uri/index.html /cache/$uri/index.html /cache/$uri.html /cache/$uri @app;
|
15
|
+
|
16
|
+
location ^~ /cache {
|
17
|
+
return 404;
|
18
|
+
}
|
19
|
+
|
20
|
+
location ~ /\.[^\/]+ {
|
21
|
+
return 404;
|
22
|
+
}
|
23
|
+
|
24
|
+
location @app {
|
25
|
+
client_max_body_size 20m;
|
26
|
+
client_body_buffer_size 128k;
|
27
|
+
|
28
|
+
passenger_ruby /usr/local/rvm/wrappers/ruby-1.9.3-p448@global/ruby;
|
29
|
+
passenger_enabled on;
|
30
|
+
}
|
31
|
+
|
32
|
+
location ~ ^/(assets|uploads|images|javascripts|stylesheets)/ {
|
33
|
+
expires 1y;
|
34
|
+
add_header Cache-Control public;
|
35
|
+
add_header Last-Modified "";
|
36
|
+
add_header ETag "";
|
37
|
+
break;
|
38
|
+
}
|
39
|
+
|
40
|
+
# This rewrites all the requests to the maintenance.html page if it exists in the doc root.
|
41
|
+
if (-f $document_root/system/maintenance.html) {
|
42
|
+
return 503;
|
43
|
+
}
|
44
|
+
|
45
|
+
error_page 503 @503;
|
46
|
+
location @503 {
|
47
|
+
root /var/www/<%= app_name %>/public;
|
48
|
+
rewrite ^(.*)$ /system/maintenance.html break;
|
49
|
+
}
|
50
|
+
}
|
File without changes
|
data/lib/sunrise/models/asset.rb
CHANGED
@@ -55,8 +55,8 @@ module Sunrise
|
|
55
55
|
|
56
56
|
def as_json(options = nil)
|
57
57
|
options = {
|
58
|
-
:
|
59
|
-
:
|
58
|
+
:root => "asset",
|
59
|
+
:only => [:id, :guid, :assetable_id, :assetable_type, :user_id, :public_token],
|
60
60
|
:methods => [:filename, :url, :thumb_url, :size, :content_type]
|
61
61
|
}.merge(options || {})
|
62
62
|
|
data/lib/sunrise/version.rb
CHANGED
@@ -27,7 +27,7 @@ describe Sunrise::Generators::InstallGenerator do
|
|
27
27
|
|
28
28
|
it "should copy_configurations" do
|
29
29
|
["db/seeds.rb", "config/initializers/sunrise.rb", "config/database.yml.sample",
|
30
|
-
"config/logrotate-config.sample", "config/nginx-config.sample"].each do |file|
|
30
|
+
"config/logrotate-config.sample", "config/nginx-unicorn.sample", "config/nginx-passenger.sample"].each do |file|
|
31
31
|
assert_file file
|
32
32
|
end
|
33
33
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sunrise-cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.11
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-09-
|
13
|
+
date: 2013-09-26 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -505,7 +505,8 @@ files:
|
|
505
505
|
- lib/generators/sunrise/templates/config/database.yml
|
506
506
|
- lib/generators/sunrise/templates/config/logrotate-config
|
507
507
|
- lib/generators/sunrise/templates/config/mongoid/sunrise.rb
|
508
|
-
- lib/generators/sunrise/templates/config/nginx-
|
508
|
+
- lib/generators/sunrise/templates/config/nginx-passenger
|
509
|
+
- lib/generators/sunrise/templates/config/nginx-unicorn
|
509
510
|
- lib/generators/sunrise/templates/config/seeds.rb
|
510
511
|
- lib/generators/sunrise/templates/models/active_record/ability.rb
|
511
512
|
- lib/generators/sunrise/templates/models/active_record/asset.rb
|