Skip to content

Instantly share code, notes, and snippets.

@neilus
Last active March 3, 2016 00:11
Show Gist options
  • Save neilus/05b810155fe2667f2741 to your computer and use it in GitHub Desktop.
Save neilus/05b810155fe2667f2741 to your computer and use it in GitHub Desktop.
bootstrap script for Trac 1.0.1 project management system

this script woll bootstrap a Trac project management software.

I recommend to use virtualenvironment for this purpose, read: http://docs.python-guide.org/en/latest/dev/virtualenvs/

So before you begin you should have python 2.7.x, virtualenv (optionally virtualenvwrapper), pip and easy_install set up. Create a virtual environment, as described in the link above, enter in it, and you should start the bootstrap script:

mkvirtualenv trac
cdvirtualenv
git clone https://gist.github.com/05b810155fe2667f2741.git bootstrap_trac.git
sh bootstrap_trac.git/bootstrap_trac.sh

It will install trac and it's dependencies, download and install some plugins, creates a test environment (with the trac_admin wizzard, where you should give it a name, and live everything on default is fine), adds admin permission to the anonymous user (this is so you can set up users, plugins and shit in the web admin console, and remove the TRAC_ADMIN permission from the anonymous user once you have another user and gave the permission to it). So afterwards it starts up a trac on http://localhost:8080 where you should set up your trac environment

#!/bin/bash
#install trac
pip install Trac
#download some plugins and insall them
mkdir -p plugins-trac;
cd plugins-trac
git svn clone https://trac-hacks.org/svn/xmlrpcplugin/trunk/ xml_rpc_plugin
git svn clone https://trac-hacks.org/svn/multipleworkflowplugin/trunk/ multiple_workflow_plugin
git svn clone https://trac-hacks.org/svn/typedticketworkflowplugin/trunk/
git svn clone https://trac-hacks.org/svn/simplemultiprojectplugin/trunk/ simple_multiproject_plugin
git svn clone https://trac-hacks.org/svn/timingandestimationplugin/branches/trac0.12-Permissions/ timing_and_estimation_with_permissions
git clone git@github.com:itota/trac-subtickets-plugin.git subtickets_plugin
git svn clone https://trac-hacks.org/svn/graphvizplugin/trunk/ graphviz_plugin
git svn clone https://trac-hacks.org/svn/plantumlmacro/trunk/ plantuml_plugin
git svn clone https://trac-hacks.org/svn/worklogplugin/trunk/ worklog_plugin
git svn clone https://trac-hacks.org/svn/accountmanagerplugin/tags/acct_mgr-0.4.4/ account_manager_plugin
git svn clone https://trac-hacks.org/svn/accountldapplugin/0.12/ account_LDAP_plugin
git svn clone https://trac-hacks.org/svn/customfieldadminplugin/0.11/ customfield_plugin
git svn clone https://trac-hacks.org/svn/datefieldplugin/0.11/ datefield_plugin
for i in *;
do
easy_install $i;
done
cd ..
# ceeate a trac project environment
export PROJECT="$(pwd)/project_environment"
trac-admin "$PROJECT" initenv
# adding admin permissions to the anonymous user
trac-admin "$PROJECT" permission add anonymous TRAC_ADMIN
# start-up trac and do shit
tracd --port 8080 --hostname localhost --single-env "$PROJECT" --auto-reload
# try to start it up in a browser
#which xdg-open
#if [ "$?" == "0" ];then #linux
# xdg-open "http://localhost:8080"
#else #try it as on a mac
# open "http://localhost:8080"
#fi
@neilus
Copy link
Author

neilus commented Sep 21, 2014

Sikerült a multiTicketWorkflow plugint is beetetnem!!!!
egyazon trac-en belül más workflow érvényes pl a tesztemben egy defect típusú ticketre, mint minden másra (az egyszerűség kedvéért ezt próbáltam ki). ez a felállás most maradhat ami itten van.

@neilus
Copy link
Author

neilus commented Sep 21, 2014

