milkode 0.9.2 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{milkode}
8
- s.version = "0.9.2"
8
+ s.version = "0.9.3"
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{2012-09-07}
12
+ s.date = %q{2012-10-06}
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"]
@@ -75,6 +75,8 @@ Gem::Specification.new do |s|
75
75
  "lib/milkode/cdweb/public/images/file.png",
76
76
  "lib/milkode/cdweb/public/images/go-home-5.png",
77
77
  "lib/milkode/cdweb/public/images/help.png",
78
+ "lib/milkode/cdweb/public/images/view-refresh-4.png",
79
+ "lib/milkode/cdweb/public/images/waiting.gif",
78
80
  "lib/milkode/cdweb/public/img/glyphicons-halflings-white.png",
79
81
  "lib/milkode/cdweb/public/img/glyphicons-halflings.png",
80
82
  "lib/milkode/cdweb/public/js/bootstrap.min.js",
@@ -103,6 +105,7 @@ Gem::Specification.new do |s|
103
105
  "lib/milkode/common/grensnip.rb",
104
106
  "lib/milkode/common/ignore_checker.rb",
105
107
  "lib/milkode/common/ignore_setting.rb",
108
+ "lib/milkode/common/plang_detector.rb",
106
109
  "lib/milkode/common/platform.rb",
107
110
  "lib/milkode/common/string_snip.rb",
108
111
  "lib/milkode/common/util.rb",
@@ -110,6 +113,7 @@ Gem::Specification.new do |s|
110
113
  "lib/milkode/database/document_table.rb",
111
114
  "lib/milkode/database/groonga_database.rb",
112
115
  "lib/milkode/database/package_table.rb",
116
+ "lib/milkode/database/updater.rb",
113
117
  "lib/milkode/findgrep/findgrep.rb",
114
118
  "lib/milkode/findgrep/result.rb",
115
119
  "lib/milkode/grep/cli_grep.rb",
@@ -130,6 +134,8 @@ Gem::Specification.new do |s|
130
134
  "test/data/c_project/c.txt",
131
135
  "test/data/c_project/cc.txt",
132
136
  "test/data/c_project/to/file.rb",
137
+ "test/data/ignore_test/.gitignore",
138
+ "test/data/ignore_test/a.txt",
133
139
  "test/data/no_auto_ignore/.gitignore",
134
140
  "test/data/no_auto_ignore/a.txt",
135
141
  "test/data/nodir_abc.zip",
@@ -162,8 +168,10 @@ Gem::Specification.new do |s|
162
168
  "test/test_package.rb",
163
169
  "test/test_package_list.rb",
164
170
  "test/test_package_table.rb",
171
+ "test/test_plang_detector.rb",
165
172
  "test/test_query.rb",
166
173
  "test/test_string_snip.rb",
174
+ "test/test_updater.rb",
167
175
  "test/test_util.rb",
168
176
  "test/test_yaml_file_wrapper.rb"
169
177
  ]
@@ -0,0 +1 @@
1
+ *.bak
@@ -0,0 +1 @@
1
+ a
@@ -34,7 +34,8 @@ class TestCLI < Test::Unit::TestCase
34
34
  end
35
35
 
36
36
  def test_info
37
- assert_match /.*packages.*records/, command("info")
37
+ # assert_match /.*packages.*records/, command("info")
38
+ assert_match /Not registered/, command("info")
38
39
  end
39
40
 
40
41
  def test_setdb_no_arg_disp
