##// END OF EJS Templates
Removes action caching on /robots.txt....
Jean-Philippe Lang -
r15251:d4edd4d6a48d
parent child
Show More
@@ -1,118 +1,117
1 1 source 'https://rubygems.org'
2 2
3 3 if Gem::Version.new(Bundler::VERSION) < Gem::Version.new('1.5.0')
4 4 abort "Redmine requires Bundler 1.5.0 or higher (you're using #{Bundler::VERSION}).\nPlease update with 'gem update bundler'."
5 5 end
6 6
7 7 gem "rails", "4.2.6"
8 8 gem "jquery-rails", "~> 3.1.4"
9 9 gem "coderay", "~> 1.1.1"
10 10 gem "builder", ">= 3.0.4"
11 11 gem "request_store", "1.0.5"
12 12 gem "mime-types", (RUBY_VERSION >= "2.0" ? "~> 3.0" : "~> 2.99")
13 13 gem "protected_attributes"
14 gem "actionpack-action_caching"
15 14 gem "actionpack-xml_parser"
16 15 gem "roadie-rails"
17 16 gem "mimemagic"
18 17
19 18 # Request at least nokogiri 1.6.7.2 because of security advisories
20 19 gem "nokogiri", ">= 1.6.7.2"
21 20
22 21 # Request at least rails-html-sanitizer 1.0.3 because of security advisories
23 22 gem "rails-html-sanitizer", ">= 1.0.3"
24 23
25 24 # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
26 25 gem 'tzinfo-data', platforms: [:mingw, :x64_mingw, :mswin, :jruby]
27 26 gem "rbpdf", "~> 1.19.0"
28 27
29 28 # Optional gem for LDAP authentication
30 29 group :ldap do
31 30 gem "net-ldap", "~> 0.12.0"
32 31 end
33 32
34 33 # Optional gem for OpenID authentication
35 34 group :openid do
36 35 gem "ruby-openid", "~> 2.3.0", :require => "openid"
37 36 gem "rack-openid"
38 37 end
39 38
40 39 platforms :mri, :mingw, :x64_mingw do
41 40 # Optional gem for exporting the gantt to a PNG file, not supported with jruby
42 41 group :rmagick do
43 42 gem "rmagick", ">= 2.14.0"
44 43 end
45 44
46 45 # Optional Markdown support, not for JRuby
47 46 group :markdown do
48 47 gem "redcarpet", "~> 3.3.2"
49 48 end
50 49 end
51 50
52 51 platforms :jruby do
53 52 # jruby-openssl is bundled with JRuby 1.7.0
54 53 gem "jruby-openssl" if Object.const_defined?(:JRUBY_VERSION) && JRUBY_VERSION < '1.7.0'
55 54 gem "activerecord-jdbc-adapter", "~> 1.3.2"
56 55 end
57 56
58 57 # Include database gems for the adapters found in the database
59 58 # configuration file
60 59 require 'erb'
61 60 require 'yaml'
62 61 database_file = File.join(File.dirname(__FILE__), "config/database.yml")
63 62 if File.exist?(database_file)
64 63 database_config = YAML::load(ERB.new(IO.read(database_file)).result)
65 64 adapters = database_config.values.map {|c| c['adapter']}.compact.uniq
66 65 if adapters.any?
67 66 adapters.each do |adapter|
68 67 case adapter
69 68 when 'mysql2'
70 69 gem "mysql2", "~> 0.3.11", :platforms => [:mri, :mingw, :x64_mingw]
71 70 gem "activerecord-jdbcmysql-adapter", :platforms => :jruby
72 71 when 'mysql'
73 72 gem "activerecord-jdbcmysql-adapter", :platforms => :jruby
74 73 when /postgresql/
75 74 gem "pg", "~> 0.18.1", :platforms => [:mri, :mingw, :x64_mingw]
76 75 gem "activerecord-jdbcpostgresql-adapter", :platforms => :jruby
77 76 when /sqlite3/
78 77 gem "sqlite3", :platforms => [:mri, :mingw, :x64_mingw]
79 78 gem "jdbc-sqlite3", ">= 3.8.10.1", :platforms => :jruby
80 79 gem "activerecord-jdbcsqlite3-adapter", :platforms => :jruby
81 80 when /sqlserver/
82 81 gem "tiny_tds", "~> 0.6.2", :platforms => [:mri, :mingw, :x64_mingw]
83 82 gem "activerecord-sqlserver-adapter", :platforms => [:mri, :mingw, :x64_mingw]
84 83 else
85 84 warn("Unknown database adapter `#{adapter}` found in config/database.yml, use Gemfile.local to load your own database gems")
86 85 end
87 86 end
88 87 else
89 88 warn("No adapter found in config/database.yml, please configure it first")
90 89 end
91 90 else
92 91 warn("Please configure your config/database.yml first")
93 92 end
94 93
95 94 group :development do
96 95 gem "rdoc", ">= 2.4.2"
97 96 gem "yard"
98 97 end
99 98
100 99 group :test do
101 100 gem "minitest"
102 101 gem "rails-dom-testing"
103 102 gem "mocha"
104 103 gem "simplecov", "~> 0.9.1", :require => false
105 104 # For running UI tests
106 105 gem "capybara"
107 106 gem "selenium-webdriver"
108 107 end
109 108
110 109 local_gemfile = File.join(File.dirname(__FILE__), "Gemfile.local")
111 110 if File.exists?(local_gemfile)
112 111 eval_gemfile local_gemfile
113 112 end
114 113
115 114 # Load plugins' Gemfiles
116 115 Dir.glob File.expand_path("../plugins/*/{Gemfile,PluginGemfile}", __FILE__) do |file|
117 116 eval_gemfile file
118 117 end
@@ -1,234 +1,228
1 1 # Redmine - project management software
2 2 # Copyright (C) 2006-2016 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 class ProjectsController < ApplicationController
19 19 menu_item :overview
20 20 menu_item :settings, :only => :settings
21 21
22 22 before_filter :find_project, :except => [ :index, :list, :new, :create, :copy ]
23 23 before_filter :authorize, :except => [ :index, :list, :new, :create, :copy, :archive, :unarchive, :destroy]
24 24 before_filter :authorize_global, :only => [:new, :create]
25 25 before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy ]
26 26 accept_rss_auth :index
27 27 accept_api_auth :index, :show, :create, :update, :destroy
28 28 require_sudo_mode :destroy
29 29
30 after_filter :only => [:create, :edit, :update, :archive, :unarchive, :destroy] do |controller|
31 if controller.request.post?
32 controller.send :expire_action, :controller => 'welcome', :action => 'robots'
33 end
34 end
35
36 30 helper :custom_fields
37 31 helper :issues
38 32 helper :queries
39 33 helper :repositories
40 34 helper :members
41 35
42 36 # Lists visible projects
43 37 def index
44 38 scope = Project.visible.sorted
45 39
46 40 respond_to do |format|
47 41 format.html {
48 42 unless params[:closed]
49 43 scope = scope.active
50 44 end
51 45 @projects = scope.to_a
52 46 }
53 47 format.api {
54 48 @offset, @limit = api_offset_and_limit
55 49 @project_count = scope.count
56 50 @projects = scope.offset(@offset).limit(@limit).to_a
57 51 }
58 52 format.atom {
59 53 projects = scope.reorder(:created_on => :desc).limit(Setting.feeds_limit.to_i).to_a
60 54 render_feed(projects, :title => "#{Setting.app_title}: #{l(:label_project_latest)}")
61 55 }
62 56 end
63 57 end
64 58
65 59 def new
66 60 @issue_custom_fields = IssueCustomField.sorted.to_a
67 61 @trackers = Tracker.sorted.to_a
68 62 @project = Project.new
69 63 @project.safe_attributes = params[:project]
70 64 end
71 65
72 66 def create
73 67 @issue_custom_fields = IssueCustomField.sorted.to_a
74 68 @trackers = Tracker.sorted.to_a
75 69 @project = Project.new
76 70 @project.safe_attributes = params[:project]
77 71
78 72 if @project.save
79 73 unless User.current.admin?
80 74 @project.add_default_member(User.current)
81 75 end
82 76 respond_to do |format|
83 77 format.html {
84 78 flash[:notice] = l(:notice_successful_create)
85 79 if params[:continue]
86 80 attrs = {:parent_id => @project.parent_id}.reject {|k,v| v.nil?}
87 81 redirect_to new_project_path(attrs)
88 82 else
89 83 redirect_to settings_project_path(@project)
90 84 end
91 85 }
92 86 format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'projects', :action => 'show', :id => @project.id) }
93 87 end
94 88 else
95 89 respond_to do |format|
96 90 format.html { render :action => 'new' }
97 91 format.api { render_validation_errors(@project) }
98 92 end
99 93 end
100 94 end
101 95
102 96 def copy
103 97 @issue_custom_fields = IssueCustomField.sorted.to_a
104 98 @trackers = Tracker.sorted.to_a
105 99 @source_project = Project.find(params[:id])
106 100 if request.get?
107 101 @project = Project.copy_from(@source_project)
108 102 @project.identifier = Project.next_identifier if Setting.sequential_project_identifiers?
109 103 else
110 104 Mailer.with_deliveries(params[:notifications] == '1') do
111 105 @project = Project.new
112 106 @project.safe_attributes = params[:project]
113 107 if @project.copy(@source_project, :only => params[:only])
114 108 flash[:notice] = l(:notice_successful_create)
115 109 redirect_to settings_project_path(@project)
116 110 elsif !@project.new_record?
117 111 # Project was created
118 112 # But some objects were not copied due to validation failures
119 113 # (eg. issues from disabled trackers)
120 114 # TODO: inform about that
121 115 redirect_to settings_project_path(@project)
122 116 end
123 117 end
124 118 end
125 119 rescue ActiveRecord::RecordNotFound
126 120 # source_project not found
127 121 render_404
128 122 end
129 123
130 124 # Show @project
131 125 def show
132 126 # try to redirect to the requested menu item
133 127 if params[:jump] && redirect_to_project_menu_item(@project, params[:jump])
134 128 return
135 129 end
136 130
137 131 @users_by_role = @project.users_by_role
138 132 @subprojects = @project.children.visible.to_a
139 133 @news = @project.news.limit(5).includes(:author, :project).reorder("#{News.table_name}.created_on DESC").to_a
140 134 @trackers = @project.rolled_up_trackers.visible
141 135
142 136 cond = @project.project_condition(Setting.display_subprojects_issues?)
143 137
144 138 @open_issues_by_tracker = Issue.visible.open.where(cond).group(:tracker).count
145 139 @total_issues_by_tracker = Issue.visible.where(cond).group(:tracker).count
146 140
147 141 if User.current.allowed_to_view_all_time_entries?(@project)
148 142 @total_hours = TimeEntry.visible.where(cond).sum(:hours).to_f
149 143 end
150 144
151 145 @key = User.current.rss_key
152 146
153 147 respond_to do |format|
154 148 format.html
155 149 format.api
156 150 end
157 151 end
158 152
159 153 def settings
160 154 @issue_custom_fields = IssueCustomField.sorted.to_a
161 155 @issue_category ||= IssueCategory.new
162 156 @member ||= @project.members.new
163 157 @trackers = Tracker.sorted.to_a
164 158 @wiki ||= @project.wiki || Wiki.new(:project => @project)
165 159 end
166 160
167 161 def edit
168 162 end
169 163
170 164 def update
171 165 @project.safe_attributes = params[:project]
172 166 if @project.save
173 167 respond_to do |format|
174 168 format.html {
175 169 flash[:notice] = l(:notice_successful_update)
176 170 redirect_to settings_project_path(@project)
177 171 }
178 172 format.api { render_api_ok }
179 173 end
180 174 else
181 175 respond_to do |format|
182 176 format.html {
183 177 settings
184 178 render :action => 'settings'
185 179 }
186 180 format.api { render_validation_errors(@project) }
187 181 end
188 182 end
189 183 end
190 184
191 185 def modules
192 186 @project.enabled_module_names = params[:enabled_module_names]
193 187 flash[:notice] = l(:notice_successful_update)
194 188 redirect_to settings_project_path(@project, :tab => 'modules')
195 189 end
196 190
197 191 def archive
198 192 unless @project.archive
199 193 flash[:error] = l(:error_can_not_archive_project)
200 194 end
201 195 redirect_to admin_projects_path(:status => params[:status])
202 196 end
203 197
204 198 def unarchive
205 199 unless @project.active?
206 200 @project.unarchive
207 201 end
208 202 redirect_to admin_projects_path(:status => params[:status])
209 203 end
210 204
211 205 def close
212 206 @project.close
213 207 redirect_to project_path(@project)
214 208 end
215 209
216 210 def reopen
217 211 @project.reopen
218 212 redirect_to project_path(@project)
219 213 end
220 214
221 215 # Delete @project
222 216 def destroy
223 217 @project_to_destroy = @project
224 218 if api_request? || params[:confirm]
225 219 @project_to_destroy.destroy
226 220 respond_to do |format|
227 221 format.html { redirect_to admin_projects_path }
228 222 format.api { render_api_ok }
229 223 end
230 224 end
231 225 # hide project in layout
232 226 @project = nil
233 227 end
234 228 end
@@ -1,29 +1,28
1 1 # Redmine - project management software
2 2 # Copyright (C) 2006-2016 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 class WelcomeController < ApplicationController
19 caches_action :robots
20 19
21 20 def index
22 21 @news = News.latest User.current
23 22 end
24 23
25 24 def robots
26 25 @projects = Project.all_public.active
27 26 render :layout => false, :content_type => 'text/plain'
28 27 end
29 28 end
General Comments 0
You need to be logged in to leave comments. Login now