Commit 9b7faea1db2d4e50b224d266887e988ce6fc8f09

Authored by Antonio Terceiro
Committed by Daniela Feitosa
1 parent 444059a1

Initial Debian packaging

app/models/image.rb
... ... @@ -7,6 +7,7 @@ class Image < ActiveRecord::Base
7 7  
8 8 has_attachment :content_type => :image,
9 9 :storage => :file_system,
  10 + :path_prefix => 'public/image_uploads',
10 11 :resize_to => '320x200>',
11 12 :thumbnails => { :big => '150x150',
12 13 :thumb => '100x100',
... ...
config/environment.rb
... ... @@ -19,7 +19,7 @@ extra_controller_dirs = %w[
19 19 ].map {|item| File.join(RAILS_ROOT, item) }
20 20  
21 21 def noosfero_session_secret
22   - file = File.join(File.dirname(__FILE__), 'session.secret')
  22 + file = File.join(File.dirname(__FILE__), '/../tmp/session.secret')
23 23 if !File.exists?(file)
24 24 secret = (1..128).map { %w[0 1 2 3 4 5 6 7 8 9 a b c d e f][rand(16)] }.join('')
25 25 File.open(file, 'w') do |f|
... ... @@ -56,7 +56,14 @@ Rails::Initializer.run do |config|
56 56 # config.active_record.observers = :cacher, :garbage_collector
57 57  
58 58 # don't load the sweepers while loading the database
59   - unless $PROGRAM_NAME =~ /rake$/ && (ARGV.first == 'db:schema:load' || ARGV.first == 'gems:install')
  59 + ignore_rake_commands = %w[
  60 + db:schema:load
  61 + gems:install
  62 + clobber
  63 + noosfero:translations:compile
  64 + makemo
  65 + ]
  66 + unless $PROGRAM_NAME =~ /rake$/ && (ignore_rake_commands.include?(ARGV.first))
60 67 config.active_record.observers = :article_sweeper, :role_assignment_sweeper, :friendship_sweeper, :category_sweeper
61 68 end
62 69 # Make Active Record use UTC-base instead of local time
... ...
config/initializers/default_icon_theme.rb
1   -# create the symlink to the default theme if it does not exist
2   -default = File.join(RAILS_ROOT, 'public', 'designs', 'icons', 'default')
3   -if !File.exists?(default)
4   - File.symlink('tango', default)
5   -end
  1 +if File.writable?(Rails.root)
  2 + # create the symlink to the default theme if it does not exist
  3 + default = File.join(RAILS_ROOT, 'public', 'designs', 'icons', 'default')
  4 + if !File.exists?(default)
  5 + File.symlink('tango', default)
  6 + end
6 7  
7   -# create a symlink to system-wide Tango icon set if it does not exist
8   -tango_symlink = File.join(RAILS_ROOT, 'public', 'designs', 'icons', 'tango', 'Tango')
9   -if !File.exist?(tango_symlink)
10   - File.symlink('/usr/share/icons/Tango', tango_symlink)
  8 + # create a symlink to system-wide Tango icon set if it does not exist
  9 + tango_symlink = File.join(RAILS_ROOT, 'public', 'designs', 'icons', 'tango', 'Tango')
  10 + if !File.exist?(tango_symlink)
  11 + File.symlink('/usr/share/icons/Tango', tango_symlink)
  12 + end
11 13 end
... ...
config/initializers/default_theme.rb
1   -# create the symlink to the default theme if it does not exist
2   -default = File.join(RAILS_ROOT, 'public', 'designs', 'themes', 'default')
3   -if !File.exists?(default)
4   - File.symlink('noosfero', default)
  1 +if File.writable?(Rails.root)
  2 + # create the symlink to the default theme if it does not exist
  3 + default = File.join(RAILS_ROOT, 'public', 'designs', 'themes', 'default')
  4 + if !File.exists?(default)
  5 + File.symlink('noosfero', default)
  6 + end
5 7 end
... ...
config/initializers/image_uploads.rb 0 → 100644
... ... @@ -0,0 +1,12 @@
  1 +if File.writable?(Rails.root)
  2 + misplaced_directories = Dir.glob(Rails.root + '/public/images/[0-9]*')
  3 + unless misplaced_directories.empty?
  4 + new_location = Rails.root + '/public/image_uploads'
  5 + if !File.exists?(new_location)
  6 + FileUtils.mkdir(new_location)
  7 + end
  8 + misplaced_directories.each do |path|
  9 + FileUtils.mv(path, new_location)
  10 + end
  11 + end
  12 +end
... ...
debian/README.Debian 0 → 100644
... ... @@ -0,0 +1,13 @@
  1 +Noosfero for Debian
  2 +-------------------
  3 +
  4 +In order to function properly, Noosfero needs a working e-mail setup. You need
  5 +to make sure that your local MTA is able to deliver messages to the internet.
  6 +
  7 +Alternatively, you can also configure Noosfero to use an external SMTP server
  8 +by means of the file /etc/noosfero/local.rb. To do that, follow the
  9 +instructions at the following URL:
  10 +
  11 +http://noosfero.org/Development/SMTPMailSending
  12 +
  13 + -- Antonio Terceiro <terceiro@softwarelivre.org> Thu, 27 Jan 2011 19:48:03 -0300
... ...
debian/TODO 0 → 100644
... ... @@ -0,0 +1,25 @@
  1 +=================================================================================
  2 +
  3 +install config/noosfero.yml
  4 +
  5 +how to handle local themes?
  6 +
  7 +create admin user during installation using debconf to prompt for password
  8 +
  9 +the `noosfero` postgres user must have permission to drop and create schemas.
  10 +
  11 +e-mail setup?
  12 +noosfero setup
  13 +
  14 +install varnish conf - create package noosfero-varnish?
  15 +
  16 +remove /etc/noosfero/database.yml in postrm/purge!
  17 +
  18 +remove /etc/noosfero in postrm/purge! in special:
  19 + /etc/noosfero/apache/mongrel.conf
  20 +
  21 +fix problems reported by lintian (start by removing the overrides)
  22 +
  23 +try to get rid of dependencies that should be needed only in development (such
  24 +as rcov)
  25 +
... ...
debian/apache2/conf.d/noosfero-mongrel.conf 0 → 100644
... ... @@ -0,0 +1,7 @@
  1 +<Proxy balancer://noosfero>
  2 + Include /etc/noosfero/apache/mongrel.conf
  3 + Order Allow,Deny
  4 + Allow from All
  5 +</Proxy>
  6 +
  7 +# vim: ft=apache
... ...
debian/apache2/virtualhost.conf 0 → 100644
... ... @@ -0,0 +1,38 @@
  1 +DocumentRoot "/usr/share/noosfero/public"
  2 +<Directory "/var/lib/noosfero/current/public">
  3 + Options FollowSymLinks -Indexes
  4 + AllowOverride None
  5 + Order Allow,Deny
  6 + Allow from all
  7 +</Directory>
  8 +
  9 +RewriteEngine On
  10 +
  11 +# Rewrite index to check for static index.html
  12 +RewriteRule ^/$ /index.html [QSA]
  13 +
  14 +# Rewrite to check for Rails cached page
  15 +RewriteRule ^([^.]+)$ $1.html [QSA]
  16 +
  17 +RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
  18 +RewriteRule ^.*$ balancer://noosfero%{REQUEST_URI} [P,QSA,L]
  19 +
  20 +ErrorDocument 503 /503.html
  21 +
  22 +ErrorLog /var/log/apache2/noosfero.log
  23 +LogLevel warn
  24 +CustomLog /var/log/apache2/noosfero.access.log vhost_combined
  25 +
  26 +# Compress outgoing text content
  27 +AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/javascript
  28 +
  29 +# Add Expires: header
  30 +ExpiresActive On
  31 +ExpiresByType text/css "access plus 1 month"
  32 +ExpiresByType application/javascript "access plus 1 month"
  33 +ExpiresByType image/png "access plus 1 month"
  34 +ExpiresByType image/gif "access plus 1 month"
  35 +ExpiresByType image/jpeg "access plus 1 month"
  36 +ExpiresByType image/x-icon "access plus 1 month"
  37 +
  38 +# vim: ft=apache
... ...
debian/changelog 0 → 100644
... ... @@ -0,0 +1,5 @@
  1 +noosfero (0.28.0~1) unstable; urgency=low
  2 +
  3 + * Initial Release.
  4 +
  5 + -- Antonio Terceiro <terceiro@softwarelivre.org> Thu, 27 Jan 2011 09:49:08 -0300
... ...
debian/compat 0 → 100644
... ... @@ -0,0 +1 @@
  1 +7
... ...
debian/control 0 → 100644
... ... @@ -0,0 +1,33 @@
  1 +Source: noosfero
  2 +Section: web
  3 +Priority: extra
  4 +Maintainer: Noosfero developers <noosfero-dev@listas.softwarelivre.org>
  5 +Uploaders: Antonio Terceiro <terceiro@colivre.coop.br>
  6 +Build-Depends: debhelper (>= 7.0.50~), po4a, libgettext-ruby-util, libgettext-ruby1.8, libsqlite3-ruby1.8,
  7 +Standards-Version: 3.8.4
  8 +Homepage: http://noosfero.org/
  9 +Vcs-Git: git://git.colivre.coop.br/noosfero.git
  10 +Vcs-Browser: http://git.colivre.coop.br/?p=noosfero.git
  11 +
  12 +Package: noosfero
  13 +Architecture: all
  14 +Depends: rails, ruby1.8, ruby, rake, libgettext-ruby-data, libsqlite3-ruby, libpgsql-ruby, libmysql-ruby, librmagick-ruby, libredcloth-ruby, libwill-paginate-ruby, iso-codes, libfeedparser-ruby, libferret-ruby, libdaemons-ruby, rcov, mongrel, mongrel-cluster, tango-icon-theme, libhpricot-ruby, iso-codes, memcached, debconf, dbconfig-common, postgresql, adduser, ${misc:Depends}
  15 +Recommends: postgresql-client
  16 +Description: free web-based platform for social networks
  17 + Noosfero is a web platform for social and solidarity economy networks with
  18 + blog, e-Porfolios, CMS, RSS, thematic discussion, events agenda and collective
  19 + inteligence for solidarity economy in the same system.
  20 + .
  21 + This package contains the Noosfero application server.
  22 +
  23 +Package: noosfero-apache
  24 +Architecture: all
  25 +Depends: apache2, debconf
  26 +Suggests: noosfero
  27 +Description: free web-based platform for social networks (apache frontend)
  28 + Noosfero is a web platform for social and solidarity economy networks with
  29 + blog, e-Porfolios, CMS, RSS, thematic discussion, events agenda and collective
  30 + inteligence for solidarity economy in the same system.
  31 + .
  32 + This package contains the configuration files needed to run Noosfero with the
  33 + Apache HTTPD server as frontend.
... ...
debian/copyright 0 → 100644
... ... @@ -0,0 +1,35 @@
  1 +This work was packaged for Debian by:
  2 +
  3 + Antonio Terceiro <terceiro@colivre.coop.br> on Thu, 25 Nov 2010 16:42:48 -0300
  4 +
  5 +It was downloaded from:
  6 +
  7 + <http://noosfero.org>
  8 +
  9 +Upstream Authors:
  10 +
  11 + Too many to list here. See /usr/share/doc/noosfero/AUTHORS
  12 +
  13 +Copyright:
  14 +
  15 + Copyright (c) 2007-2009, Cáritas Brasileira <http://www.caritasbrasileira.org/>
  16 + Copyright (c) 2007-2009, Ynternet.org Foundation <http://www.ynternet.org/>
  17 + Copyright (c) 2008-2011, Colivre <http://www.colivre.coop.br/>
  18 +
  19 +License:
  20 +
  21 + This program is free software: you can redistribute it and/or modify it
  22 + under the terms of the GNU Affero General Public License as published by
  23 + the Free Software Foundation, either version 3 of the License, or (at your
  24 + option) any later version.
  25 +
  26 + This program is distributed in the hope that it will be useful, but WITHOUT
  27 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  28 + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
  29 + License for more details.
  30 +
  31 + You should have received a copy of the GNU Affero General Public License
  32 + along with this program. If not, see <http://www.gnu.org/licenses/>.
  33 +
  34 +The Debian packaging files are part of Noosfero source code, and are covered by
  35 +the same copyrights and licensing as the rest of the project.
... ...
debian/database.yml.template 0 → 100644
... ... @@ -0,0 +1,8 @@
  1 +production:
  2 + adapter: _DBC_DBTYPE_
  3 + database: _DBC_DBNAME_
  4 + encoding: unicode
  5 + username: _DBC_DBUSER_
  6 + password: _DBC_DBPASS_
  7 +
  8 +
... ...
debian/dbinstall 0 → 100755
... ... @@ -0,0 +1,11 @@
  1 +#!/bin/sh
  2 +
  3 +set -e
  4 +
  5 +# dbconfig-common uses "pgsql", but we want "postgresql"
  6 +sed -i -e 's/adapter: pgsql/adapter: postgresql/' /etc/noosfero/database.yml
  7 +
  8 +/etc/init.d/noosfero setup
  9 +
  10 +cd /usr/share/noosfero && su noosfero -c "rake db:schema:load RAILS_ENV=production"
  11 +cd /usr/share/noosfero && su noosfero -c "rake db:data:minimal RAILS_ENV=production"
... ...
debian/dbupgrade 0 → 100755
... ... @@ -0,0 +1,8 @@
  1 +#!/bin/sh
  2 +
  3 +set -e
  4 +
  5 +/etc/init.d/noosfero setup
  6 +
  7 +cd /usr/share/noosfero && su noosfero -c "rake db:migrate RAILS_ENV=production SCHEMA=/dev/null"
  8 +
... ...
debian/default/noosfero 0 → 100644
... ... @@ -0,0 +1,2 @@
  1 +NOOSFERO_DIR="/usr/share/noosfero"
  2 +NOOSFERO_USER="noosfero"
... ...
debian/docs 0 → 100644
... ... @@ -0,0 +1 @@
  1 +AUTHORS
... ...
debian/ferret_server.yml 0 → 100644
... ... @@ -0,0 +1,4 @@
  1 +production:
  2 + host: localhost
  3 + port: 51000
  4 + pid_file: tmp/pids/ferret.production.pid
... ...
debian/mongrel_cluster.yml 0 → 100644
... ... @@ -0,0 +1,10 @@
  1 +---
  2 +address: 127.0.0.1
  3 +cwd: /usr/share/noosfero
  4 +environment: production
  5 +group: noosfero
  6 +log_file: log/mongrel.log
  7 +pid_file: tmp/pids/mongrel.pid
  8 +port: 50000
  9 +servers: 1
  10 +user: noosfero
... ...
debian/noosfero-apache.config 0 → 100644
... ... @@ -0,0 +1,10 @@
  1 +#!/bin/sh
  2 +
  3 +set -e
  4 +
  5 +. /usr/share/debconf/confmodule
  6 +
  7 +db_input medium noosfero-apache/enable_apache_site || true
  8 +db_go
  9 +
  10 +#DEBHELPER#
... ...
debian/noosfero-apache.dirs 0 → 100644
... ... @@ -0,0 +1 @@
  1 +etc/noosfero/apache
... ...
debian/noosfero-apache.install 0 → 100644
... ... @@ -0,0 +1,3 @@
  1 +debian/apache2/conf.d/noosfero-mongrel.conf etc/apache2/conf.d
  2 +debian/apache2/virtualhost.conf etc/noosfero/apache
  3 +debian/update-noosfero-apache usr/sbin
... ...
debian/noosfero-apache.postinst 0 → 100644
... ... @@ -0,0 +1,25 @@
  1 +#!/bin/sh
  2 +
  3 +set -e
  4 +
  5 +. /usr/share/debconf/confmodule
  6 +
  7 +db_get noosfero-apache/enable_apache_site
  8 +enable_apache_site="$RET"
  9 +
  10 +if test -x /usr/sbin/a2enmod; then
  11 + a2enmod deflate expires proxy proxy_balancer proxy_http rewrite
  12 +fi
  13 +
  14 +if which update-noosfero-apache >/dev/null; then
  15 +
  16 +
  17 + update-noosfero-apache
  18 +
  19 + if [ "$enable_apache_site" = 'true' ]; then
  20 + a2ensite noosfero
  21 + invoke-rc.d apache2 reload
  22 + fi
  23 +fi
  24 +
  25 +#DEBHELPER#
... ...
debian/noosfero-apache.templates 0 → 100644
... ... @@ -0,0 +1,13 @@
  1 +Template: noosfero-apache/enable_apache_site
  2 +Type: boolean
  3 +Default: true
  4 +Description: Enable Noosfero in Apache?
  5 + If you choose "Yes" here, them Noosfero's apache site will be automatically
  6 + enabled and Noosfero will be immediately available through Apache using the
  7 + domain name you choose before.
  8 + .
  9 + This option will not interfere with anything besides the domain name you chose
  10 + for your Noosfero site, so if this is a new server installation, you should
  11 + probably answer "Yes". If, for any reason, you do not want to enable Noosfero
  12 + in Apache right now, then you should answer "No". You can enable Noosfero
  13 + later by running `a2ensite nooosfero`.
... ...
debian/noosfero.config 0 → 100644
... ... @@ -0,0 +1,21 @@
  1 +#!/bin/sh
  2 +
  3 +set -e
  4 +
  5 +. /usr/share/debconf/confmodule
  6 +if [ -f /usr/share/dbconfig-common/dpkg/config ]; then
  7 + # comma-separated, e.g. "mysql, pgsql, sqlite3"
  8 + dbc_dbtypes="pgsql"
  9 +
  10 + . /usr/share/dbconfig-common/dpkg/config
  11 + dbc_go noosfero $@
  12 +
  13 + if [ "$dbc_install" = 'true' ]; then
  14 + db_input high noosfero/initial_domain || true
  15 + db_go
  16 + fi
  17 +
  18 + db_input high noosfero/email_setup_warning | true
  19 + db_go
  20 +
  21 +fi
... ...
debian/noosfero.dirs 0 → 100644
... ... @@ -0,0 +1,3 @@
  1 +etc/noosfero
  2 +etc/noosfero/plugins
  3 +usr/share/noosfero/locale
... ...
debian/noosfero.install 0 → 100644
... ... @@ -0,0 +1,35 @@
  1 +app usr/share/noosfero
  2 +db usr/share/noosfero
  3 +doc usr/share/noosfero
  4 +lib usr/share/noosfero
  5 +script usr/share/noosfero
  6 +util usr/share/noosfero
  7 +Rakefile usr/share/noosfero
  8 +vendor/cardmagic-contacts-f66219e6589ccaf3ab9e3574fdd41225d0dd5073 usr/share/noosfero/vendor
  9 +vendor/gdata-1.1.1 usr/share/noosfero/vendor
  10 +vendor/plugins usr/share/noosfero/vendor
  11 +vendor/terceiro-fast_gettext-fe7bb09e30f7b1b5876a3b7a18fe8a254c6f59cb usr/share/noosfero/vendor
  12 +vendor/ezcrypto-0.7.2 usr/share/noosfero/vendor
  13 +
  14 +config/boot.rb usr/share/noosfero/config
  15 +config/environment.rb usr/share/noosfero/config
  16 +config/environments usr/share/noosfero/config
  17 +config/initializers usr/share/noosfero/config
  18 +config/routes.rb usr/share/noosfero/config
  19 +
  20 +plugins usr/share/noosfero
  21 +
  22 +debian/dbinstall usr/lib/noosfero
  23 +debian/dbupgrade usr/lib/noosfero
  24 +debian/database.yml.template usr/share/noosfero/config
  25 +
  26 +public usr/share/noosfero
  27 +
  28 +debian/default/noosfero etc/default
  29 +etc/init.d/noosfero etc/init.d
  30 +debian/mongrel_cluster.yml etc/noosfero
  31 +debian/ferret_server.yml etc/noosfero
  32 +etc/logrotate.d/noosfero etc/logrotate.d
  33 +
  34 +locale usr/share/noosfero
  35 +doc/noosfero usr/share/noosfero/doc
... ...
debian/noosfero.links 0 → 100644
... ... @@ -0,0 +1,19 @@
  1 +usr/share/rails usr/share/noosfero/vendor/rails
  2 +var/tmp/noosfero usr/share/noosfero/tmp
  3 +var/log/noosfero usr/share/noosfero/log
  4 +etc/noosfero/database.yml usr/share/noosfero/config/database.yml
  5 +etc/noosfero/mongrel_cluster.yml usr/share/noosfero/config/mongrel_cluster.yml
  6 +etc/noosfero/ferret_server.yml usr/share/noosfero/config/ferret_server.yml
  7 +etc/noosfero/plugins usr/share/noosfero/config/plugins
  8 +etc/noosfero/noosfero.yml usr/share/noosfero/config/noosfero.yml
  9 +etc/noosfero/local.rb usr/share/noosfero/config/local.rb
  10 +var/lib/noosfero-data/index usr/share/noosfero/index
  11 +var/lib/noosfero-data/cache/cache-general.js usr/share/noosfero/public/javascripts/cache-general.js
  12 +var/lib/noosfero-data/cache/cache-chat.js usr/share/noosfero/public/javascripts/cache-chat.js
  13 +var/lib/noosfero-data/cache/cache-slideshow.js usr/share/noosfero/public/javascripts/cache-slideshow.js
  14 +var/lib/noosfero-data/cache/cache.css usr/share/noosfero/public/stylesheets/cache.css
  15 +var/lib/noosfero-data/public/articles usr/share/noosfero/public/articles
  16 +var/lib/noosfero-data/public/image_uploads usr/share/noosfero/public/image_uploads
  17 +var/lib/noosfero-data/public/thumbnails usr/share/noosfero/public/thumbnails
  18 +usr/share/noosfero/public/designs/themes/noosfero usr/share/noosfero/public/designs/themes/default
  19 +usr/share/noosfero/public/designs/icons/tango usr/share/noosfero/public/designs/icons/icons/default
... ...
debian/noosfero.lintian-overrides 0 → 100644
... ... @@ -0,0 +1,6 @@
  1 +noosfero binary: python-script-but-no-python-dep
  2 +noosfero binary: script-not-executable
  3 +noosfero binary: executable-not-elf-or-script
  4 +noosfero binary: extra-license-file
  5 +noosfero binary: embedded-javascript-library
  6 +noosfero binary: package-contains-vcs-control-file
... ...
debian/noosfero.postinst 0 → 100644
... ... @@ -0,0 +1,59 @@
  1 +#!/bin/sh
  2 +
  3 +set -e
  4 +
  5 +makedir() {
  6 + if [ ! -d $1 ]; then
  7 + mkdir $1
  8 + fi
  9 + chown noosfero:noosfero $1
  10 +}
  11 +
  12 +# create user noosfero in a portable way, while creating the log directory.
  13 +# (idea taken from the postfix package)
  14 +##############################################################################
  15 +if [ ! -d /var/log/noosfero ]; then
  16 + mkdir /var/log/noosfero
  17 +fi
  18 +chgrp noosfero /var/log/noosfero 2>/dev/null ||
  19 + addgroup --system noosfero
  20 +chown noosfero /var/log/noosfero 2>/dev/null ||
  21 + adduser --system --home /usr/share/noosfero --shell /bin/sh --no-create-home --disabled-password --ingroup noosfero noosfero
  22 +
  23 +# create noosfero dynamic data directories
  24 +##############################################################################
  25 +noosfero_data_dir='/var/lib/noosfero-data'
  26 +makedir $noosfero_data_dir
  27 +makedir $noosfero_data_dir/index
  28 +makedir $noosfero_data_dir/cache
  29 +makedir $noosfero_data_dir/public
  30 +makedir $noosfero_data_dir/public/articles
  31 +makedir $noosfero_data_dir/public/image_uploads
  32 +makedir $noosfero_data_dir/public/thumbnails
  33 +
  34 +# Instruct dbconfig-common to generate database configuration file
  35 +##############################################################################
  36 +noosfero_database_yml="/etc/noosfero/database.yml"
  37 +dbc_generate_include="template:$noosfero_database_yml"
  38 +dbc_generate_include_args="-o template_infile=/usr/share/noosfero/config/database.yml.template"
  39 +dbc_generate_include_owner="root:noosfero"
  40 +dbc_generate_include_perms="640"
  41 +
  42 +. /usr/share/debconf/confmodule
  43 +
  44 +db_get noosfero/initial_domain
  45 +if [ ! -z "$RET" ]; then
  46 + # this is going to be used by the db:data:minimal rake task, called by
  47 + # /usr/lib/noosfero/dbinstall
  48 + export NOOSFERO_DOMAIN="$RET"
  49 +fi
  50 +
  51 +# dbconfig-common magic
  52 +. /usr/share/dbconfig-common/dpkg/postinst
  53 +dbc_go noosfero $@
  54 +
  55 +# stop debconf to avoid the problem with infinite hanging, cfe
  56 +# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=295477
  57 +db_stop
  58 +
  59 +#DEBHELPER#
... ...
debian/noosfero.postrm 0 → 100644
... ... @@ -0,0 +1,12 @@
  1 +#!/bin/sh
  2 +
  3 +set -e
  4 +
  5 +. /usr/share/debconf/confmodule
  6 +if [ -f /usr/share/dbconfig-common/dpkg/postrm ]; then
  7 + . /usr/share/dbconfig-common/dpkg/postrm
  8 + dbc_go noosfero $@
  9 +fi
  10 +db_purge
  11 +
  12 +#DEBHELPER#
... ...
debian/noosfero.prerm 0 → 100644
... ... @@ -0,0 +1,22 @@
  1 +#!/bin/sh
  2 +
  3 +set -e
  4 +
  5 +. /usr/share/debconf/confmodule
  6 +. /usr/share/dbconfig-common/dpkg/prerm
  7 +dbc_go noosfero $@
  8 +
  9 +#DEBHELPER#
  10 +
  11 +# some dirty work is needed after Noosfero is stopped
  12 +if [ "$1" = "upgrade" ]; then
  13 + # delete cached files
  14 + rm -f /var/lib/noosfero-data/cache/*
  15 +
  16 + # restart memcache
  17 + invoke-rc.d memcached restart
  18 +
  19 + # stop debconf to avoid the problem with infinite hanging, cfe
  20 + # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=295477
  21 + db_stop
  22 +fi
... ...
debian/noosfero.templates 0 → 100644
... ... @@ -0,0 +1,20 @@
  1 +Template: noosfero/initial_domain
  2 +Type: string
  3 +Description: Domain name for your noosfero site:
  4 + Enter the domain name that will be used for your Noosfero site. This domain
  5 + name will be automatically added to Noosfero's database. The Noosfero frontend
  6 + packages (such as noosfero-apache) will also automatically configure proper
  7 + virtual hosts to respond for this domain name.
  8 + .
  9 + If you do not enter a domain name here, you will have to make some further
  10 + manual configuration to have your frontend server properly configured.
  11 +
  12 +Template: noosfero/email_setup_warning
  13 +Type: note
  14 +Description: Noosfero needs a working e-mail setup
  15 + To function properly, Noosfero needs a working e-mail setup. This is used to
  16 + send friendship request e-mails, recovering passwords, and other things.
  17 + .
  18 + Basically, your local MTA needs to deliver e-mail to the internet. Please
  19 + check /usr/share/doc/noosfero/README.Debian for detailed instructions on
  20 + settings this up.
... ...
debian/rules 0 → 100755
... ... @@ -0,0 +1,32 @@
  1 +#!/usr/bin/make -f
  2 +
  3 +# Uncomment this to turn on verbose mode.
  4 +#export DH_VERBOSE=1
  5 +
  6 +# This has to be exported to make some magic below work.
  7 +export DH_OPTIONS
  8 +
  9 +VERSION = $(shell dpkg-parsechangelog | grep '^Version:' | cut -d ' ' -f 2)
  10 +# to support new databases, change debian/noosfero.config!
  11 +SUPPORTED_DATABASES = $(shell sed -e '/dbc_dbtypes=/!d; s/.*"\(.*\)".*/\1/; s/,//g' debian/noosfero.config)
  12 +
  13 +%:
  14 + dh --without=python-support $@
  15 +
  16 +override_dh_link:
  17 + dh_link
  18 + for db in $(SUPPORTED_DATABASES); do \
  19 + dh_link usr/lib/noosfero/dbupgrade usr/share/dbconfig-common/scripts/noosfero/upgrade/$$db/$(VERSION); \
  20 + dh_link usr/lib/noosfero/dbinstall usr/share/dbconfig-common/scripts/noosfero/install/$$db; \
  21 + done
  22 +
  23 +override_dh_installinit:
  24 + dh_installinit -pnoosfero --onlyscripts
  25 +
  26 +override_dh_clean:
  27 + dh_clean
  28 + rake clobber
  29 +
  30 +override_dh_auto_build:
  31 + dh_auto_build
  32 + rake noosfero:translations:compile
... ...
debian/source/format 0 → 100644
... ... @@ -0,0 +1 @@
  1 +3.0 (native)
... ...
debian/source/lintian-overrides 0 → 100644
... ... @@ -0,0 +1 @@
  1 +noosfero source: python-script-but-no-python-dep
... ...
debian/update-noosfero-apache 0 → 100755
... ... @@ -0,0 +1,22 @@
  1 +#!/bin/sh
  2 +
  3 +set -e
  4 +
  5 +# automatically update configuration, but if package noosfero is also installed
  6 +if test -x /usr/share/noosfero/script/apacheconf; then
  7 + datadir="/etc/noosfero/apache"
  8 + mongrel_file="$datadir/mongrel.conf"
  9 + if test -e "$mongrel_file"; then
  10 + echo "Overwriting $mongrel_file ..."
  11 + fi
  12 + /usr/share/noosfero/script/apacheconf mongrel > "$mongrel_file"
  13 +
  14 + apache_site='/etc/apache2/sites-available/noosfero'
  15 + if ! test -e "$apache_site"; then
  16 + echo "Generating apache virtual host ..."
  17 + cd /usr/share/noosfero && su noosfero -c "RAILS_ENV=production ./script/apacheconf virtualhosts" > "$apache_site"
  18 + fi
  19 +
  20 + echo 'Noosfero Apache configuration updated.'
  21 + echo "Run '/etc/init.d/apache2 reload' to activate new configuration!"
  22 +fi
... ...
etc/init.d/noosfero
1 1 #! /bin/sh
2 2 ### BEGIN INIT INFO
3   -# Provides: skeleton
  3 +# Provides: noosfero
4 4 # Required-Start: $remote_fs
5 5 # Required-Stop: $remote_fs
6 6 # Default-Start: 2 3 4 5
... ... @@ -122,8 +122,11 @@ case &quot;$1&quot; in
122 122 start|stop|restart|setup)
123 123 do_$1
124 124 ;;
  125 + force-reload)
  126 + do_restart
  127 + ;;