@@ -0,0 +1,32 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # @file
4
+ # @brief
5
+ # @author ongaeshi
6
+ # @date 2012/09/29
7
+
8
+ require 'milkode/common/plang_detector'
9
+ require 'test_helper'
10
+
11
+ module Milkode
12
+ class TestPlangDetector < Test::Unit::TestCase
13
+ def test_name
14
+ assert_equal 'ActionScript', PlangDetector.new('Dummy.as').name
15
+ assert_equal 'C' , PlangDetector.new('a.c').name
16
+ assert_equal 'C' , PlangDetector.new('a.h').name
17
+ assert_equal 'C#' , PlangDetector.new('AssemblyInfo.cs').name
18
+ assert_equal 'C++' , PlangDetector.new('path/to/file.hpp').name
19
+ assert_equal 'Ruby' , PlangDetector.new('template.rb').name
20
+ assert_equal 'README' , PlangDetector.new('readme.txt').name
21
+ assert_equal 'JavaScript' , PlangDetector.new('main.js').name
22
+ end
23
+
24
+ def test_unknown
25
+ assert_equal 'unknown', PlangDetector.new('').name
26
+ assert_equal 'unknown', PlangDetector.new('.').name
27
+ assert_equal 'unknown', PlangDetector.new('abcdefg').name
28
+ end
29
+ end
30
+ end
31
+
32
+
@@ -0,0 +1,121 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # @file
4
+ # @brief
5
+ # @author ongaeshi
6
+ # @date 2012/09/12
7
+
8
+ require 'test_helper'
9
+ require 'milkode/database/updater'
10
+ require 'milkode_test_work'
11
+ require 'fileutils'
12
+ require 'milkode/common/ignore_checker'
13
+
14
+ module Milkode
15
+ class TestUpdater < Test::Unit::TestCase
16
+ def setup
17
+ @work = MilkodeTestWork.new({:default_db => true})
18
+
19
+ FileUtils.cp_r @work.expand_path("../data/a_project"), @work.expand_path("a_project")
20
+ @work.add_package "db1", @work.expand_path("a_project")
21
+
22
+ FileUtils.cp_r @work.expand_path("../data/ignore_test"), @work.expand_path(".")
23
+ @work.add_package "db1", @work.expand_path("ignore_test")
24
+
25
+ @grndb = GroongaDatabase.new
26
+ @grndb.open(@work.expand_path("db1"))
27
+ end
28
+
29
+ def test_update
30
+ t_pre_check
31
+ t_update
32
+ t_add_file
33
+ t_update_file
34
+ t_local_gitignore
35
+ t_global_ignore
36
+ t_no_auto_ignore
37
+ t_silent_mode
38
+ # t_display_info # ONにすると標準出力されてしまうため
39
+ end
40
+
41
+ def teardown
42
+ @work.teardown
43
+ end
44
+
45
+ private
46
+
47
+ def t_pre_check
48
+ assert_equal 2, @grndb.packages.size
49
+ assert_not_nil @grndb.packages['a_project']
50
+ end
51
+
52
+ def t_update
53
+ updater = Updater.new(@grndb, 'a_project')
54
+ updater.exec
55
+ result_test updater.result, 3, 0, 0
56
+ end
57
+
58
+ def t_add_file
59
+ FileUtils.touch(@work.expand_path("a_project/aaa"), :mtime => Time.now - 1)
60
+ updater = Updater.new(@grndb, 'a_project')
61
+ updater.exec
62
+ result_test updater.result, 4, 1, 0
63
+ end
64
+
65
+ def t_update_file
66
+ FileUtils.copy @work.expand_path("../data/c_project/a.txt"), @work.expand_path("a_project/aaa")
67
+ FileUtils.touch(@work.expand_path("a_project/aaa"))
68
+ updater = Updater.new(@grndb, 'a_project')
69
+ updater.exec
70
+ result_test updater.result, 4, 0, 1
71
+ end
72
+
73
+ def t_local_gitignore
74
+ FileUtils.touch(@work.expand_path("ignore_test/b.bak")) # *.bak は除外対象
75
+ FileUtils.touch(@work.expand_path("ignore_test/b.txt"))
76
+ updater = Updater.new(@grndb, 'ignore_test')
77
+ updater.exec
78
+ result_test updater.result, 3, 1, 0
79
+ end
80
+
81
+ def t_global_ignore
82
+ FileUtils.touch(@work.expand_path("ignore_test/c.txt"))
83
+
84
+ updater = Updater.new(@grndb, 'ignore_test')
85
+ updater.exec
86
+ result_test updater.result, 4, 1, 0
87
+
88
+ updater = Updater.new(@grndb, 'ignore_test')
89
+ updater.set_package_ignore(IgnoreSetting.new("/", ["*.txt"])) # *.txt を除外設定
90
+ updater.exec
91
+ result_test updater.result, 1, 0, 0
92
+ end
93
+
94
+ def t_no_auto_ignore
95
+ updater = Updater.new(@grndb, 'ignore_test')
96
+ updater.enable_no_auto_ignore
97
+ updater.exec
98
+ result_test updater.result, 6, 2, 0
99
+ end
100
+
101
+ def t_silent_mode
102
+ updater = Updater.new(@grndb, 'ignore_test')
103
+ updater.enable_silent_mode
104
+ updater.exec
105
+ result_test updater.result, 4, 0, 0
106
+ end
107
+
108
+ def t_display_info
109
+ updater = Updater.new(@grndb, 'ignore_test')
110
+ updater.enable_display_info
111
+ updater.exec
112
+ result_test updater.result, 4, 0, 0
113
+ end
114
+
115
+ def result_test(result, file_count, add_count, update_count)
116
+ assert_equal file_count, result.file_count
117
+ assert_equal add_count, result.add_count
118
+ assert_equal update_count, result.update_count
119
+ end
120
+ end
121
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: milkode
3
3
  version: !ruby/object:Gem::Version