Alapvetően a következőket kell itten művelni:

  1. Installálni egy normális python 2.7.x-es környezetet, én csináltam minden teszt trac-nek egy virtualenv-et is
  2. a scriptben használom a git-svn-t is ahogy látszik, ami alapból nem jön a git-el általában, azt is érdemes felrakni (nyilván az easy_install az felrakná webdav-ról is, szóval a fenti pluginok közül csak a github bukna el úgy)
  3. eztán indíthatjuk a bootstrap scriptemet, ami fenn van mellékelve ebben a gistben
  4. a cucc elindítja a trac project inicializálást is, ott adni kell neki egy project nevet, majd elég entert nyomni mindenre
  5. eztán elindítja a trac daemont és localhostban a böngészővel megpróbál rácsatlakozni
  6. mivel az anonymous-nak TRAC_ADMIN jogot ad a script, így egyből a webes admin felületen be is lehet kapcsolni a pluginokat, utána usereket csinálni, jogosultságokat osztani, meg persze az anonymous-tól el is venni az admin jogot...

folytatom a multi ticket workflow-al mingyárt, a többi plugint szo-szó be lehet állítani a webről is (a graphvizt és a plantuml-elt még nem csekkoltam)

@neilus
Copy link
Author

neilus commented Sep 21, 2014

es ez a diffje a szűz illetve a multiworkflow trac environmenteknek

#diff 
5,17d4
< authentication_url = 
< db_htdigest_realm = 
< force_passwd_change = true
< hash_method = HtDigestHashMethod
< htdigest_file = 
< htdigest_realm = 
< htpasswd_file = passwd.htpass
< htpasswd_hash_type = crypt
< password_file = 
< password_store = HtPasswdStore
< persistent_sessions = False
< refresh_passwd = False
< verify_email = true
41,114d27
< [components]
< acct_mgr.admin.accountmanageradminpanel = enabled
< acct_mgr.api.accountmanager = enabled
< acct_mgr.db.sessionstore = enabled
< acct_mgr.guard.accountguard = enabled
< acct_mgr.htfile.htdigeststore = enabled
< acct_mgr.htfile.htpasswdstore = enabled
< acct_mgr.http.httpauthstore = enabled
< acct_mgr.macros.accountmanagerwikimacros = enabled
< acct_mgr.notification.accountchangelistener = enabled
< acct_mgr.notification.accountchangenotificationadminpanel = enabled
< acct_mgr.pwhash.htdigesthashmethod = enabled
< acct_mgr.pwhash.htpasswdhashmethod = enabled
< acct_mgr.register.basiccheck = enabled
< acct_mgr.register.bottrapcheck = enabled
< acct_mgr.register.emailcheck = enabled
< acct_mgr.register.emailverificationmodule = enabled
< acct_mgr.register.regexpcheck = enabled
< acct_mgr.register.registrationmodule = enabled
< acct_mgr.register.usernamepermcheck = enabled
< acct_mgr.svnserve.svnservepasswordstore = enabled
< acct_mgr.web_ui.accountmodule = enabled
< acct_mgr.web_ui.loginmodule = enabled
< acct_mgr.web_ui.resetpwstore = enabled
< customfieldadmin.admin.customfieldadminpage = enabled
< customfieldadmin.api.customfields = enabled
< datefield.filter.customfieldadmintweak = enabled
< datefield.filter.datefieldmodule = enabled
< multipleworkflow.workflow.multipleworkflowplugin = enabled
< simplemultiproject.admin.smpadminpanel = enabled
< simplemultiproject.admin_component.smpcomponentadminpanel = enabled
< simplemultiproject.environmentsetup.smpenvironmentsetupparticipant = enabled
< simplemultiproject.milestone.smpmilestoneproject = enabled
< simplemultiproject.model.smpmodel = enabled
< simplemultiproject.roadmap.smproadmapproject = enabled
< simplemultiproject.roadmap.smproadmapprojectfilter = enabled
< simplemultiproject.ticket.projectticketspolicy = enabled
< simplemultiproject.ticket.smpticketproject = enabled
< simplemultiproject.timeline.smptimelineprojectfilter = enabled
< simplemultiproject.version.smpversionproject = enabled
< timingandestimationplugin.api.timetrackingsetupparticipant = enabled
< timingandestimationplugin.blackmagic.tickettweaks = enabled
< timingandestimationplugin.query_webui.querywebuiaddon = enabled
< timingandestimationplugin.reports_filter.reportscreenfilter = enabled
< timingandestimationplugin.reports_filter.reportsfilter = enabled
< timingandestimationplugin.stopwatch.ticketstopwatch = enabled
< timingandestimationplugin.tande_filters.querycolumnpermissionfilter = enabled
< timingandestimationplugin.tande_filters.ticketformatfilter = enabled
< timingandestimationplugin.tande_filters.timelinepermissionfilter = enabled
< timingandestimationplugin.ticket_daemon.timetrackingticketobserver = enabled
< timingandestimationplugin.ticket_daemon.timetrackingticketvalidator = enabled
< timingandestimationplugin.ticket_policy.internalticketspolicy = enabled
< timingandestimationplugin.ticket_webui.addhourssincecomment = enabled
< timingandestimationplugin.ticket_webui.betterhoursdisplay = enabled
< timingandestimationplugin.ticket_webui.hourslayoutchanger = enabled
< timingandestimationplugin.webui.timingestimationandbillingpage = enabled
< trac.web.auth.loginmodule = disabled
< tracsubtickets.api.subticketssystem = enabled
< tracsubtickets.web_ui.subticketsmodule = enabled
< worklog.admin.worklogadminpanel = enabled
< worklog.api.worklogsetupparticipant = enabled
< worklog.ticket_daemon.worklogticketobserver = enabled
< worklog.ticket_filter.worklogticketaddon = enabled
< worklog.timeline.worklogtimelineeventprovider = enabled
< worklog.webui.worklogpage = enabled
< worklog.xmlrpc.worllogrpc = enabled
< 
< [field settings]
< billable.permission = TIME_VIEW:hide, TIME_RECORD:disable
< estimatedhours.permission = TIME_RECORD:disable
< fields = billable, totalhours, hours, estimatedhours, internal
< hours.permission = TIME_VIEW:remove, TIME_RECORD:disable
< internal.permission = TIME_RECORD:hide
< 
128a42
> # log_format = <inherited>
177c91
< name = testing

