milkode 0.9.9.9 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,18 @@
1
+ === 1.0.0 2013/05/21
2
+
3
+ * milk web
4
+ * 統計情報
5
+ * 拡張子絞り込みのリンクを追加
6
+ * unknownの表示形式を変更
7
+ * 旧: 'hoge.list' -> 'unknown'
8
+ * 新: 'hoge.list' -> '.list'
9
+
10
+ * gmilk
11
+ * Windows環境でgmilkが動かない問題を修正
12
+
13
+ * etc
14
+ * test/unit 2.5.4 で警告が出る箇所を修正
15
+
1
16
  === 0.9.9.9 2013/05/05
2
17
 
3
18
  * milk web
@@ -1,3 +1,17 @@
1
+ === 1.0.0 2013/05/21
2
+
3
+ * milk web
4
+ * info
5
+ * Add extention refinement links
6
+ * Change unknown view
7
+ * old: 'hoge.list' -> 'unknown'
8
+ * new: 'hoge.list' -> '.list'
9
+
10
+ * gmilk
11
+ * Windows環境でgmilkが動かない問題を修正
12
+
13
+ * etc
14
+ * test/unit 2.5.4 で警告が出る箇所を修正
1
15
  === 0.9.9.9 2013/05/05
2
16
 
3
17
  * milk web
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.9.9
1
+ 1.0.0
data/bin/gmilk CHANGED
@@ -6,5 +6,5 @@
6
6
  require 'rubygems'
7
7
  require 'milkode/grep/cli_grep'
8
8
 
9
- Version = "0.9.9.9"
9
+ Version = "1.0.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 = "0.9.9.9"
9
+ Version = "1.0.0"
10
10
  Milkode::CLI.start(ARGV)
@@ -29,7 +29,7 @@ set :haml, :format => :html5
29
29
  get '/' do
30
30
  if Database.validate?
31
31
  @setting = WebSetting.new
32
- @version = "0.9.9.9"
32
+ @version = "1.0.0"
33
33
 
34
34
  @package_num = Database.instance.yaml_package_num
35
35
  @file_num = Database.instance.totalRecords
@@ -7,6 +7,7 @@
7
7
 
8
8
  require 'milkode/cdweb/lib/database'
9
9
  require 'milkode/common/plang_detector'
10
+ require 'milkode/cdweb/lib/mkurl'
10
11
 
11
12
  module Milkode
12
13
  class InfoPackage
@@ -26,7 +27,7 @@ EOF
26
27
 
27
28
  @plang_content = <<EOF
28
29
  <table class="table-striped table-bordered table-condensed">
29
- #{breakdown_detail(records)}
30
+ #{breakdown_detail(name, records)}
30
31
  </table>
31
32
  EOF
32
33
  end
@@ -46,28 +47,47 @@ EOF
46
47
  end
47
48
  end
48
49
 
