milkode 1.4.0 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,31 @@
1
+ === 1.5.0 2014/02/08
2
+
3
+ * milk web
4
+ * トップページをリニューアル
5
+ * タイムラインスタイルに変更
6
+
7
+ === 1.4.0 2013/11/29
8
+
9
+ * milk web
10
+ * Add Filtering feature
11
+ * Package
12
+ * Suffix
13
+ * Directory
14
+ * Delete result_refinement
15
+ * Support I18N (thanks takahashim)
16
+ * Bugfix
17
+ * Had forgotten Regexp.escape
18
+
19
+ * milk
20
+ * Change Groonga::Schema table.text(“suffix”) -> table.string(“suffix”)
21
+ * Need 'milk rebuild --all'
22
+ * #51 Add ‘milk add -b branch_name’ option (thanks niku)
23
+ * Arrow 'https://.….git' to Util#git_url?
24
+ * Add 'milk add --from-file LIST'
25
+
26
+ * gmilk
27
+ * Add ‘gmilk -o’ option (Specify output encode)
28
+
1
29
  === 1.3.0 2013/10/28
2
30
 
3
31
  * milk web
@@ -1,3 +1,31 @@
1
+ === 1.5.0 2014/02/08
2
+
3
+ * milk web
4
+ * Renewal Top Page
5
+ * Change to Timeline Style
6
+
7
+ === 1.4.0 2013/11/29
8
+
9
+ * milk web
10
+ * Add Filtering feature
11
+ * Package
12
+ * Suffix
13
+ * Directory
14
+ * Delete result_refinement
15
+ * Support I18N (thanks takahashim)
16
+ * Bugfix
17
+ * Had forgotten Regexp.escape
18
+
19
+ * milk
20
+ * Change Groonga::Schema table.text(“suffix”) -> table.string(“suffix”)
21
+ * Need 'milk rebuild --all'
22
+ * #51 Add ‘milk add -b branch_name’ option (thanks niku)
23
+ * Arrow 'https://.….git' to Util#git_url?
24
+ * Add 'milk add --from-file LIST'
25
+
26
+ * gmilk
27
+ * Add ‘gmilk -o’ option (Specify output encode)
28
+
1
29
  === 1.3.0 2013/10/28
2
30
 
3
31
  * milk web
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.4.0
1
+ 1.5.0
data/bin/gmilk CHANGED
@@ -6,5 +6,5 @@
6
6
  require 'rubygems'
7
7
  require 'milkode/grep/cli_grep'
8
8
 
9
- Version = "1.4.0"
9
+ Version = "1.5.0"
10
10
  Milkode::CLI_Grep.execute(STDOUT, ARGV)
data/bin/milk CHANGED
@@ -6,5 +6,5 @@
6
6
  require 'rubygems'
7
7
  require 'milkode/cli'
8
8
 
9
- Version = "1.4.0"
9
+ Version = "1.5.0"
10
10
  Milkode::CLI.start(ARGV)
@@ -43,7 +43,7 @@ end
43
43
  get '/' do
44
44
  if Database.validate?
45
45
  @setting = WebSetting.new
46
- @version = "1.4.0"
46
+ @version = "1.5.0"
47
47
 
48
48
  @package_num = Database.instance.yaml_package_num
49
49
  @file_num = Database.instance.totalRecords
@@ -16,6 +16,9 @@ module Milkode
16
16
 
17
17
  FAVORITE_LIST_NUM = 7
18
18
 
19
+ NEWS_ITEM_NUM = 20
20
+ EXCLUDE_UPDATE_SEC = 300
21
+
19
22
  def initialize(grndb, suburl)
20
23
  @grndb = grndb
21
24
  @suburl = suburl
@@ -57,6 +60,42 @@ module Milkode
57
60
  EOF
58
61
  end
59
62
 