---
> name = test trac 3
194a109
> # default_disabled_filters = <inherited>
196a112,114
> [sqlite]
> # extensions = <inherited>
> 
214,252c132
< workflow = MultipleWorkflowPlugin
< 
< [ticket-custom]
< billable = checkbox
< billable.label = Billable?
< billable.order = 3
< billable.value = 1
< due_date = text
< due_date.date = true
< due_date.date_empty = on
< due_date.format = plain
< due_date.label = Due Date
< due_date.options = 
< due_date.order = 7
< due_date.value = 
< estimatedhours = text
< estimatedhours.format = plain
< estimatedhours.label = Estimated Number of Hours
< estimatedhours.order = 1
< estimatedhours.value = 0
< hours = text
< hours.format = plain
< hours.label = Add Hours to Ticket
< hours.order = 2
< hours.value = 0
< internal = checkbox
< internal.label = Internal?
< internal.order = 5
< internal.value = 0
< parents = text
< parents.format = plain
< parents.label = Parent Tickets
< parents.order = 0
< parents.value = 
< totalhours = text
< totalhours.format = plain
< totalhours.label = Total Hours
< totalhours.order = 4
< totalhours.value = 0

---
> workflow = ConfigurableTicketWorkflow
255,334d134
< ; enterprise-workflow.ini
< ;
< ; assign, reassign, unassign actions
< assign = new -> assigned
< assign.operations = set_owner
< assign.permissions = TICKET_MODIFY
< 
< reassign = assigned,in_work -> assigned
< reassign.operations = set_owner
< reassign.permissions = TICKET_MODIFY
< 
< reassign_closed = closed -> closed
< reassign_closed.name = reassign
< reassign_closed.operations = set_owner
< reassign_closed.permissions = TICKET_MODIFY
< 
< unassign = assigned,in_work -> new
< unassign.operations = del_owner
< unassign.permissions = TICKET_MODIFY
< 
< ; leave actions
< leave = * -> *
< leave.operations = leave_status
< leave.default = 1
< 
< ; test actions
< ;test.tickettype = task
< test = new,assigned,in_work -> in_QA
< test.permissions = TICKET_MODIFY
< 
< ; if it is a bug aka defect, then i want a simpler, faster workflow
< ;fixed.tickettype = defect
< ;fixed = new,assigned,in_work -> closed
< ;fixed.operations = set_resolution
< ;fixed.permissions = TICKET_MODIFY
< ; resolve actions
< resolve = in_QA -> closed
< resolve.operations = set_resolution
< resolve.permissions = TICKET_MODIFY
< 
< fail = in_QA -> assigned
< fail.permissions = TICKET_MODIFY
< 
< ; start/stop actions
< start = assigned -> in_work
< start.operations = set_owner_to_self
< start.permissions = TICKET_MODIFY
< 
< stop = in_work -> assigned
< stop.permissions = TICKET_MODIFY
< 
< ; reopen actions
< reopen = closed -> new
< reopen.operations = del_resolution
< reopen.permissions = TICKET_CREATE
< 
< ; request info actions
< ; For tickets with an owner, they go back to assigned
< requestinfo = assigned,in_work,in_QA -> infoneeded
< requestinfo.name = request info
< requestinfo.permissions = TICKET_MODIFY
< 
< provideinfo = infoneeded -> assigned
< provideinfo.name = provide info
< provideinfo.permissions = TICKET_MODIFY
< provideinfo.default = 2
< 
< ; But tickets without an owner go back to new.
< requestinfo_new = new -> infoneeded_new
< requestinfo_new.name = request info
< requestinfo_new.permissions = TICKET_MODIFY
< 
< provideinfo_new = infoneeded_new -> new
< provideinfo_new.name = provide info
< provideinfo_new.permissions = TICKET_MODIFY
< provideinfo_new.default = 2
< 
< [ticket-workflow-defect]
< ; Original workflow
< 
351,352d150
< 
< 
387c185
< permission_policies = InternalTicketsPolicy, DefaultPermissionPolicy, LegacyAttachmentPolicy