125 128 *)
126   - echo "Usage: $SCRIPTNAME {start|stop|restart|setup}" >&2
  129 + echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|setup}" >&2
127 130 exit 3
128 131 ;;
129 132 esac
... ...
gitignore.example
... ... @@ -12,7 +12,7 @@ index
12 12 locale
13 13 log
14 14 public/articles
15   -public/images/0000
  15 +public/image_uploads
16 16 public/thumbnails
17 17 public/user_themes
18 18 public/designs/themes/default
... ...
lib/noosfero/i18n.rb
... ... @@ -153,31 +153,14 @@ module ActionController::Caching::Fragments
153 153 alias_method_chain :expire_fragment, :fast_gettext
154 154 end
155 155  
156   -FileUtils.mkdir_p(Rails.root + '/locale')
157   -Dir.glob(Rails.root + '/locale/*').each do |dir|
158   - lang = File.basename(dir)
159   - FileUtils.mkdir_p("#{Rails.root}/locale/#{lang}/LC_MESSAGES")
160   - ['iso_3166', 'rails'].each do |domain|
161   - target = "#{Rails.root}/locale/#{lang}/LC_MESSAGES/#{domain}.mo"
162   - if !File.exists?(target)
163   - orig = "/usr/share/locale/#{lang}/LC_MESSAGES/#{domain}.mo"
164   - if File.exists?(orig)
165   - File.symlink(orig, target)
166   - else
167   - alternatives = Dir.glob("/usr/share/locale/#{lang}_*/LC_MESSAGES/#{domain}.mo")
168   - unless alternatives.empty?
169   - File.symlink(alternatives.first, target)
170   - end
171   - end
172   - end
173   - end
  156 +# translations in place?
  157 +if File.exists?(Rails.root + '/locale')
  158 + repos = [
  159 + FastGettext::TranslationRepository.build('noosfero', :type => 'mo', :path => Rails.root + '/locale'),
  160 + FastGettext::TranslationRepository.build('iso_3166', :type => 'mo', :path => Rails.root + '/locale'),
  161 + FastGettext::TranslationRepository.build('rails', :type => 'mo', :path => Rails.root + '/locale'),
  162 + ]
  163 +
  164 + FastGettext.add_text_domain 'noosferofull', :type => :chain, :chain => repos
  165 + FastGettext.default_text_domain = 'noosferofull'