49
- def breakdown_detail(records)
50
- sorted_plangs(records).map {|name, count|
50
+ def breakdown_detail(package_name, records)
51
+ sorted_plangs(records).map {|name, count, lang|
51
52
  percent = (count.to_f / records.size * 100).to_i
52
- "<tr><td>#{name}</td><td align=\"right\">#{count}</td><td align=\"right\">#{percent}%</td></tr>"
53
+
54
+ params = { :query => lang_to_query(lang) }
55
+
56
+ if params[:query] != ""
57
+ url = "/home/" + Mkurl.new(package_name, params).inherit_query_shead
58
+ "<tr><td>#{name}</td><td align=\"right\"><a href=\"#{url}\">#{count}</a></td><td align=\"right\">#{percent}%</td></tr>"
59
+ else
60
+ "<tr><td>#{name}</td><td align=\"right\">#{count}</td><td align=\"right\">#{percent}%</td></tr>"
61
+ end
53
62
  }.join("\n")
54
63
  end
55
64
 
65
+ def lang_to_query(lang)
66
+ # @memo
67
+ # この実装には問題がある。Makefileなどの検索クエリが正しくない。
68
+ # 正しく実装するには AND, OR 検索を実装する必要がある
69
+ result = []
70
+ result << lang.suffixs.map{|v|"s:#{v}"}.join(" ") if lang.suffixs
71
+ result << lang.filenames.map{|v|"f:#{v}"}.join(" ") if lang.filenames
72
+ result << lang.filepatterns.map{|v|"f:#{v}"}.join(" ") if lang.filepatterns
73
+ result.join(" ")
74
+ end
75
+
56
76
  def sorted_plangs(records)
57
77
  total = {}
58
78
 
59
79
  records.each do |record|
60
80
  lang = PlangDetector.new(record.restpath)
61
-
81
+
62
82
  if total[lang.name]
63
- total[lang.name] += 1
83
+ total[lang.name][0] += 1
64
84
  else
65
- total[lang.name] = 1
85
+ total[lang.name] = [1, lang]
66
86
  end
67
87
  end
68
88
 
69
- total.map {|name, count|
70
- [name, count]
89
+ total.map {|name, data|
90
+ [name, data[0], data[1]]
71
91
  }.sort {|a, b|
72
92
  if (a[0] == PlangDetector::UNKNOWN)
73
93
  -1
@@ -97,13 +97,31 @@ module Milkode
97
97
  is_found
98
98
  }
99
99
 
100
- @lang ||= UNKNOWN_LANGUAGE
100
+ if @lang.nil?
101
+ if suffix
102
+ @lang = {:name => "." + suffix, :suffixs => [suffix]}
103
+ else
104
+ @lang = UNKNOWN_LANGUAGE
105
+ end
106
+ end
101
107
  end
102
108
 
103
109
  def name
104
110
  @lang[:name]
105
111
  end
106
112
 
113
+ def suffixs
114
+ @lang[:suffixs]
115
+ end
116
+
117
+ def filenames
118
+ @lang[:filenames]
119
+ end
120
+
121
+ def filepatterns
122
+ @lang[:filepatterns]
123
+ end
124
+
107
125
  def unknown?
108
126
  name == UNKNOWN
109
127
  end
@@ -111,7 +111,7 @@ EOF
111
111
 
112
112
  # 現在位置のパッケージを記録
113
113
  if option.packages.empty? && !my_option[:all] && !is_abs_path
114
- if package_dir_in?(current_dir)
114
+ if current_dir && package_dir_in?(current_dir)
115
115
  option.filePatterns << current_dir
116
116
  elsif current_package
117
117
  option.strict_packages << current_package.name
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{milkode}
8
- s.version = "0.9.9.9"
8
+ s.version = "1.0.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 = %q{2013-05-05}
12
+ s.date = %q{2013-05-21}
13
13
  s.description = %q{Line based local source code search engine & grep-command & web-app.}
14
14
  s.email = %q{ongaeshi0621@gmail.com}
15
15
  s.executables = ["gmilk", "milk"]
@@ -140,10 +140,10 @@ Gem::Specification.new do |s|
140
140
  "test/data/a_project/cdstk_yaml.rb",
141
141
  "test/data/a_project/empty.txt",
142
142
  "test/data/abc.zip",
143
+ "test/data/b_project/dummy_test_dir.rb",
143
144
  "test/data/b_project/runner.rb",
144
- "test/data/b_project/test_dir.rb",
145
+ "test/data/b_project2/dummy_test_dir.rb",
145
146
  "test/data/b_project2/runner.rb",
146
- "test/data/b_project2/test_dir.rb",
147
147
  "test/data/c_project/a.txt",
148
148
  "test/data/c_project/abc.c",
149
149
  "test/data/c_project/abc.h",
@@ -12,7 +12,7 @@ require 'milkode/database/document_record'
12
12
  require 'fileutils'
13
13
 
14
14
  module Milkode
15
- class TestDocumentTable < Test::Unit::TestCase
15
+ class TestDocumentRecord < Test::Unit::TestCase
16
16
  def test_database
17
17
  begin
18
18
  t_setup
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: milkode
3
3
  version: !ruby/object:Gem::Version
4
- hash: 49
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
+ - 1
7
8
  - 0
8
- - 9
9
- - 9
10
- - 9
11
- version: 0.9.9.9
9
+ - 0
10
+ version: 1.0.0
12
11
  platform: ruby
13
12
  authors:
14
13
  - ongaeshi
@@ -16,7 +15,7 @@ autorequire:
16
15
  bindir: bin
17
16
  cert_chain: []
18
17
 
19
- date: 2013-05-05 00:00:00 +09:00
18
+ date: 2013-05-21 00:00:00 +09:00
20
19
  default_executable:
21
20
  dependencies:
22
21
  - !ruby/object:Gem::Dependency
@@ -408,10 +407,10 @@ files:
408
407
  - test/data/a_project/cdstk_yaml.rb
409
408
  - test/data/a_project/empty.txt
410
409
  - test/data/abc.zip
410
+ - test/data/b_project/dummy_test_dir.rb
411
411
  - test/data/b_project/runner.rb
412
- - test/data/b_project/test_dir.rb
412
+ - test/data/b_project2/dummy_test_dir.rb
413
413
  - test/data/b_project2/runner.rb
414
- - test/data/b_project2/test_dir.rb
415
414
  - test/data/c_project/a.txt
416
415
  - test/data/c_project/abc.c
417
416
  - test/data/c_project/abc.h