---
> permission_policies = DefaultPermissionPolicy, LegacyAttachmentPolicy
392a191
> # request_filters = <inherited>
(trac2)[ neilus@eve trac2 (master=) ]$ 

@neilus
Copy link
Author

neilus commented Sep 21, 2014

a plantuml-nek azon kívül, hogy engedélyezem kell egy külön szekció a trac.ini-ben, a mac-emen:

[plantuml]                                                                     
java_bin = /usr/bin/java
plantuml_jar = /usr/local/Cellar/plantuml/8002/plantuml.8002.jar

A graphviz pedig kiabál, hogy nem találja a dot parancsot ott ahol keresi (lehet linuxon megtalálja, ha a csomagkezelőből jött fel) de az /opt/local/bin elérési út az egyik amit vizsgál (az /usr/local/bin-t viszont - legalábbis a mac-emen, nem)
asszem ennyi vót a móka mára. minden megy ami izgatta a fantáziámat.

@neilus
Copy link
Author

neilus commented Sep 21, 2014

A plantuml-hez a teszt wiki bejegyzésem:

== factory test
{{{
#!plantuml
@startuml
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response
Alice -> Bob: Another authentication Request
Alice <-- Bob: another authentication Response
@enduml

}}}

== sequence diagram

{{{
#!plantuml
@startuml
title Example Sequence Diagram
activate Client
Client -> Server: Session Initiation
note right: Client requests new session
activate Server
Client <-- Server: Authorization Request
note left: Server requires authentication
Client -> Server: Authorization Response
note right: Client provides authentication details
Server --> Client: Session Token
note left: Session established
deactivate Server
Client -> Client: Saves token
deactivate Client
@enduml

}}}

== activity diagram

{{{
#!plantuml
@startuml
title An Example Activity Diagram
note right: Example Function
(*)--> "Step 1"
--> "Step 2"
-> "Step 3"
--> "Step 4"
--> === STARTLOOP ===
note top: For each element in the array
if "Are we done?" then
  -> [no] "Do this"
  -> "Do that"
  note bottom: Important note\ngoes here
  -up-> "Increment counters"
  --> === STARTLOOP ===
else
  --> [yes] === ENDLOOP ===
endif
--> "Last Step"
--> (*)
@enduml

}}}

== another example

{{{
#!plantuml
@startuml
title my favorite labuser
LabUser --> (Runs Simulation)
LabUser --> (Analyses Results)
@enduml

}}}

== and another one bites the dust

{{{
#!plantuml
@startuml
title object öröklődés miafaszom
Object1 <|-- Object2
Object1: someVar
Object1: execute()
Object2: getState()
Object2: setState()
Object2: state
@enduml

}}}

== and another one...

{{{
#!plantuml
@startuml
title object state diagramm
[*] --> Start
Start -> State2
State2 -> State3
note right of State3: Notes can be\nattached to states
State2 --> State4
State4 -> Finish
State3 --> Finish
Finish --> [*]
@enduml

}}}

és a graphvizhez:

{{{
#!graphviz
digraph G {Hello->World->Graphviz->Rules}
}}}



{{{
#!graphviz
  digraph G {
    rankdir = "LR"
    GraphvizPlugin [ URL=GraphvizPlugin ]
    Trac [ 
      URL="http://trac.edgewall.org/"   
      fontcolor=red
    ]
    GraphvizPlugin -> Trac
    }
}}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment