From b37f6e5e0e363671612c78d7b6ddb9610fe85306 Mon Sep 17 00:00:00 2001 From: Anon Ray Date: Thu, 23 May 2013 20:33:38 +0530 Subject: [PATCH] Add feature to write a template config Now, by default you have to provide a template trac.ini file which will be used to setup the new trac.ini in the project. --- .gitignore | 1 + new_project.sh | 24 ++++- trac.ini.template.sample | 259 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 282 insertions(+), 2 deletions(-) create mode 100644 trac.ini.template.sample diff --git a/.gitignore b/.gitignore index 390a9c9..e5ad8b0 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ trac.config +trac.ini.template diff --git a/new_project.sh b/new_project.sh index 6c88bce..5177e63 100755 --- a/new_project.sh +++ b/new_project.sh @@ -10,7 +10,8 @@ # > trac-admin /path/to/trac/env deploy /path/to/trac/env/deploy/ # 4. chmod to add group permissions # > chmod g+rwx /path/to/trac/env -R -# +# 5. Copy the template trac.ini file to be the trac.ini file and copy some +# config from the old trac.ini file to the new one readConfig() { configFile='trac.config' @@ -56,12 +57,31 @@ chmodTracEnv() { chmod g+rwx $trac_project$project -R } +writeTracConfig() { + oldconfig="$trac_project$project/conf/trac.ini" + newconfig='trac.ini.template' + echo "Writing template config to $oldconfig" + if [ ! -e $newconfig ]; then + echo "File: $newconfig does not exist. Could not write template \ + configuration. You have to manually configure the config file now.\ + Everything else is setup." + exit 0; + fi + name=$(sed -n 's/^name = \(.*\)$/\1/p' $oldconfig) + db=$(sed -n 's/^database = \(.*\)$/\1/p' $oldconfig) + $db=${db//\//\\/} + $(cp $newconfig $oldconfig) + $newconfig=$oldconfig + $(sed -i "s/^name =$/name = $name/" $newconfig) + $(sed -i "s/^database =$/database = $db/" $newconfig) +} + usage() { echo "Usage is $0 --name " } setup() { - createDB && initTracEnv && deployTracEnv && chmodTracEnv; + createDB && initTracEnv && deployTracEnv && chmodTracEnv && writeTracConfig; echo "Done.." exit 0; } diff --git a/trac.ini.template.sample b/trac.ini.template.sample new file mode 100644 index 0000000..3f8df27 --- /dev/null +++ b/trac.ini.template.sample @@ -0,0 +1,259 @@ +# -*- coding: utf-8 -*- + +[account-manager] +account_changes_notify_addresses = +force_passwd_change = true +htdigest_file = /path/to/trac/projects/.passwd +htdigest_realm = TracRealm +notify_actions = new,change,delete +password_store = HtDigestStore +verify_email = false + +[attachment] +max_size = 262144 +max_zip_size = 2097152 +render_unsafe_content = false + +[browser] +color_scale = True +downloadable_paths = /trunk, /branches/*, /tags/* +hide_properties = svk:merge +intermediate_color = +intermediate_point = +newest_color = (255, 136, 136) +oldest_color = (136, 136, 255) +oneliner_properties = trac:summary +render_unsafe_content = false +wiki_properties = trac:description + +[changeset] +max_diff_bytes = 10000000 +max_diff_files = 0 +wiki_format_messages = true + +[components] +acct_mgr.admin.accountmanageradminpanel = enabled +acct_mgr.guard.* = enabled +acct_mgr.htfile.htdigeststore = enabled +acct_mgr.notification.accountchangelistener = enabled +acct_mgr.register.emailverificationmodule = enabled +acct_mgr.register.registrationmodule = enabled +acct_mgr.web_ui.accountmodule = enabled +acct_mgr.web_ui.loginmodule = enabled +trac.web.auth.loginmodule = disabled +tracopt.ticket.commit_updater.* = enabled +tracopt.versioncontrol.git.* = enabled +tracspamfilter.* = enabled +webadmin.* = enabled + +[git] +cached_repository = false +git_bin = git +git_fs_encoding = utf-8 +persistent_cache = false +shortrev_len = 7 +trac_user_rlookup = false +use_committer_id = true +use_committer_time = true +wikishortrev_len = 40 + +[header_logo] +alt = (your logo here) +height = 100 +link = / +src = site/yourlogo.png +width = 100 + +[inherit] +htdocs_dir = +plugins_dir = +templates_dir = + +[logging] +log_file = trac.log +log_level = DEBUG +log_type = none + +[milestone] +stats_provider = DefaultTicketGroupStatsProvider + +[mimeviewer] +max_preview_size = 262144 +mime_map = text/x-dylan:dylan, text/x-idl:ice, text/x-ada:ads:adb +mime_map_patterns = text/plain:README|INSTALL|COPYING.* +pygments_default_style = trac +pygments_modes = +tab_width = 8 +treat_as_binary = application/octet-stream, application/pdf, application/postscript, application/msword,application/rtf, + +[notification] +admit_domains = +always_notify_owner = false +always_notify_reporter = false +always_notify_updater = true +ambiguous_char_width = single +batch_subject_template = $prefix Batch modify: $tickets_descr +email_sender = SmtpEmailSender +ignore_domains = +mime_encoding = none +sendmail_path = sendmail +smtp_always_bcc = +smtp_always_cc = +smtp_default_domain = +smtp_enabled = false +smtp_from = trac@localhost +smtp_from_author = false +smtp_from_name = +smtp_password = +smtp_port = 25 +smtp_replyto = trac@localhost +smtp_server = localhost +smtp_subject_prefix = __default__ +smtp_user = +ticket_subject_template = $prefix #$ticket.id: $summary +use_public_cc = false +use_short_addr = false +use_tls = false + +[project] +admin = +admin_trac_url = . +descr = +footer = Visit the Trac open source project at
http://trac.edgewall.org/ +icon = common/trac.ico +name = +url = + +[query] +default_anonymous_query = status!=closed&cc~=$USER +default_query = status!=closed&owner=$USER +items_per_page = 100 +ticketlink_query = ?status=!closed + +[report] +items_per_page = 100 +items_per_page_rss = 0 + +[revisionlog] +default_log_limit = 100 +graph_colors = ['#cc0', '#0c0', '#0cc', '#00c', '#c0c', '#c00'] + +[roadmap] +stats_provider = DefaultTicketGroupStatsProvider + +[search] +min_query_length = 3 + +[spam-filter] +captcha = ImageCaptcha +captcha_areyouahuman_publisher_key = +captcha_areyouahuman_scoring_key = +captcha_expression_ceiling = 10 +captcha_expression_terms = 3 +captcha_image_alphabet = abcdefghkmnopqrstuvwxyz0123456789 +captcha_image_font_size = 25 +captcha_image_fonts = vera.ttf +captcha_image_letters = 6 +captcha_karma_lifetime = 86400 +captcha_keycaptcha_private_key = +captcha_keycaptcha_user_id = +captcha_recaptcha_private_key = +captcha_recaptcha_public_key = +reject_handler = CaptchaSystem + +[ticket] +default_cc = +default_component = +default_description = +default_keywords = +default_milestone = +default_owner = < default > +default_priority = major +default_resolution = fixed +default_severity = +default_summary = +default_type = defect +default_version = +max_comment_size = 262144 +max_description_size = 262144 +preserve_newlines = default +restrict_owner = false +workflow = ConfigurableTicketWorkflow + +[ticket-workflow] +accept = new,assigned,accepted,reopened -> accepted +accept.operations = set_owner_to_self +accept.permissions = TICKET_MODIFY +leave = * -> * +leave.default = 1 +leave.operations = leave_status +reassign = new,assigned,accepted,reopened -> assigned +reassign.operations = set_owner +reassign.permissions = TICKET_MODIFY +reopen = closed -> reopened +reopen.operations = del_resolution +reopen.permissions = TICKET_CREATE +resolve = new,assigned,accepted,reopened -> closed +resolve.operations = set_resolution +resolve.permissions = TICKET_MODIFY + +[timeline] +abbreviated_messages = True +changeset_collapse_events = false +changeset_long_messages = false +changeset_show_files = 0 +default_daysback = 30 +max_daysback = 90 +newticket_formatter = oneliner +ticket_show_details = false + +[trac] +auth_cookie_lifetime = 0 +auth_cookie_path = +authz_file = +authz_module_name = +auto_preview_timeout = 2.0 +auto_reload = False +backup_dir = db +base_url = +check_auth_ip = false +database = +debug_sql = False +default_charset = utf-8 +default_date_format = +default_dateinfo_format = relative +default_language = +default_timezone = GMT +6:00 +genshi_cache_size = 128 +htdocs_location = +ignore_auth_case = false +jquery_location = +jquery_ui_location = +jquery_ui_theme_location = +mainnav = wiki, timeline, roadmap, browser, tickets, newticket, search +metanav = login, logout, prefs, help, about +mysqldump_path = mysqldump +never_obfuscate_mailto = false +permission_policies = DefaultPermissionPolicy, LegacyAttachmentPolicy +permission_store = DefaultPermissionStore +pg_dump_path = pg_dump +repository_dir = +repository_sync_per_request = (default) +repository_type = git +resizable_textareas = true +secure_cookies = False +show_email_addresses = false +show_ip_addresses = false +timeout = 20 +use_base_url_for_redirect = False + +[versioncontrol] +allowed_repository_dir_prefixes = + +[wiki] +ignore_missing_pages = false +max_size = 262144 +render_unsafe_content = false +safe_schemes = cvs, file, ftp, git, irc, http, https, news, sftp, smb, ssh, svn, svn+ssh +split_page_names = false + -- 1.7.10.4