4
- hash: 63
4
+ hash: 61
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 2
10
- version: 0.9.2
9
+ - 3
10
+ version: 0.9.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - ongaeshi
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-09-07 00:00:00 +09:00
18
+ date: 2012-10-06 00:00:00 +09:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -304,6 +304,8 @@ files:
304
304
  - lib/milkode/cdweb/public/images/file.png
305
305
  - lib/milkode/cdweb/public/images/go-home-5.png
306
306
  - lib/milkode/cdweb/public/images/help.png
307
+ - lib/milkode/cdweb/public/images/view-refresh-4.png
308
+ - lib/milkode/cdweb/public/images/waiting.gif
307
309
  - lib/milkode/cdweb/public/img/glyphicons-halflings-white.png
308
310
  - lib/milkode/cdweb/public/img/glyphicons-halflings.png
309
311
  - lib/milkode/cdweb/public/js/bootstrap.min.js
@@ -332,6 +334,7 @@ files:
332
334
  - lib/milkode/common/grensnip.rb
333
335
  - lib/milkode/common/ignore_checker.rb
334
336
  - lib/milkode/common/ignore_setting.rb
337
+ - lib/milkode/common/plang_detector.rb
335
338
  - lib/milkode/common/platform.rb
336
339
  - lib/milkode/common/string_snip.rb
337
340
  - lib/milkode/common/util.rb
@@ -339,6 +342,7 @@ files:
339
342
  - lib/milkode/database/document_table.rb
340
343
  - lib/milkode/database/groonga_database.rb
341
344
  - lib/milkode/database/package_table.rb
345
+ - lib/milkode/database/updater.rb
342
346
  - lib/milkode/findgrep/findgrep.rb
343
347
  - lib/milkode/findgrep/result.rb
344
348
  - lib/milkode/grep/cli_grep.rb
@@ -359,6 +363,8 @@ files:
359
363
  - test/data/c_project/c.txt
360
364
  - test/data/c_project/cc.txt
361
365
  - test/data/c_project/to/file.rb
366
+ - test/data/ignore_test/.gitignore
367
+ - test/data/ignore_test/a.txt
362
368
  - test/data/no_auto_ignore/.gitignore
363
369
  - test/data/no_auto_ignore/a.txt
364
370
  - test/data/nodir_abc.zip
@@ -391,8 +397,10 @@ files:
391
397
  - test/test_package.rb
392
398
  - test/test_package_list.rb
393
399
  - test/test_package_table.rb
400
+ - test/test_plang_detector.rb
394
401
  - test/test_query.rb
395
402
  - test/test_string_snip.rb
403
+ - test/test_updater.rb
396
404
  - test/test_util.rb
397
405
  - test/test_yaml_file_wrapper.rb
398
406
  has_rdoc: true