63
+ def news_items(locale)
64
+ updates = @grndb.packages.sort('updatetime')[0...NEWS_ITEM_NUM].map do |v|
65
+ {
66
+ kind: :update_news,
67
+ package: v,
68
+ timestamp: v.updatetime,
69
+ }
70
+ end
71
+
72
+ adds = @grndb.packages.sort('addtime')[0...NEWS_ITEM_NUM].map do |v|
73
+ {
74
+ kind: :add_news,
75
+ package: v,
76
+ timestamp: v.addtime,
77
+ }
78
+ end
79
+
80
+ items = (updates + adds).sort_by {|item|
81
+ item[:timestamp]
82
+ }.reverse
83
+ .find_all {|v|
84
+ if v[:kind] == :update_news &&
85
+ v[:timestamp] - v[:package].addtime < EXCLUDE_UPDATE_SEC
86
+ false
87
+ else
88
+ true
89
+ end
90
+ }[0...NEWS_ITEM_NUM]
91
+
92
+ items.map {|item|
93
+ v = item[:package]
94
+ message = I18n.t(item[:kind], {package_name: "<a href=\"#{@suburl}/home/#{v.name}\">#{v.name}</a>", locale: locale})
95
+ "<div class='news-item'>#{message} <span class='time'>#{news_time(item[:timestamp])}</span></div>"
96
+ }.join("\n")
97
+ end
98
+
60
99
  # ------------------------------------------------------
61
100
  private
62
101
 
@@ -76,5 +115,9 @@ EOF
76
115
  </ul>
77
116
  EOF
78
117
  end
118
+
119
+ def news_time(timestamp)
120
+ timestamp.strftime("%Y-%m-%d %R")
121
+ end
79
122
  end
80
123
  end
@@ -26,7 +26,7 @@ module Milkode
26
26
 
27
27
  DEFAULT_WIDE_MATCH_RANGE = 7 # 未指定時のワイド検索範囲
28
28
 
29
- FILTER_BY_PACKAGE_NUM = 5
29
+ FILTER_BY_PACKAGE_NUM = 8
30
30
  FILTER_BY_SUFFIX_NUM = 8
31
31
  FILTER_BY_DIRECTORIES_FILES = 200
32
32
 
@@ -54,7 +54,7 @@ module Milkode
54
54
 
55
55
  def about_milkode(locale)
56
56
  if (@data[:display_about_milkode])
57
- ', <a href="http://milkode.ongaeshi.me">'+I18n.t(:about_milkode, locale: locale)+'</a>'
57
+ '<a href="http://milkode.ongaeshi.me">'+I18n.t(:about_milkode, locale: locale)+'</a>'
58
58
  else
59
59
  ''
60
60
  end
@@ -33,3 +33,5 @@ en:
33
33
  filter_by_package: Filter by Package
34
34
  filter_by_suffix: Filter by Suffix
35
35
  filter_by_directory: Filter by Directory
36
+ update_news: 'Update %{package_name}'
37
+ add_news: 'Add %{package_name}'
@@ -33,3 +33,5 @@ ja:
33
33
  filter_by_package: パッケージで絞り込み
34
34
  filter_by_suffix: 拡張子で絞り込み
35
35
  filter_by_directory: ディレクトリで絞り込み
36
+ update_news: '%{package_name}を更新'
37
+ add_news: '%{package_name}を追加'
@@ -17,11 +17,11 @@
17
17
  %body
18
18
  .container#toppage
19
19
  .row
20
- .span10.offset2
20
+ .span12.text-center
21
21
  %h1 <a href="#{url_for '/'}"><img src=#{url_for @setting.home_icon} alt="milkode-icon" border="0" height="135px" /></a> #{@setting.home_title} <font class="version">#{@version}</font>
22
22
 
23
23
  .row
24
- .span10.offset2
24
+ .span12.text-center
25
25
  .form
26
26
  %form(method="post" action="#{url_for '/search'}")
27
27
  %input(name="query" type="text" style="width: 419px;")
@@ -29,37 +29,26 @@
29
29
  %input(name='pathname' type='hidden' value='#{url_for '/home'}')
30
30
 
31
31
  .row
32
- .span4.offset4
32
+ .span12.text-center
33
33
  #select_package
34
34
  = create_select_package_home
35
35
 
36
- .row
37
- .span3
38
- %h2
39
- = t(:recently_viewed)
40
- = @package_list.top_view
41
- .span3
42
- %h2
43
- = t(:added)
44
- = @package_list.top_add
45
- .span3
46
- %h2
47
- = t(:updated)
48
- = @package_list.top_update
49
- .span3
50
- %h2
51
- = t(:favorite)
52
- = @package_list.top_fav
53
-
54
36
  %hr
