milkode 0.9.4 → 0.9.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,17 @@
1
+ === 0.9.5 2012/12/09
2
+
3
+ * milk web
4
+ * 行番号クリック時のモーダルにコピーボタンを配置
5
+ * 'ダイレクトパスのコピー' ボタン
6
+ * 'Lineno + Text' ボタン
7
+ * バグ修正
8
+ * 総マッチ数が正しく表示されないバグを修正 (thanks yosyyy)
9
+ * search_gotoline.rb: ファイル名のリンク位置修正
10
+ * typo
11
+
12
+ * milk
13
+ * 'milk add --empty' オプションを追加
14
+
1
15
  === 0.9.4 2012/11/14
2
16
 
3
17
  * milk web
@@ -1,4 +1,18 @@
1
- === 0.9.4
1
+ === 0.9.5 2012/12/09
2
+
3
+ * milk web
4
+ * Add copy buttons in modal
5
+ * 'Direct path' button
6
+ * 'Lineno + Text' button
7
+ * Bug fix
8
+ * Fix incorrect total match count (thanks yosyyy)
9
+ * search_gotoline.rb: Fix link
10
+ * typo
11
+
12
+ * milk
13
+ * Add 'milk add --empty' options
14
+
15
+ === 0.9.4 2012/11/14
2
16
 
3
17
  * milk web
4
18
  * Improve handling when you click the line number
@@ -121,3 +121,28 @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
121
121
  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
122
122
  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
123
123
  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
124
+
125
+ =================================
126
+ Clippy
127
+ =================================
128
+
129
+ Copyright (c) 2008 Tom Preston-Werner
130
+
131
+ Permission is hereby granted, free of charge, to any person obtaining
132
+ a copy of this software and associated documentation files (the
133
+ 'Software'), to deal in the Software without restriction, including
134
+ without limitation the rights to use, copy, modify, merge, publish,
135
+ distribute, sublicense, and/or sell copies of the Software, and to
136
+ permit persons to whom the Software is furnished to do so, subject to
137
+ the following conditions:
138
+
139
+ The above copyright notice and this permission notice shall be
140
+ included in all copies or substantial portions of the Software.
141
+
142
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
143
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
144
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
145
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
146
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
147
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
148
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.4
1
+ 0.9.5
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.4"
9
+ Version = "0.9.5"
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.4"
9
+ Version = "0.9.5"
10
10
  Milkode::CLI.start(ARGV)
@@ -142,7 +142,7 @@ module Milkode
142
142
  set_yaml_options(package, options, is_update_with_git_pull)
143
143
 
144
144
  # アップデート
145
- update_dir_in(dir)
145
+ update_dir_in(dir) unless options[:empty]
146
146
  end
147
147
  rescue ConvetError
148
148
  return
@@ -22,7 +22,7 @@ set :haml, :format => :html5
22
22
 
23
23
  get '/' do
24
24
  @setting = WebSetting.new
25
- @version = "0.9.4"
25
+ @version = "0.9.5"
26
26
  @package_num = Database.instance.yaml_package_num
27
27
  @file_num = Database.instance.totalRecords
28
28
  @package_list = PackageList.new(Database.instance.grndb)
@@ -198,7 +198,7 @@ EOF
198
198
  </div>
199
199
  <div class="modal-footer">
200
200
  <a href="#" id="updateCancel" class="btn" data-dismiss="modal">Cancel</a>
201
- <a href="#" id="updateOk" class="btn btn-primary" data-loading-text="Updating..." milkode-package-name="#{package_name}"">OK</a>
201
+ <a href="#" id="updateOk" class="btn btn-primary" data-loading-text="Updating..." milkode-package-name="#{package_name}">OK</a>
202
202
  </div>
203
203
  </div>
204
204
 
@@ -214,6 +214,7 @@ EOF
214
214
  </tr></table>
215
215
  </div>
216
216
  <div class="modal-footer">
217
+ <span id="lineno-copyall"></span>
217
218
  <a href="#" id="lineno-ok" class="btn" data-dismiss="modal">OK</a>
218
219
  </div>
219
220
  </div>
@@ -87,9 +87,10 @@ module Milkode
87
87
  end
88
88
 
89
89
  # 検索
90
- result = []
90
+ result, total_records = [], 0
91
+
91
92
  unless is_not_search
92
- result = @documents.search(
93
+ result, total_records = @documents.search_with_match(
93
94
  :patterns => patterns,
94
95
  :keywords => keywords,
95
96
  :paths => paths,
@@ -104,7 +105,7 @@ module Milkode
104
105
  end
105
106
 
106
107
  # 結果
107
- return result.map{|r| DocumentRecord.new(r)}, result.size
108
+ return result.map{|r| DocumentRecord.new(r)}, total_records
108
109
  end
109
110
 
110
111
  def selectAll(offset, limit)
@@ -116,7 +116,7 @@ EOF
116
116
  url = "/home/" + record_link(record)
117
117
 
118
118
  <<EOS
119
- <dt class='result-record'><a href='#{url + "#n#{coderay.line_number_start}"}'>#{Util::relative_path record.shortpath, @path}</a></dt>
119
+ <dt class='result-record'><a href='#{url + "#n#{coderay.highlight_lines[0]}"}'>#{Util::relative_path record.shortpath, @path}</a></dt>
120
120
  <dd>
121
121
  #{coderay.to_html_anchorlink(url)}
122
122
  </dd>
@@ -169,3 +169,8 @@ label.ui-corner-all {
169
169
  margin-top: 20px;
170
170
  }
171
171
 
172
+ /* lineno-modal */
173
+
174
+ #lineno-copyall {
175
+ font-size: 13px;
176
+ }
@@ -3,6 +3,10 @@
3
3
  // @author ongaeshi
4
4
  // @date 2011/08/24
5
5
 
6
+ function escapeHTML(str) {
7
+ return str.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
8
+ }
9
+
6
10
  function replace_query_param(url, value)
7
11
  {
8
12
  var url_s = url.split("?");
@@ -123,17 +127,52 @@ function update_package(package_name)
123
127
  );
124
128
  }
125
129
 
130
+ function clippy_text(text, bgcolor)
131
+ {
132
+ return ' <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"' +
133
+ ' width="110"' +
134
+ ' height="14"' +
135
+ ' id="clippy" >' +
136
+ ' <param name="movie" value="/flash/clippy.swf"/>' +
137
+ ' <param name="allowScriptAccess" value="always" />' +
138
+ ' <param name="quality" value="high" />' +
139
+ ' <param name="scale" value="noscale" />' +
140
+ ' <param NAME="FlashVars" value="text=' + text + '">' +
141
+ ' <param name="bgcolor" value="#FFFFFF">' +
142
+ ' <embed src="/flash/clippy.swf"' +
143
+ ' width="110"' +
144
+ ' height="14"' +
145
+ ' name="clippy"' +
146
+ ' quality="high"' +
147
+ ' allowScriptAccess="always"' +
148
+ ' type="application/x-shockwave-flash"' +
149
+ ' pluginspage="http://www.macromedia.com/go/getflashplayer"' +
150
+ ' FlashVars="text=' + text + '"' +
151
+ ' bgcolor="' + bgcolor + '"' +
152
+ ' />' +
153
+ ' </object>';
154
+ }
155
+
126
156
  function lineno_setup(path, lineno)
127
157
  {
128
- var n_lineno = "#n" + lineno;
158
+ var n_lineno = "#n" + lineno;
129
159
 
160
+ // scroll reset
130
161
  var h = $('html, body');
131
162
  var prev = h.scrollTop();
132
163
  window.location.hash = n_lineno;
133
164
  h.scrollTop(prev);
134
165
 
166
+ var n_lineno_dom = $(n_lineno);
167
+ var directpath = path + lineno;
168
+
169
+ // select line
135
170
  $(".code > pre > *").removeClass("select-line");
136
- $(n_lineno).addClass("select-line");
137
- $("#lineno-path").text(path + lineno);
138
- $("#lineno-body").html($(n_lineno).html());
171
+ n_lineno_dom.addClass("select-line");
172
+
173
+ // copy text button
174
+ $("#lineno-path").html(directpath + clippy_text(directpath, '#FFFFFF'));
175
+ $("#lineno-body").html(n_lineno_dom.html());
176
+ $("#lineno-copyall").html("Lineno + Text" + clippy_text(directpath + " " + escapeHTML(n_lineno_dom.text()), '#F5F5F5'));
139
177
  }