174 166 end
175   -
176   -repos = [
177   - FastGettext::TranslationRepository.build('noosfero', :type => 'mo', :path => Rails.root + '/locale'),
178   - FastGettext::TranslationRepository.build('iso_3166', :type => 'mo', :path => Rails.root + '/locale'),
179   - FastGettext::TranslationRepository.build('rails', :type => 'mo', :path => Rails.root + '/locale'),
180   -]
181   -
182   -FastGettext.add_text_domain 'noosferofull', :type => :chain, :chain => repos
183   -FastGettext.default_text_domain = 'noosferofull'
... ...
lib/tasks/clean.rake 0 → 100644
... ... @@ -0,0 +1,28 @@
  1 +task :clean => 'noosfero:clean'
  2 +
  3 +namespace :noosfero do
  4 + task :clean do
  5 +
  6 + if Rails.env == 'production'
  7 + raise 'You should NOT run this in production mode!'
  8 + end
  9 +
  10 + clean_patterns = %w[
  11 + db/*.db
  12 + public/javascripts/cache*.js
  13 + public/stylesheets/cache*.css
  14 + public/designs/themes/default
  15 + public/designs/icons/default
  16 + public/articles/
  17 + public/image_uploads/
  18 + public/thumbnails/
  19 + locale/
  20 + ]
  21 + clean_patterns << Dir.glob('public/designs/themes/*').select { |f| File.symlink?(f) }
  22 +
  23 + clean_patterns.each do |pattern|
  24 + list = Dir.glob(pattern)
  25 + rm_rf list unless list.empty?
  26 + end
  27 + end
  28 +end
... ...
lib/tasks/data.rake 0 → 100644
... ... @@ -0,0 +1,10 @@
  1 +namespace :db do
  2 + namespace :data do
  3 + task :minimal do
  4 + environment = Environment.create!(:name => 'Noosfero', :is_default => true)
  5 + unless ENV['NOOSFERO_DOMAIN'].blank?
  6 + environment.domains << Domain.new(:name => ENV['NOOSFERO_DOMAIN'])
  7 + end
  8 + end
  9 + end
  10 +end
... ...
lib/tasks/doc.rake
... ... @@ -152,3 +152,5 @@ namespace :noosfero do
152 152 end
153 153 end
154 154 end
  155 +
  156 +task :clean => 'noosfero:doc:clean'
... ...
lib/tasks/gettext.rake
... ... @@ -9,9 +9,34 @@ desc &quot;Create mo-files for L10n&quot;
9 9 task :makemo => makemo_stamp
10 10 file makemo_stamp => Dir.glob('po/*/noosfero.po') do
11 11 ruby '-rconfig/boot -rgettext -rgettext/utils -e \'GetText.create_mofiles(true, "po", "locale")\' 2>/dev/null'
  12 + Rake::Task['symlinkmo'].invoke
12 13 FileUtils.touch makemo_stamp
13 14 end
14 15  
  16 +task :cleanmo do
  17 + rm_f makemo_stamp
  18 +end
  19 +task :clean => 'cleanmo'
  20 +
  21 +task :symlinkmo do
  22 + langmap = {
  23 + 'pt' => 'pt_BR',
  24 + }
  25 + FileUtils.mkdir_p(Rails.root + '/locale')
  26 + Dir.glob(Rails.root + '/locale/*').each do |dir|
  27 + lang = File.basename(dir)
  28 + orig_lang = langmap[lang] || lang
  29 + FileUtils.mkdir_p("#{Rails.root}/locale/#{lang}/LC_MESSAGES")
  30 + ['iso_3166', 'rails'].each do |domain|
  31 + origin = "/usr/share/locale/#{orig_lang}/LC_MESSAGES/#{domain}.mo"
  32 + target = "#{Rails.root}/locale/#{lang}/LC_MESSAGES/#{domain}.mo"
  33 + if !File.symlink?(target)
  34 + ln_s origin, target
  35 + end
  36 + end
  37 + end
  38 +end
  39 +
15 40 desc "Update pot/po files to match new version."
16 41 task :updatepo do
17 42 require 'gettext'
... ...
lib/tasks/release.rake
... ... @@ -20,6 +20,17 @@ namespace :noosfero do
20 20 puts "Not found tag for version #{version}, we can go on."
21 21 end
22 22  
  23 + desc 'checks the version of the Debian package'
  24 + task :check_debian_package do
  25 + debian_version = `dpkg-parsechangelog | grep Version: | cut -d ' ' -f 2`.strip
  26 + unless debian_version =~ /^#{Noosfero::VERSION}/
  27 + puts "Version mismatch: Debian version = #{debian_version}, Noosfero upstream version = #{Noosfero::VERSION}"
  28 + puts "Run `dch -v #{Noosfero::VERSION}` to add a new changelog entry that upgrades the Debian version"
  29 + raise "Version mismatch between noosfero version and debian package version"
  30 + end
  31 + end
  32 +
  33 +
23 34 AUTHORS_HEADER = <<EOF
24 35 If you are not listed here, but should be, please write to the noosfero mailing
25 36 list: http://listas.softwarelivre.org/cgi-bin/mailman/listinfo/noosfero-dev
... ... @@ -57,10 +68,28 @@ EOF
57 68 end
58 69  
59 70 desc 'prepares a release tarball'
60   - task :release => [ :check_tag, 'noosfero:error-pages:translate', :authors, :check_repo, :package ] do
  71 + task :release => [ :check_tag, :check_debian_package, 'noosfero:error-pages:translate', :authors, :check_repo, :package, :debian_packages ] do
61 72 sh "git tag #{version}"
62   - puts "I: please upload the tarball to the website!"
  73 + puts "I: please upload the tarball and Debian packages to the website!"
63 74 puts "I: please push the tag for version #{version} that was just created!"
64 75 end
  76 +
  77 + desc 'Build Debian packages'
  78 + task :debian_packages => :package do
  79 + target = "pkg/noosfero-#{Noosfero::VERSION}"
  80 + mkdir "#{target}/tmp"
  81 + ln_s '../../../vendor/rails', "#{target}/vendor/rails"
  82 + cp "#{target}/config/database.yml.sqlite3", "#{target}/config/database.yml"
  83 + sh "cd #{target} && dpkg-buildpackage -us -uc -b"
  84 + end
  85 +
  86 + desc 'Test Debian package'
  87 + task 'debian:test' => :debian_packages do
  88 + Dir.chdir 'pkg' do
  89 + rm_rf "noosfero-#{Noosfero::VERSION}"
  90 + sh 'apt-ftparchive packages . > Packages'
  91 + sh 'apt-ftparchive release . > Release'
  92 + end
  93 + end
65 94  
66 95 end
... ...
public/designs/icons/default
... ... @@ -1 +0,0 @@
1   -tango
2 0 \ No newline at end of file
script/apacheconf 0 → 100755
... ... @@ -0,0 +1,35 @@
  1 +#!/usr/bin/env ruby
  2 +
  3 +case ARGV.first
  4 +when 'mongrel'
  5 + require 'yaml'
  6 + mongrel_config = YAML.load_file(File.dirname(__FILE__) + "/../config/mongrel_cluster.yml")
  7 + ip = mongrel_config['address'] || '127.0.0.1'
  8 + ports = port_range = mongrel_config['port']..(mongrel_config['port']+mongrel_config['servers']-1)
  9 + ports.each do |port|
  10 + puts "BalancerMember http://#{ip}:#{port}"
  11 + end
  12 +when 'virtualhosts'
  13 + require File.dirname(__FILE__) + '/../config/environment'
  14 + Environment.all.each do |environment|
  15 + domains = environment.domains.sort do |domain|
  16 + domain.is_default ? 0 : 1
  17 + end
  18 + if domains.empty?
  19 + domains << Domain.new(:name => 'localhost')
  20 + end
  21 + puts "# #{environment.name}"
  22 + puts "<VirtualHost *:80>"
  23 + server_directive = 'ServerName'
  24 + domains.each do |domain|
  25 + puts " #{server_directive} #{domain.name}"
  26 + server_directive = 'ServerAlias'
  27 + end
  28 + puts " Include /etc/noosfero/apache/virtualhost.conf"
  29 + puts "</VirtualHost>"
  30 + end
  31 + puts "# vim: ft=apache"
  32 +else
  33 + puts "usage: %s mongrel|virtualhosts" % $PROGRAM_NAME
  34 + exit 1
  35 +end
... ...
script/production
1 1 #!/bin/sh
2 2  
  3 +set -e
  4 +
3 5 export RAILS_ENV=production
4 6  
5 7 ACTION=$1
6 8 shift
7 9  
8 10 clear_cache() {
9   - rm -f ./public/javascripts/cache-*.js
10   - rm -f ./public/stylesheets/cache.css
  11 + if test -w ./public; then
  12 + rm -f ./public/javascripts/cache-*.js
  13 + rm -f ./public/stylesheets/cache.css
  14 + fi
11 15 }
12 16  
13 17 do_start() {
... ... @@ -40,7 +44,7 @@ case &quot;$ACTION&quot; in
40 44 do_start
41 45 echo "=> Running in production mode. Hit ctrl-C to stop."
42 46 trap do_stop INT TERM
43   - tail -n 0 -f log/production.log
  47 + tail -n 0 -f log/production.log || true
44 48 ;;
45 49  
46 50 restart)
... ...
vendor/plugins/attachment_fu/Rakefile
... ... @@ -16,7 +16,6 @@ desc &#39;Generate documentation for the attachment_fu plugin.&#39;
16 16 Rake::RDocTask.new(:rdoc) do |rdoc|
17 17 rdoc.rdoc_dir = 'rdoc'
18 18 rdoc.title = 'ActsAsAttachment'
19   - rdoc.options << '--line-numbers --inline-source'
20 19 rdoc.rdoc_files.include('README')
21 20 rdoc.rdoc_files.include('lib/**/*.rb')
22 21 end
... ...