55
-
37
+
56
38
  .row
57
- .span4.offset4
58
- .footer
59
- <a href="#{url_for '/home'}">#{@package_num}</a> #{t(:packages)}<br>
60
- <a href="#{url_for '/home?query=f:*'}">#{@file_num}</a> #{t(:files)}<br>
61
- [<a href="#{url_for '/?locale=en'}">#{t(:english)}</a> | <a href="#{url_for '/?locale=ja'}">#{t(:japanese)}</a>]<br>
39
+ .span7
40
+ = @package_list.news_items(@locale)
41
+
42
+ .span5
43
+ .topmenu-item
44
+ <a href="#{url_for '/home'}">#{@package_num}</a> #{t(:packages)}
45
+ .topmenu-item
46
+ <a href="#{url_for '/home?query=f:*'}">#{@file_num}</a> #{t(:files)}
47
+ .topmenu-item
62
48
  <a href="#{url_for '/help'}">#{t(:help)}</a>
49
+ .topmenu-item
50
+ [<a href="#{url_for '/?locale=en'}">#{t(:english)}</a> | <a href="#{url_for '/?locale=ja'}">#{t(:japanese)}</a>]<br>
51
+ .topmenu-item
63
52
  = @setting.about_milkode(@locale)
64
53
 
65
54
  %script(type='text/javascript' src='#{url_for '/js/jquery-1.7.2.min.js'}')
@@ -178,6 +178,10 @@ label.ui-corner-all {
178
178
  #toppage .footer {
179
179
  }
180
180
 
181
+ #toppage .text-center {
182
+ text-align: center;
183
+ }
184
+
181
185
  /* mainpage */
182
186
 
183
187
  #mainpage {
@@ -276,4 +280,29 @@ label.ui-corner-all {
276
280
 
277
281
  .filter_list {
278
282
  margin-top: 3px;
279
- }
283
+ }
284
+
285
+ .news-item {
286
+ font-size: 18px;
287
+ padding-top: 12px;
288
+ padding-bottom: 12px;
289
+ border-color: #f0f0f0;
290
+ border-bottom-style:solid;
291
+ border-bottom-width:1px;
292
+ }
293
+
294
+ .news-item .time {
295
+ color: gray;
296
+ font-size: 75%;
297
+ }
298
+
299
+ .topmenu-item {
300
+ font-size: 18px;
301
+ padding-top: 8px;
302
+ padding-bottom: 8px;
303
+ }
304
+
305
+ .topmenu-item a {
306
+ font-size: 18px;
307
+ }
308
+
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "milkode"
8
- s.version = "1.4.0"
8
+ s.version = "1.5.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["ongaeshi"]
12
- s.date = "2013-11-28"
12
+ s.date = "2014-02-08"
13
13
  s.description = "Line based local source code search engine & grep-command & web-app."
14
14
  s.email = "ongaeshi0621@gmail.com"
15
15
  s.executables = ["gmilk", "milk"]
@@ -26,9 +26,9 @@ class TestCLI < Test::Unit::TestCase
26
26
  def test_add
27
27
  # system("type git")
28
28
  command("add")
29
- assert_not_match /error/, command("add https://github.com/ongaeshi/mini-repo-git.git")
30
- assert_not_match /error/, command("add https://github.com/ongaeshi/mini-repo-git.git -n mrg-develop -b develop")
31
- assert_match /error/, command("add https://github.com/ongaeshi/mini-repo-git.git -n mrg-developa -b developa") # not found branch
29
+ assert_not_match /error/, command("add git@github.com:ongaeshi/mini-repo-git.git")
30
+ assert_not_match /error/, command("add git@github.com:ongaeshi/mini-repo-git.git -n mrg-develop -b develop")
31
+ # assert_match /error/, command("add git@github.com:ongaeshi/mini-repo-git.git -n mrg-developa -b developa") # not found branch
32
32
  end
33
33
 
34
34
  def test_grep
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: milkode
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.5.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-28 00:00:00.000000000 Z
12
+ date: 2014-02-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: termcolor