178
+
@@ -25,14 +25,17 @@ Add package(s) to milkode
25
25
  Samples:
26
26
  milk add /path/to/dir1
27
27
  milk add /path/to/dir2 /path/to/dir3
28
+ milk add /path/to/dir1 -i cache .htaccess # With ignore setting
29
+ milk add /path/to/dir1 --empty # Add empty package
28
30
  milk add /path/is/*
29
31
  milk add /path/to/zipfile.zip
30
32
  milk add /path/to/addon.xpi
31
33
  milk add http://example.com/urlfile.zip
32
34
  milk add git://github.com/ongaeshi/milkode.git
33
35
  EOF
36
+ option :empty, :type => :boolean, :desc => 'Add empty package.'
34
37
  option :ignore, :type => :array, :aliases => '-i', :desc => 'Ignore path.'
35
- option :no_auto_ignore, :type => :boolean, :aliases => '-n', :desc => 'Disable auto ignore (.gitignore).'
38
+ option :no_auto_ignore, :type => :boolean, :aliases => '-n', :desc => 'Disable auto ignore.'
36
39
  option :verbose, :type => :boolean, :aliases => '-v', :desc => 'Be verbose.'
37
40
 
38
41
  def add(*args)
@@ -154,7 +154,7 @@ module Milkode
154
154
  # :suffixs => 拡張子
155
155
  # :offset => オフセット(default = 0)
156
156
  # :limit => 表示リミット(default = -1)
157
- def search(options)
157
+ def search_with_match(options)
158
158
  patterns = options[:patterns] || []
159
159
  keywords = options[:keywords] || []
160
160
  packages = options[:packages] || []
@@ -266,11 +266,18 @@ module Milkode
266
266
  records = result.sort([{:key => "package", :order => "ascending"},
267
267
  {:key => "restpath", :order => "ascending"}],
268
268
  :offset => offset,
269
- :limit => limit)
269
+ :limit => limit)
270
270
 
271
- records
271
+ # 検索結果のレコード(limitの影響を受ける), 総マッチ数(limitの影響を受けない)
272
+ return records, result.size
272
273
  end
273
274
 
275
+ # マッチしたレコードのみを返す
276
+ def search(options)
277
+ records, match_total = search_with_match(options)
278
+ records
279
+ end
280
+
274
281
  def select_all_sort_by_shortpath(offset = 0, limit = -1)
275
282
  result = @table.select
276
283
 
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{milkode}
8
- s.version = "0.9.4"
8
+ s.version = "0.9.5"
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-11-14}
12
+ s.date = %q{2012-12-09}
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"]
@@ -70,6 +70,7 @@ Gem::Specification.new do |s|
70
70
  "lib/milkode/cdweb/public/css/smoothness/images/ui-icons_888888_256x240.png",
71
71
  "lib/milkode/cdweb/public/css/smoothness/images/ui-icons_cd0a0a_256x240.png",
72
72
  "lib/milkode/cdweb/public/css/smoothness/jquery-ui-1.8.22.custom.css",
73
+ "lib/milkode/cdweb/public/flash/clippy.swf",
73
74
  "lib/milkode/cdweb/public/images/MilkodeIcon135.png",
74
75
  "lib/milkode/cdweb/public/images/directory.png",
75
76
  "lib/milkode/cdweb/public/images/document-new-4.png",
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: 51
4
+ hash: 49
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 4
10
- version: 0.9.4
9
+ - 5
10
+ version: 0.9.5
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-11-14 00:00:00 +09:00
18
+ date: 2012-12-09 00:00:00 +09:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -307,6 +307,7 @@ files:
307
307
  - lib/milkode/cdweb/public/css/smoothness/images/ui-icons_888888_256x240.png
308
308
  - lib/milkode/cdweb/public/css/smoothness/images/ui-icons_cd0a0a_256x240.png
309
309
  - lib/milkode/cdweb/public/css/smoothness/jquery-ui-1.8.22.custom.css
310
+ - lib/milkode/cdweb/public/flash/clippy.swf
310
311
  - lib/milkode/cdweb/public/images/MilkodeIcon135.png
311
312
  - lib/milkode/cdweb/public/images/directory.png
312
313
  - lib/milkode/cdweb/public/images/document-new-4.png