Commit 12fa04b4808450d9d8ccc09f91f1c200648bf1b9
Exists in
master
and in
29 other branches
Merge branch 'stable'
Showing
9 changed files
with
291 additions
and
87 deletions
Show diff stats
INSTALL
| ... | ... | @@ -13,13 +13,14 @@ You need to install some packages Noosfero depends on. On Debian GNU/Linux or |
| 13 | 13 | Debian-based systems, all of these packages are available through the Debian |
| 14 | 14 | archive. You can install them with the following command: |
| 15 | 15 | |
| 16 | - # aptitude install ruby rake libgettext-ruby1.8 libsqlite3-ruby rcov librmagick-ruby libredcloth-ruby libwill-paginate-ruby iso-codes libfeedparser-ruby libferret-ruby libdaemons-ruby mongrel mongrel-cluster tango-icon-theme | |
| 16 | + # apt-get install ruby rake po4a libgettext-ruby-util libgettext-ruby1.8 libsqlite3-ruby rcov librmagick-ruby libredcloth-ruby libwill-paginate-ruby iso-codes libfeedparser-ruby libferret-ruby libdaemons-ruby mongrel mongrel-cluster tango-icon-theme | |
| 17 | 17 | |
| 18 | 18 | On other systems, they may or may not be available through your regular package |
| 19 | 19 | management system. Below are the links to their homepages. |
| 20 | 20 | |
| 21 | 21 | * Ruby: http://www.ruby-lang.org/ |
| 22 | 22 | * Rake: http://rake.rubyforge.org/ |
| 23 | +* po4a: http://po4a.alioth.debian.org/ | |
| 23 | 24 | * Ruby-GetText: http://www.yotabanana.com/hiki/ruby-gettext.html?ruby-gettext (at least version 1.9.0) |
| 24 | 25 | * Ruby-sqlite3: http://rubyforge.org/projects/sqlite-ruby |
| 25 | 26 | * rcov: http://eigenclass.org/hiki/rcov |
| ... | ... | @@ -33,78 +34,168 @@ management system. Below are the links to their homepages. |
| 33 | 34 | * Mongrel: http://mongrel.rubyforge.org/ |
| 34 | 35 | * tango-icon-theme: http://tango.freedesktop.org/Tango_Icon_Library |
| 35 | 36 | |
| 36 | -If you manage to install Noosfero successfully, please feel free to contact the | |
| 37 | -Noosfero development mailing with the instructions for doing so, and we'll | |
| 38 | -include it here. | |
| 37 | +Note: the tango-icon-theme package is not available in Debian Lenny's main | |
| 38 | +repository, because back then it was not DFSG-free (Debian Squeeze will have it | |
| 39 | +in main). You can either add the non-free repository to your sources.list file, | |
| 40 | +or download the .deb directly and install it manually with `dpkg -i`. In this | |
| 41 | +case will need do install hicolor-icon-theme as well bacause tango-icon-theme | |
| 42 | +depends on it. After that you can try the command line above again, but | |
| 43 | +without "tango-icon-theme". | |
| 44 | + | |
| 45 | +If you manage to install Noosfero successfully on other systems than Debian, | |
| 46 | +please feel free to contact the Noosfero development mailing with the | |
| 47 | +instructions for doing so, and we'll include it here. | |
| 39 | 48 | |
| 40 | 49 | === Setting up a production environment |
| 41 | 50 | |
| 51 | +As root user | |
| 52 | +============ | |
| 53 | + | |
| 42 | 54 | NOTE: these instructions are for seting up a *production* environment. If you |
| 43 | -are going to do Noosfero development, you don't need to do these steps. See the | |
| 44 | -HACKING file instead. | |
| 55 | +are going to do Noosfero development, you don't need to do these steps. Stop | |
| 56 | +here and see the HACKING file instead. | |
| 57 | + | |
| 58 | +Install memcached. On Debian: | |
| 59 | + | |
| 60 | +# sudo apt-get install memcached | |
| 61 | + | |
| 62 | +Study whether you need to raise the ammount of memory it uses for caching, | |
| 63 | +depending on the demand you expect for your site. If you are going to run a | |
| 64 | +high-traffic site, you will want to raise the ammount of memory reserved for | |
| 65 | +caching. | |
| 66 | + | |
| 67 | +It is recommended that you run noosfero with its own user account. To create | |
| 68 | +such an account, please do the following: | |
| 69 | + | |
| 70 | +# sudo adduser --system --group noosfero --shell /bin/sh --home /var/lib/noosfero noosfero | |
| 71 | + | |
| 72 | +(note that you can change the $HOME directory of the user if you wish, here we | |
| 73 | +are using /var/lib/noosfero) | |
| 74 | + | |
| 75 | +The --system option will tell adduser to create a system user, i.e. this user | |
| 76 | +will not have a password and cannot login to the system directly. To become | |
| 77 | +this user, you have to use sudo: | |
| 78 | + | |
| 79 | +# sudo -u noosfero -i | |
| 80 | + | |
| 81 | +or | |
| 82 | + | |
| 83 | +# sudo su - noosfero | |
| 84 | + | |
| 85 | +As noosfero user | |
| 86 | +================ | |
| 87 | + | |
| 88 | +Enter the directory where you unpacked noosfero (or do it now and enter the | |
| 89 | +directory). Here we are cloning the noosfero repository from git, but you can | |
| 90 | +do it with a tarball as well. | |
| 91 | + | |
| 92 | +$ git clone git://git.colivre.coop.br/noosfero.git current | |
| 93 | +$ cd current | |
| 94 | +$ git checkout -b stable origin/stable | |
| 95 | + | |
| 96 | +Copy config/ferret_server.yml.dist to config/ferret_server.yml. You will | |
| 97 | +probably not need to customize this configuration, but have a look at it. | |
| 98 | + | |
| 99 | +Create the mongrel configuration file: | |
| 100 | + | |
| 101 | +$ mongrel_rails cluster::configure | |
| 102 | + | |
| 103 | +Edit config/mongrel_cluster.yml to suit your needs. Make sure your apache | |
| 104 | +configuration matches the mongrel cluster configuration, specially in respect | |
| 105 | +to the ports and numbers of mongrel instances. | |
| 106 | + | |
| 107 | +Note: currently Noosfero only supports Rails 2.1.0, which is the version in | |
| 108 | +Debian Lenny. If you have a Rails version newer than that, Noosfero will | |
| 109 | +probably not work. You can install Rails 2.1.0 into your Noosfero installation | |
| 110 | +with the following procedure: | |
| 111 | + | |
| 112 | +$ cd /var/lib/noosfero/current/vendor | |
| 113 | +$ wget http://ftp.de.debian.org/debian/pool/main/r/rails/rails_2.1.0.orig.tar.gz | |
| 114 | +$ tar xzf rails_2.1.0.orig.tar.gz | |
| 115 | +$ ln -s rails-2.1.0 rails | |
| 116 | + | |
| 117 | +As root user | |
| 118 | +============ | |
| 119 | + | |
| 120 | +Setup Noosfero log and tmp directories: | |
| 121 | + | |
| 122 | +# cd /var/lib/noosfero/current | |
| 123 | +# sudo etc/init.d/noosfero setup | |
| 124 | + | |
| 125 | +Now it's time to setup the database. In this example we are using PostgreSQL, | |
| 126 | +so if you are planning to use a different database this steps won't apply. | |
| 127 | + | |
| 128 | +# apt-get install postgresql libpgsql-ruby | |
| 129 | +# su postgres -c 'createuser noosfero' | |
| 130 | +Shall the new role be a superuser? (y/n) n | |
| 131 | +Shall the new role be allowed to create databases? (y/n) y | |
| 132 | +Shall the new role be allowed to create more new roles? (y/n) n | |
| 133 | + | |
| 134 | +As noosfero user | |
| 135 | +================ | |
| 136 | + | |
| 137 | +Now create the databases: | |
| 138 | + | |
| 139 | +$ cd /var/lib/noosfero/current | |
| 140 | +$ createdb noosfero_production | |
| 141 | +$ createdb noosfero_development | |
| 142 | +$ createdb noosfero_test | |
| 45 | 143 | |
| 46 | -* install memcached. Study whether you need to raise the ammount of memory it uses for caching, depending on the demand you expect for your site. | |
| 47 | -* enter the directory where you unpacked noosfero | |
| 48 | -* copy config/ferret_server.yml.dist to config/ferret_server.yml | |
| 49 | -* create the mongrel configuration file: `mongrel_rails cluster::configure` | |
| 50 | -** then edit config/mongrel_cluster.yml to suit your environment. Make sure your apache configuration matches the mongrel cluster configuration, specially in respect to the ports and numbers of mongrel instances. | |
| 51 | -* create needed temporary directories: | |
| 52 | - mkdir tmp | |
| 53 | - mkdir tmp/pids | |
| 54 | - mkdir log | |
| 55 | -* create database (example using PostgreSQL, YMMV) | |
| 144 | +The development and test databases are actually optional. If you are creating a | |
| 145 | +stricly production server, you will probably not need them. | |
| 56 | 146 | |
| 57 | - root user | |
| 58 | - ========= | |
| 59 | - # sudo apt-get install postgresql libpgsql-ruby | |
| 60 | - # su - postgres | |
| 147 | +Now we want to configure Noosfero for accessing the database we just created. | |
| 148 | +To do that, you can 1) copy config/database.yml.pgsql to config/database.yml, | |
| 149 | +or create config/database.yml from scratch with the following content: | |
| 61 | 150 | |
| 62 | - postgres user | |
| 63 | - ============= | |
| 64 | - postgres@HOST:~$ createuser noosfero | |
| 65 | - Shall the new role be a superuser? (y/n) n | |
| 66 | - Shall the new role be allowed to create databases? (y/n) y | |
| 67 | - Shall the new role be allowed to create more new roles? (y/n) n | |
| 151 | + production: | |
| 152 | + adapter: postgresql | |
| 153 | + encoding: unicode | |
| 154 | + database: noosfero_production | |
| 155 | + username: noosfero | |
| 68 | 156 | |
| 69 | - noosfero_user | |
| 70 | - ============= | |
| 71 | - createdb noosfero_production | |
| 72 | - createdb noosfero_development | |
| 73 | - createdb noosfero_test | |
| 157 | +Now, to test the database access, you can fire the Rails database console: | |
| 74 | 158 | |
| 75 | -* configure database access in config/database.yml | |
| 159 | +$ ./script/dbconsole production | |
| 76 | 160 | |
| 77 | -* test database access: | |
| 78 | -** first create the development database | |
| 79 | - rake db:schema:load | |
| 80 | -** if everything goes right, then create the production database: | |
| 81 | - RAILS_ENV=production rake db:schema:load | |
| 161 | +If it connects to your database, then everything is fine. If you got an error | |
| 162 | +message, then you have to check your database configuration. | |
| 82 | 163 | |
| 83 | -* create sample data: | |
| 84 | - RAILS_ENV=production rake db:populate | |
| 164 | +Create the database structure: | |
| 85 | 165 | |
| 86 | -* Add the domain name you will be using for your noosfero site to the list of | |
| 87 | - environment domain, like this: | |
| 166 | +$ RAILS_ENV=production rake db:schema:load | |
| 88 | 167 | |
| 89 | - ./script/runner "Environment.default.domains << Domain.new(:name => 'your.domain.com')" | |
| 168 | +Now we have to create some initial data. To create your default environment | |
| 169 | +(the first one), run the command below: | |
| 90 | 170 | |
| 91 | - (of course, replace your.domain.com with your real domain) | |
| 171 | +$ RAILS_ENV=production ./script/runner 'Environment.create!(:name => "My environment", :is_default => true)' | |
| 92 | 172 | |
| 93 | -* compile the translations: | |
| 94 | - rake makemo | |
| 173 | +(of course, replace "My environment" with your environment's name!) | |
| 95 | 174 | |
| 96 | -* start the server: | |
| 97 | - ./script/production start | |
| 175 | +And now you have to add the domain name you will be using for your noosfero | |
| 176 | +site to the list of domains of that default environment you just created: | |
| 98 | 177 | |
| 99 | -* to stop the server: | |
| 178 | +$ RAILS_ENV=production ./script/runner "Environment.default.domains << Domain.new(:name => 'your.domain.com')" | |
| 100 | 179 | |
| 101 | - ./script/production stop | |
| 180 | +(replace "your.domain.com" with your actual domain name) | |
| 102 | 181 | |
| 103 | -* to restart the server: | |
| 182 | +Compile the translations: | |
| 104 | 183 | |
| 105 | - ./script/production restart | |
| 184 | +$ RAILS_ENV=production rake noosfero:translations:compile | |
| 106 | 185 | |
| 107 | -* enable the following apache modules: | |
| 186 | +To start the Noosfero application servers: | |
| 187 | + | |
| 188 | +$ ./script/production start | |
| 189 | + | |
| 190 | +At this point you have a functional Noosfero installation running, the only | |
| 191 | +thing left is to configure your webserver as a reverse proxy to pass requests | |
| 192 | +to them. | |
| 193 | + | |
| 194 | +==================== | |
| 195 | +Apache configuration | |
| 196 | +==================== | |
| 197 | + | |
| 198 | +Firts you have to enable the following some apache modules: | |
| 108 | 199 | |
| 109 | 200 | deflate |
| 110 | 201 | expires |
| ... | ... | @@ -113,26 +204,32 @@ HACKING file instead. |
| 113 | 204 | proxy_http |
| 114 | 205 | rewrite |
| 115 | 206 | |
| 116 | - On Debian GNU/Linux system, these modules can be enabled with the following | |
| 117 | - command line, as root: | |
| 207 | +On Debian GNU/Linux system, these modules can be enabled with the following | |
| 208 | +command line, as root: | |
| 118 | 209 | |
| 119 | - a2enmod deflate expires proxy proxy_balancer proxy_http rewrite | |
| 210 | +# a2enmod deflate expires proxy proxy_balancer proxy_http rewrite | |
| 120 | 211 | |
| 121 | - In other systems the way by which you enable apache modules may be different. | |
| 212 | +In other systems the way by which you enable apache modules may be different. | |
| 122 | 213 | |
| 123 | -* Configure apache web server as a reverse proxy. You can use the template | |
| 124 | - below, replacing /path/to/noosfero with the directory in which your noosfero | |
| 125 | - installation is, your.domain.com with the domain name of your noosfero site. | |
| 126 | - We are assuming that you are running two mongrel instances on ports 4000 and | |
| 127 | - 4001. If your setup is different you'll need to adjust <Proxy> section. If | |
| 128 | - you don't understand something in the configuration, please refer to the | |
| 129 | - apache documentation. | |
| 214 | +Now with the Apache configuration. You can use the template below, replacing | |
| 215 | +/var/lib/noosfero/current with the directory in which your noosfero | |
| 216 | +installation is, your.domain.com with the domain name of your noosfero site. | |
| 217 | +We are assuming that you are running two mongrel instances on ports 3000 and | |
| 218 | +3001. If your setup is different you'll need to adjust <Proxy> section. If you | |
| 219 | +don't understand something in the configuration, please refer to the apache | |
| 220 | +documentation. | |
| 221 | + | |
| 222 | +Add a file called "mysite" (or whatever name you want to give to your noosfero | |
| 223 | +site) to /etc/apache2/sites-available with the following content, and customize | |
| 224 | +as needed (as usual, make sure you replace "your.domain.com" with you actual | |
| 225 | +domain name, and "/var/lib/noosfero/current" with the directory where Noosfero | |
| 226 | +is installed): | |
| 130 | 227 | |
| 131 | 228 | <VirtualHost *:80> |
| 132 | 229 | ServerName your.domain.com |
| 133 | 230 | |
| 134 | - DocumentRoot "/path/to/noosfero/public" | |
| 135 | - <Directory "/path/to/noosfero/public"> | |
| 231 | + DocumentRoot "/var/lib/noosfero/current/public" | |
| 232 | + <Directory "/var/lib/noosfero/current/public"> | |
| 136 | 233 | Options FollowSymLinks |
| 137 | 234 | AllowOverride None |
| 138 | 235 | Order Allow,Deny |
| ... | ... | @@ -156,18 +253,94 @@ HACKING file instead. |
| 156 | 253 | LogLevel warn |
| 157 | 254 | CustomLog /var/log/apache2/noosfero.access.log combined |
| 158 | 255 | |
| 159 | - Include /path/to/noosfero/etc/noosfero/apache/cache.conf | |
| 256 | + Include /var/lib/noosfero/current/etc/noosfero/apache/cache.conf | |
| 160 | 257 | |
| 161 | 258 | </VirtualHost> |
| 162 | 259 | |
| 163 | 260 | <Proxy balancer://noosfero> |
| 164 | - BalancerMember http://127.0.0.1:4000 | |
| 165 | - BalancerMember http://127.0.0.1:4001 | |
| 261 | + BalancerMember http://127.0.0.1:3000 | |
| 262 | + BalancerMember http://127.0.0.1:3001 | |
| 166 | 263 | Order Allow,Deny |
| 167 | 264 | Allow from All |
| 168 | 265 | </Proxy> |
| 169 | 266 | |
| 170 | - The cache.conf file included in the end of the <VirtualHost> section is | |
| 171 | - important, since it will tell apache to pass expiration and cache headers to | |
| 172 | - clients so that the site feels faster for users. Do we need to say that using | |
| 173 | - that configuration is strongly recommended? | |
| 267 | +The cache.conf file included in the end of the <VirtualHost> section is | |
| 268 | +important, since it will tell apache to pass expiration and cache headers to | |
| 269 | +clients so that the site feels faster for users. Do we need to say that using | |
| 270 | +that configuration is strongly recommended? | |
| 271 | + | |
| 272 | +Enable that site with (as root, replace "mysite" with the actual name you gave | |
| 273 | +to your site configuration): | |
| 274 | + | |
| 275 | +# a2ensite mysite | |
| 276 | + | |
| 277 | +Now restart your apache server (as root): | |
| 278 | + | |
| 279 | +# invoke-rc.d apache2 restart | |
| 280 | + | |
| 281 | +============ | |
| 282 | +Maintainance | |
| 283 | +============ | |
| 284 | + | |
| 285 | +To ease the maintainance, install a symbolic link for the Noosfero startup | |
| 286 | +script in your server and add it to the system initialization and shutdown | |
| 287 | +sequences (as root): | |
| 288 | + | |
| 289 | +# ln -s /var/lib/noosfero/current/etc/init.d/noosfero /etc/init.d/noosfero | |
| 290 | +# update-rc.d noosfero defaults | |
| 291 | + Adding system startup for /etc/init.d/noosfero ... | |
| 292 | + /etc/rc0.d/K20noosfero -> ../init.d/noosfero | |
| 293 | + /etc/rc1.d/K20noosfero -> ../init.d/noosfero | |
| 294 | + /etc/rc6.d/K20noosfero -> ../init.d/noosfero | |
| 295 | + /etc/rc2.d/S20noosfero -> ../init.d/noosfero | |
| 296 | + /etc/rc3.d/S20noosfero -> ../init.d/noosfero | |
| 297 | + /etc/rc4.d/S20noosfero -> ../init.d/noosfero | |
| 298 | + /etc/rc5.d/S20noosfero -> ../init.d/noosfero | |
| 299 | + | |
| 300 | +Now to start Noosfero, you do as root: | |
| 301 | + | |
| 302 | +# invoke-rc.d noosfero start | |
| 303 | + | |
| 304 | +To stop Noosfero: | |
| 305 | + | |
| 306 | +# invoke-rc.d noosfero start | |
| 307 | + | |
| 308 | +To restart Noosfero: | |
| 309 | + | |
| 310 | +# invoke-rc.d noosfero restart | |
| 311 | + | |
| 312 | +Noosfero will be automatically started during system boot, and automatically | |
| 313 | +stopped if the system shuts down for some reason (or during the shutdown part | |
| 314 | +of a reboot). | |
| 315 | + | |
| 316 | +========= | |
| 317 | +Upgrading | |
| 318 | +========= | |
| 319 | + | |
| 320 | +If you followed the steps in this document and installed Noosfero from the git | |
| 321 | +repository, then upgrading is easy. First, you need to allow the noosfero user | |
| 322 | +to restart the memcached server with sudo, by adding the following line in | |
| 323 | +/etc/sudoers: | |
| 324 | + | |
| 325 | +noosfero ALL=NOPASSWD: /etc/init.d/memcached | |
| 326 | + | |
| 327 | +Then, to perform an upgrade, do the following as the noosfero user: | |
| 328 | + | |
| 329 | +$ cd /var/lib/noosfero/current | |
| 330 | +$ ./script/git-upgrade | |
| 331 | + | |
| 332 | +The git-upgrade script will take care of everything for you. It will first stop | |
| 333 | +the service, then fetch the current source code, upgrade database, compile | |
| 334 | +translations, and then start the service again. | |
| 335 | + | |
| 336 | +Note 1: make sure your local git repository is following the "stable" branch, | |
| 337 | +just like the instructions above. The "master" branch is not recommended for | |
| 338 | +use in production environments. | |
| 339 | + | |
| 340 | +Note 2: always read the release notes before upgrading. Sometimes there will be | |
| 341 | +steps that must be performed manually. If that is the case, you can invoke the | |
| 342 | +git-upgrade script with the special parameter "--shell" that will give you a | |
| 343 | +shell after the upgrade, which you can use to perform any manual steps | |
| 344 | +required: | |
| 345 | + | |
| 346 | +$ ./script/git-upgrade --shell | ... | ... |
app/helpers/application_helper.rb
| ... | ... | @@ -901,7 +901,7 @@ module ApplicationHelper |
| 901 | 901 | end |
| 902 | 902 | |
| 903 | 903 | def page_title |
| 904 | - (@page ? @page.name + ' - ' : '') + | |
| 904 | + (@page ? @page.title + ' - ' : '') + | |
| 905 | 905 | (profile ? profile.short_name + ' - ' : '') + |
| 906 | 906 | (@topic ? @topic.title + ' - ' : '') + |
| 907 | 907 | (@section ? @section.title + ' - ' : '') + | ... | ... |
app/helpers/content_viewer_helper.rb
app/models/uploaded_file.rb
| ... | ... | @@ -5,6 +5,11 @@ |
| 5 | 5 | class UploadedFile < Article |
| 6 | 6 | |
| 7 | 7 | settings_items :title, :type => 'string' |
| 8 | + def title_with_default | |
| 9 | + title_without_default || name | |
| 10 | + end | |
| 11 | + alias_method_chain :title, :default | |
| 12 | + | |
| 8 | 13 | validates_size_of :title, :maximum => 60, :if => (lambda { |file| !file.title.blank? }) |
| 9 | 14 | |
| 10 | 15 | def display_title | ... | ... |
config/database.yml.pgsql
| ... | ... | @@ -33,7 +33,7 @@ development: |
| 33 | 33 | # Warning: The database defined as "test" will be erased and |
| 34 | 34 | # re-generated from your development database when you run "rake". |
| 35 | 35 | # Do not set this db to the same as development or production. |
| 36 | -test:&TEST | |
| 36 | +test: &TEST | |
| 37 | 37 | adapter: postgresql |
| 38 | 38 | encoding: unicode |
| 39 | 39 | database: noosfero_test | ... | ... |
etc/init.d/noosfero
| ... | ... | @@ -26,13 +26,17 @@ DESC="Noosfero web platform" |
| 26 | 26 | NAME=noosfero |
| 27 | 27 | SCRIPTNAME=/etc/init.d/$NAME |
| 28 | 28 | |
| 29 | +# default values | |
| 30 | +NOOSFERO_DIR=/var/lib/noosfero/current | |
| 31 | +NOOSFERO_USER=noosfero | |
| 32 | + | |
| 29 | 33 | # Read configuration variable file if it is present |
| 30 | 34 | [ -r /etc/default/$NAME ] && . /etc/default/$NAME |
| 31 | 35 | |
| 32 | 36 | # Load the VERBOSE setting and other rcS variables |
| 33 | 37 | . /lib/init/vars.sh |
| 34 | 38 | |
| 35 | -if [ -z $NOOSFERO_DIR ] || [ -z $NOOSFERO_USER ]; then | |
| 39 | +if [ -z "$NOOSFERO_DIR" ] || [ -z "$NOOSFERO_USER" ]; then | |
| 36 | 40 | echo "NOOSFERO_DIR or NOOSFERO_USER not defined, noosfero not being started." |
| 37 | 41 | echo "Both variables must be defined in /etc/default/noosfero" |
| 38 | 42 | exit 0 |
| ... | ... | @@ -50,14 +54,7 @@ main_script() { |
| 50 | 54 | fi |
| 51 | 55 | } |
| 52 | 56 | |
| 53 | -do_start() { | |
| 54 | - | |
| 55 | - # FIXME should not test for ferret only | |
| 56 | - if [ -e $FERRET_PID_FILE ]; then | |
| 57 | - echo 'noosfero already running, cannot start.' | |
| 58 | - exit 2 | |
| 59 | - fi | |
| 60 | - | |
| 57 | +do_setup() { | |
| 61 | 58 | # PID directories |
| 62 | 59 | if [ ! -d /var/run/noosfero ]; then |
| 63 | 60 | mkdir /var/run/noosfero |
| ... | ... | @@ -89,6 +86,17 @@ do_start() { |
| 89 | 86 | if [ ! -e $NOOSFERO_DIR/log ]; then |
| 90 | 87 | ln -s /var/log/noosfero $NOOSFERO_DIR/log |
| 91 | 88 | fi |
| 89 | +} | |
| 90 | + | |
| 91 | +do_start() { | |
| 92 | + | |
| 93 | + # FIXME should not test for ferret only | |
| 94 | + if [ -e $FERRET_PID_FILE ]; then | |
| 95 | + echo 'noosfero already running, cannot start.' | |
| 96 | + exit 2 | |
| 97 | + fi | |
| 98 | + | |
| 99 | + do_setup | |
| 92 | 100 | |
| 93 | 101 | # actually start the service |
| 94 | 102 | main_script start |
| ... | ... | @@ -111,11 +119,11 @@ do_restart() { |
| 111 | 119 | } |
| 112 | 120 | |
| 113 | 121 | case "$1" in |
| 114 | - start|stop|restart) | |
| 122 | + start|stop|restart|setup) | |
| 115 | 123 | do_$1 |
| 116 | 124 | ;; |
| 117 | 125 | *) |
| 118 | - echo "Usage: $SCRIPTNAME {start|stop|restart}" >&2 | |
| 126 | + echo "Usage: $SCRIPTNAME {start|stop|restart|setup}" >&2 | |
| 119 | 127 | exit 3 |
| 120 | 128 | ;; |
| 121 | 129 | esac | ... | ... |
features/gallery_navigation.feature
| ... | ... | @@ -63,3 +63,12 @@ Feature: gallery_navigation |
| 63 | 63 | Then I should see "Go back to my-gallery" |
| 64 | 64 | When I follow "Go back to my-gallery" |
| 65 | 65 | Then I should be on /marciopunk/my-gallery |
| 66 | + | |
| 67 | + Scenario: image title in window title | |
| 68 | + Given I am logged in as "marciopunk" | |
| 69 | + And I go to /marciopunk/my-gallery/rails.png?view=true | |
| 70 | + When I follow "Edit" | |
| 71 | + And I fill in "Title" with "Rails is cool" | |
| 72 | + And I press "Save" | |
| 73 | + And I go to /marciopunk/my-gallery/rails.png?view=true | |
| 74 | + And The page title should contain "Rails is cool" | ... | ... |
features/step_definitions/noosfero_steps.rb
test/unit/uploaded_file_test.rb
| ... | ... | @@ -143,4 +143,11 @@ class UploadedFileTest < Test::Unit::TestCase |
| 143 | 143 | assert_equal 'test.txt', upload.display_title |
| 144 | 144 | end |
| 145 | 145 | |
| 146 | + should 'use name as title by default' do | |
| 147 | + upload = UploadedFile.new | |
| 148 | + upload.stubs(:name).returns('test.txt') | |
| 149 | + | |
| 150 | + assert_equal 'test.txt', upload.title | |
| 151 | + end | |
| 152 | + | |
| 146 | 153 | end | ... | ... |