• R/O
  • SSH
  • HTTPS

shibuya-trac: Commit


Commit MetaInfo

Revision766 (tree)
Zeit2011-03-20 20:35:43
Autorakihirox

Log Message

Apply to Jenkins.

  • change default value
  • add macro RefJenkinsBuild
  • fix resource opener

Ändern Zusammenfassung

Diff

--- plugins/hudsontracplus/0.11/setup.py (revision 765)
+++ plugins/hudsontracplus/0.11/setup.py (revision 766)
@@ -8,9 +8,9 @@
88 version = '0.4',
99 author = "Itou Akihiro",
1010 author_email = "itou.akihiro@gmail.com",
11- description = "An advanced trac plugin to cooperate with hudson. Forked from HudsonTrac Plugin (c) Ronald Tschalär. http://trac-hacks.org/wiki/HudsonTracPlugin",
11+ description = "An advanced trac plugin to cooperate with jenkins. Forked from HudsonTrac Plugin (c) Ronald Tschalär. http://trac-hacks.org/wiki/HudsonTracPlugin",
1212 license = "BSD",
13- keywords = "trac builds hudson",
13+ keywords = "trac builds jenkins",
1414 url = "http://sourceforge.jp/projects/shibuya-trac/wiki/HudsonTracPlusPlugin",
1515
1616 packages = ['HudsonTracPlus'],
--- plugins/hudsontracplus/0.11/HudsonTracPlus/HudsonTracPlusPlugin.py (revision 765)
+++ plugins/hudsontracplus/0.11/HudsonTracPlus/HudsonTracPlusPlugin.py (revision 766)
@@ -113,7 +113,7 @@
113113 - INavigationContributor
114114 - ITimelineEventProvider
115115 - ITemplate Provider
116- - IWkikiMacroProvider
116+ - IWikiMacroProvider
117117
118118 INavigationContributor is for making navbar menu.
119119
@@ -125,13 +125,13 @@
125125 '''
126126 implements(INavigationContributor, ITimelineEventProvider, ITemplateProvider, IWikiMacroProvider)
127127
128- hudson_url = Option('hudsonplus', 'hudson_url', 'http://localhost:8010/hudson/',
129- 'The url of the hudson top page. This must be an ' +
128+ hudson_url = Option('hudsonplus', 'hudson_url', 'http://localhost:8010/jenkins/',
129+ 'The url of the jenkins top page. This must be an ' +
130130 'absolute url. This plugin uses this to get information ' +
131- 'through Hudson Remote API.')
131+ 'through Jenkins Remote API.')
132132
133- nav_url = Option('hudsonplus', 'main_page', '/hudson/',
134- 'The url of the hudson main page to which the trac nav ' +
133+ nav_url = Option('hudsonplus', 'main_page', '/jenkins/',
134+ 'The url of the jenkins main page to which the trac nav ' +
135135 'entry should link; if empty, no entry is created in ' +
136136 'the nav bar/timeline/wikimacro. This may be a relative url.')
137137 jobs = ListOption('hudsonplus', 'jobs', '', sep=',' ,
@@ -138,13 +138,13 @@
138138 doc='Jobs to display on timeline separated by comma. ' +
139139 'If you don\'t specify this at all, show all jobs.')
140140 disp_tab = BoolOption('hudsonplus', 'display_in_new_tab', 'false',
141- 'Open hudson page in new tab/window')
142- navi_label = Option('hudsonplus', 'navigation_label', 'Hudson',
141+ 'Open Jenkins page in new tab/window')
142+ navi_label = Option('hudsonplus', 'navigation_label', 'Jenkins',
143143 'The label of navigation tab.')
144144 username = Option('hudsonplus', 'username', '',
145- 'The username to use to access hudson')
145+ 'The username to use to access Jenkins')
146146 password = Option('hudsonplus', 'password', '',
147- 'The password to use to access hudson')
147+ 'The password to use to access Jenkins')
148148
149149 def __init__(self):
150150 pwdMgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
@@ -175,7 +175,11 @@
175175
176176 def get_htdocs_dirs(self):
177177 from pkg_resources import resource_filename
178- return [('HudsonTracPlus', resource_filename(__name__, 'htdocs'))]
178+ try:
179+ dir = resource_filename(__name__, 'htdocs')
180+ except:
181+ return []
182+ return [('HudsonTracPlus', dir)]
179183
180184 # ITimelineEventProvider methods
181185 def get_timeline_filters(self, req):
@@ -227,19 +231,20 @@
227231
228232 # IWikiMacroProvider method
229233 def get_macros(self):
230- """RefHudsonBuild"""
234+ """RefHudsonBuild/RefJenkinsBuild"""
231235 yield 'RefHudsonBuild'
236+ yield 'RefJenkinsBuild'
232237
233238 def get_macro_description(self, name):
234- return '''Make an extra-link to hudson build'''
239+ return '''Make an extra-link to jenkins build'''
235240
236241 def render_macro(self, req, name, content):
237242 return self.expand_macro(None, name, content)
238243
239244 def expand_macro(self, formatter, name, content):
240- if name == 'RefHudsonBuild':
245+ if name == 'RefHudsonBuild' or name == 'RefJenkinsBuild':
241246 if self.nav_url:
242- return get_build_ref_markup(self.nav_url, self.jobs, content)
247+ return get_build_ref_markup(self.nav_url, self.jobs, content, self.navi_label)
243248
244249 def get_job_url(job_url, hudson_url):
245250 """Return the job url to use api access.
@@ -385,7 +390,7 @@
385390 else:
386391 return unicode(build['description'], 'utf-8') + ' at ' + formated_build_time
387392
388-def get_build_ref_markup(nav_url, jobs, content):
393+def get_build_ref_markup(nav_url, jobs, content, label):
389394 '''Return build reference markup expanded by RefHudsonBuild macro.
390395
391396 ex1. [[RefHudsonBuild(j3, 1)]
@@ -403,7 +408,7 @@
403408 '<a class="ext-link" href="spam/job/&gt;&lt;&#34;/1/"><span class="icon"></span>Hudson: &gt;&lt;&#34;#1</a>'
404409
405410 '''
406- FORMAT = '<a class="ext-link" href="%sjob/%s/%s/"><span class="icon"></span>Hudson: %s#%s</a>'
411+ FORMAT = '<a class="ext-link" href="%sjob/%s/%s/"><span class="icon"></span>%s: %s#%s</a>'
407412 args = map(lambda x: x.strip(), str(content).split(','))
408413 if len(args) == 1:
409414 if len(jobs) == 0:
@@ -414,4 +419,4 @@
414419 job_name = Markup.escape(args[0])
415420 job_no = Markup.escape(args[1])
416421
417- return Markup(FORMAT % (nav_url, job_name, job_no, job_name, job_no))
422+ return Markup(FORMAT % (nav_url, job_name, job_no, label, job_name, job_no))
--- plugins/hudsontracplus/0.11/HudsonTracPlus/TestHudsonTracPlusPlugin.py (revision 765)
+++ plugins/hudsontracplus/0.11/HudsonTracPlus/TestHudsonTracPlusPlugin.py (revision 766)
@@ -10,12 +10,12 @@
1010 def test_default_opt_hudson_url(self):
1111 env = EnvironmentStub()
1212 htpp = HudsonTracPlusPlugin(env)
13- assert 'http://localhost:8010/hudson/' == htpp.hudson_url
13+ assert 'http://localhost:8010/jenkins/' == htpp.hudson_url
1414
1515 def test_default_opt_nav_url(self):
1616 env = EnvironmentStub()
1717 htpp = HudsonTracPlusPlugin(env)
18- assert '/hudson/' == htpp.nav_url
18+ assert '/jenkins/' == htpp.nav_url
1919
2020 def test_default_opt_jobs(self):
2121 env = EnvironmentStub()
Show on old repository browser