milkode 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -3
- data/VERSION +1 -1
- data/lib/milkode/cdstk/cli_cdstksub.rb +1 -0
- data/lib/milkode/cdweb/app.rb +3 -0
- data/lib/milkode/cdweb/cli_cdweb.rb +39 -7
- data/lib/milkode/cdweb/lib/coderay_html2.rb +174 -0
- data/lib/milkode/cdweb/lib/coderay_wrapper.rb +23 -89
- data/lib/milkode/cdweb/lib/command.rb +4 -1
- data/lib/milkode/cdweb/lib/database.rb +14 -8
- data/lib/milkode/cdweb/lib/search_contents.rb +30 -9
- data/lib/milkode/cdweb/lib/web_setting.rb +55 -0
- data/lib/milkode/cdweb/public/css/coderay.css +108 -119
- data/lib/milkode/cdweb/views/header_menu.haml +2 -2
- data/lib/milkode/cdweb/views/help.haml +2 -2
- data/lib/milkode/cdweb/views/index.haml +3 -3
- data/lib/milkode/cdweb/views/search_form.haml +1 -1
- data/milkode.gemspec +23 -15
- data/test/test_coderay_wrapper.rb +0 -3
- metadata +11 -42
- data/lib/milkode/cdweb/lib/my_nokogiri.rb +0 -34
data/Rakefile
CHANGED
@@ -27,13 +27,11 @@ Jeweler::Tasks.new do |gem|
|
|
27
27
|
gem.add_runtime_dependency 'rack','>=1.3.4'
|
28
28
|
gem.add_runtime_dependency 'sinatra', '>=1.2.6'
|
29
29
|
gem.add_runtime_dependency 'launchy', '>=0.3.7'
|
30
|
-
gem.add_runtime_dependency 'coderay', '
|
30
|
+
gem.add_runtime_dependency 'coderay', '>=1.0.5'
|
31
31
|
gem.add_runtime_dependency 'thin', '>=1.2.10'
|
32
32
|
gem.add_runtime_dependency 'archive-zip', '>=0.4.0'
|
33
33
|
gem.add_runtime_dependency 'haml', '>=3.1.2'
|
34
34
|
gem.add_runtime_dependency 'sass', '>=3.1.3'
|
35
|
-
gem.add_runtime_dependency 'nokogiri', '>=1.5.0'
|
36
|
-
gem.add_runtime_dependency 'hpricot', '>=0.8.2'
|
37
35
|
|
38
36
|
# and development dependencies are only needed for development (ie running rake tasks, tests, etc)
|
39
37
|
# gem.add_development_dependency 'rspec', '> 1.2.3'
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.3
|
@@ -120,6 +120,7 @@ EOF
|
|
120
120
|
opts.on('-p', '--port PORT', 'use PORT (default: 9292)') {|v| options[:Port] = v }
|
121
121
|
opts.on("-s", "--server SERVER", "serve using SERVER (default : thin)") {|s| options[:server] = s }
|
122
122
|
opts.on('-n', '--no-browser', 'No launch browser.') {|v| options[:LaunchBrowser] = false }
|
123
|
+
opts.on('--customize', 'Create customize file.') {|v| options[:customize] = true }
|
123
124
|
|
124
125
|
# --hostが'-h'を上書きするので、'-h'を再定義してあげる
|
125
126
|
opts.on_tail("-h", "-?", "--help", "Show this message") do
|
data/lib/milkode/cdweb/app.rb
CHANGED
@@ -14,10 +14,12 @@ $LOAD_PATH.unshift '../..'
|
|
14
14
|
require 'milkode/cdweb/lib/database'
|
15
15
|
require 'milkode/cdweb/lib/command'
|
16
16
|
require 'milkode/cdweb/lib/mkurl'
|
17
|
+
require 'milkode/cdweb/lib/web_setting'
|
17
18
|
|
18
19
|
set :haml, :format => :html5
|
19
20
|
|
20
21
|
get '/' do
|
22
|
+
@setting = WebSetting.new
|
21
23
|
@version = "0.5.0"
|
22
24
|
@package_num = Database.instance.yaml_package_num
|
23
25
|
@file_num = Database.instance.totalRecords
|
@@ -66,6 +68,7 @@ get '/home*' do |path|
|
|
66
68
|
end
|
67
69
|
|
68
70
|
get %r{/help} do
|
71
|
+
@setting = WebSetting.new
|
69
72
|
haml :help
|
70
73
|
end
|
71
74
|
|
@@ -75,6 +75,7 @@ module Milkode
|
|
75
75
|
opts.on('-p', '--port PORT', 'use PORT (default: 9292)') {|v| options[:Port] = v }
|
76
76
|
opts.on("-s", "--server SERVER", "serve using SERVER (default : thin)") {|s| options[:server] = s }
|
77
77
|
opts.on('-n', '--no-browser', 'No launch browser.') {|v| options[:LaunchBrowser] = false }
|
78
|
+
opts.on('--customize', 'Create customize file.') {|v| options[:customize] = true }
|
78
79
|
|
79
80
|
# --hostが'-h'を上書きするので、'-h'を再定義してあげる
|
80
81
|
opts.on_tail("-h", "-?", "--help", "Show this message") do
|
@@ -89,16 +90,21 @@ module Milkode
|
|
89
90
|
end
|
90
91
|
|
91
92
|
def self.execute_with_options(stdout, options)
|
92
|
-
|
93
|
-
|
93
|
+
dbdir = File.expand_path(options[:DbDir])
|
94
|
+
|
95
|
+
unless options[:customize]
|
96
|
+
# 使用するデータベースの位置設定
|
97
|
+
Database.setup(dbdir)
|
94
98
|
|
95
|
-
|
96
|
-
|
99
|
+
# サーバースクリプトのある場所へ移動
|
100
|
+
FileUtils.cd(File.dirname(__FILE__))
|
97
101
|
|
98
|
-
|
99
|
-
|
102
|
+
# Rackサーバー起動
|
103
|
+
Rack::Server.start(options)
|
104
|
+
else
|
105
|
+
create_customize_file(dbdir)
|
106
|
+
end
|
100
107
|
end
|
101
|
-
|
102
108
|
|
103
109
|
def self.select_dbdir
|
104
110
|
if (Dbdir.dbdir?('.') || !Dbdir.dbdir?(Dbdir.default_dir))
|
@@ -107,5 +113,31 @@ module Milkode
|
|
107
113
|
Dbdir.default_dir
|
108
114
|
end
|
109
115
|
end
|
116
|
+
|
117
|
+
def self.create_customize_file(dbdir)
|
118
|
+
fname = File.join(dbdir, "milkweb.yaml")
|
119
|
+
|
120
|
+
if File.exist? fname
|
121
|
+
puts "Already exist '#{fname}'"
|
122
|
+
else
|
123
|
+
puts <<EOF
|
124
|
+
Create '#{fname}'.
|
125
|
+
Please customize yaml parameter.
|
126
|
+
EOF
|
127
|
+
|
128
|
+
File.open(fname, "w") do |f|
|
129
|
+
f.write <<EOF
|
130
|
+
---
|
131
|
+
:home_title : "Milkode"
|
132
|
+
:home_icon : "/images/MilkodeIcon135.png"
|
133
|
+
|
134
|
+
:header_title: "Milkode"
|
135
|
+
:header_icon : "/images/MilkodeIcon135.png"
|
136
|
+
|
137
|
+
:display_about_milkode: true
|
138
|
+
EOF
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
110
142
|
end
|
111
143
|
end
|
@@ -0,0 +1,174 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# @file
|
4
|
+
# @brief
|
5
|
+
# @author ongaeshi
|
6
|
+
# @date 2012/03/18
|
7
|
+
|
8
|
+
module CodeRay
|
9
|
+
module Encoders
|
10
|
+
class HTML2 < HTML
|
11
|
+
register_for :html2
|
12
|
+
|
13
|
+
def text_token text, kind
|
14
|
+
# p "#{kind}: #{text}"
|
15
|
+
super
|
16
|
+
end
|
17
|
+
|
18
|
+
# [ref] CodeRay::Encoders::HTML#finish (coderay-1.0.5/lib/coderay/encoders/html.rb:219)
|
19
|
+
def finish options
|
20
|
+
@out = ornament_line_attr(options)
|
21
|
+
|
22
|
+
unless @opened.empty?
|
23
|
+
warn '%d tokens still open: %p' % [@opened.size, @opened] if $CODERAY_DEBUG
|
24
|
+
@out << '</span>' while @opened.pop
|
25
|
+
@last_opened = nil
|
26
|
+
end
|
27
|
+
|
28
|
+
@out.extend Output
|
29
|
+
@out.css = @css
|
30
|
+
if options[:line_numbers]
|
31
|
+
# Numbering.number! @out, options[:line_numbers], options
|
32
|
+
HTML2::number! @out, options[:line_numbers], options
|
33
|
+
end
|
34
|
+
@out.wrap! options[:wrap]
|
35
|
+
@out.apply_title! options[:title]
|
36
|
+
|
37
|
+
if defined?(@real_out) && @real_out
|
38
|
+
@real_out << @out
|
39
|
+
@out = @real_out
|
40
|
+
end
|
41
|
+
|
42
|
+
@out
|
43
|
+
end
|
44
|
+
|
45
|
+
def ornament_line_attr(options)
|
46
|
+
# p options
|
47
|
+
line_number = options[:line_number_start]
|
48
|
+
|
49
|
+
lines = @out.split("\n")
|
50
|
+
|
51
|
+
lines.map{|l|
|
52
|
+
line_number += 1
|
53
|
+
"<span #{line_attr(line_number - 1, options[:highlight_lines])}>#{l}</span>"
|
54
|
+
}.join("\n") + "\n"
|
55
|
+
end
|
56
|
+
|
57
|
+
def line_attr(no, highlight_lines)
|
58
|
+
r = []
|
59
|
+
r << "id=\"n#{no}\""
|
60
|
+
r << "class=\"highlight-line\"" if highlight_lines.include?(no)
|
61
|
+
r.join(" ")
|
62
|
+
end
|
63
|
+
|
64
|
+
# [ref] CodeRay::Encoders::Numberling#number! (coderay-1.0.5/lib/coderay/encoders/numbering.rb:8)
|
65
|
+
def self.number! output, mode = :table, options = {}
|
66
|
+
return self unless mode
|
67
|
+
|
68
|
+
options = DEFAULT_OPTIONS.merge options
|
69
|
+
|
70
|
+
start = options[:line_number_start]
|
71
|
+
unless start.is_a? Integer
|
72
|
+
raise ArgumentError, "Invalid value %p for :line_number_start; Integer expected." % start
|
73
|
+
end
|
74
|
+
|
75
|
+
anchor_prefix = options[:line_number_anchors]
|
76
|
+
anchor_prefix = 'line' if anchor_prefix == true
|
77
|
+
anchor_prefix = anchor_prefix.to_s[/\w+/] if anchor_prefix
|
78
|
+
|
79
|
+
anchor_url = options[:line_number_anchor_url] || ""
|
80
|
+
|
81
|
+
anchoring =
|
82
|
+
if anchor_prefix
|
83
|
+
proc do |line|
|
84
|
+
line = line.to_s
|
85
|
+
anchor = anchor_prefix + line
|
86
|
+
"<a href=\"#{anchor_url}##{anchor}\" name=\"#{anchor}\">#{line}</a>"
|
87
|
+
end
|
88
|
+
else
|
89
|
+
proc { |line| line.to_s } # :to_s.to_proc in Ruby 1.8.7+
|
90
|
+
end
|
91
|
+
|
92
|
+
bold_every = options[:bold_every]
|
93
|
+
highlight_lines = options[:highlight_lines]
|
94
|
+
bolding =
|
95
|
+
if bold_every == false && highlight_lines == nil
|
96
|
+
anchoring
|
97
|
+
elsif highlight_lines.is_a? Enumerable
|
98
|
+
highlight_lines = highlight_lines.to_set
|
99
|
+
proc do |line|
|
100
|
+
if highlight_lines.include? line
|
101
|
+
"<strong class=\"highlighted\">#{anchoring[line]}</strong>" # highlighted line numbers in bold
|
102
|
+
else
|
103
|
+
anchoring[line]
|
104
|
+
end
|
105
|
+
end
|
106
|
+
elsif bold_every.is_a? Integer
|
107
|
+
raise ArgumentError, ":bolding can't be 0." if bold_every == 0
|
108
|
+
proc do |line|
|
109
|
+
if line % bold_every == 0
|
110
|
+
"<strong>#{anchoring[line]}</strong>" # every bold_every-th number in bold
|
111
|
+
else
|
112
|
+
anchoring[line]
|
113
|
+
end
|
114
|
+
end
|
115
|
+
else
|
116
|
+
raise ArgumentError, 'Invalid value %p for :bolding; false or Integer expected.' % bold_every
|
117
|
+
end
|
118
|
+
|
119
|
+
line_count = output.count("\n")
|
120
|
+
position_of_last_newline = output.rindex(RUBY_VERSION >= '1.9' ? /\n/ : ?\n)
|
121
|
+
if position_of_last_newline
|
122
|
+
after_last_newline = output[position_of_last_newline + 1 .. -1]
|
123
|
+
ends_with_newline = after_last_newline[/\A(?:<\/span>)*\z/]
|
124
|
+
line_count += 1 if not ends_with_newline
|
125
|
+
end
|
126
|
+
|
127
|
+
case mode
|
128
|
+
when :inline
|
129
|
+
max_width = (start + line_count).to_s.size
|
130
|
+
line_number = start
|
131
|
+
nesting = []
|
132
|
+
output.gsub!(/^.*$\n?/) do |line|
|
133
|
+
line.chomp!
|
134
|
+
open = nesting.join
|
135
|
+
line.scan(%r!<(/)?span[^>]*>?!) do |close,|
|
136
|
+
if close
|
137
|
+
nesting.pop
|
138
|
+
else
|
139
|
+
nesting << $&
|
140
|
+
end
|
141
|
+
end
|
142
|
+
close = '</span>' * nesting.size
|
143
|
+
|
144
|
+
line_number_text = bolding.call line_number
|
145
|
+
indent = ' ' * (max_width - line_number.to_s.size) # TODO: Optimize (10^x)
|
146
|
+
line_number += 1
|
147
|
+
"<span class=\"line-numbers\">#{indent}#{line_number_text}</span>#{open}#{line}#{close}\n"
|
148
|
+
end
|
149
|
+
|
150
|
+
when :table
|
151
|
+
line_numbers = (start ... start + line_count).map(&bolding).join("\n")
|
152
|
+
line_numbers << "\n"
|
153
|
+
line_numbers_table_template = Output::TABLE.apply('LINE_NUMBERS', line_numbers)
|
154
|
+
|
155
|
+
output.gsub!(/<\/div>\n/, '</div>')
|
156
|
+
output.wrap_in! line_numbers_table_template
|
157
|
+
output.wrapped_in = :div
|
158
|
+
|
159
|
+
when :list
|
160
|
+
raise NotImplementedError, 'The :list option is no longer available. Use :table.'
|
161
|
+
|
162
|
+
else
|
163
|
+
raise ArgumentError, 'Unknown value %p for mode: expected one of %p' %
|
164
|
+
[mode, [:table, :inline]]
|
165
|
+
end
|
166
|
+
|
167
|
+
output
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
|
174
|
+
|
@@ -9,7 +9,7 @@ require 'rubygems'
|
|
9
9
|
require 'coderay'
|
10
10
|
require 'coderay/helpers/file_type'
|
11
11
|
require 'milkode/common/util'
|
12
|
-
require 'milkode/cdweb/lib/
|
12
|
+
require 'milkode/cdweb/lib/coderay_html2'
|
13
13
|
|
14
14
|
module Milkode
|
15
15
|
class CodeRayWrapper
|
@@ -48,105 +48,39 @@ module Milkode
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def to_html
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
if (is_ornament?)
|
61
|
-
html_doc = MyNokogiri::HTML(html)
|
62
|
-
add_spanid(html_doc)
|
63
|
-
else
|
64
|
-
html
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
def to_html_anchor
|
69
|
-
html = CodeRay.scan(@content, file_type).
|
70
|
-
html(
|
71
|
-
:wrap => nil,
|
72
|
-
:line_numbers => :table,
|
73
|
-
:css => :class,
|
74
|
-
:highlight_lines => @highlight_lines,
|
75
|
-
:line_number_start => @line_number_start
|
76
|
-
)
|
77
|
-
|
78
|
-
if (is_ornament?)
|
79
|
-
html_doc = MyNokogiri::HTML(html)
|
80
|
-
anchor = create_anchorlink(html_doc.at_css("table.CodeRay td.code pre").inner_html)
|
81
|
-
body = add_spanid(html_doc)
|
82
|
-
anchor + body
|
83
|
-
else
|
84
|
-
html
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
def add_spanid(html_doc)
|
89
|
-
# preに<span id="行番号"> を付ける
|
90
|
-
table = html_doc.at_css("table.CodeRay")
|
91
|
-
pre = table.at_css("td.code pre")
|
92
|
-
pre.inner_html = add_spanid_in(pre.inner_html)
|
93
|
-
|
94
|
-
# 結果を文字列で返す
|
95
|
-
table.to_html
|
51
|
+
CodeRay.scan(@content, file_type).
|
52
|
+
html2(
|
53
|
+
:wrap => nil,
|
54
|
+
:line_numbers => :table,
|
55
|
+
:css => :class,
|
56
|
+
:highlight_lines => @highlight_lines,
|
57
|
+
:line_number_start => @line_number_start,
|
58
|
+
:line_number_anchors => false
|
59
|
+
)
|
96
60
|
end
|
97
61
|
|
98
|
-
def
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
62
|
+
def to_html_anchorlink(url)
|
63
|
+
CodeRay.scan(@content, file_type).
|
64
|
+
html2(
|
65
|
+
:wrap => nil,
|
66
|
+
:line_numbers => :table,
|
67
|
+
:css => :class,
|
68
|
+
:highlight_lines => @highlight_lines,
|
69
|
+
:line_number_start => @line_number_start,
|
70
|
+
:line_number_anchors => 'n',
|
71
|
+
:line_number_anchor_url => url
|
72
|
+
)
|
106
73
|
end
|
107
74
|
|
108
75
|
def file_type
|
109
76
|
case File.extname(@filename)
|
110
77
|
when ".el"
|
111
|
-
:scheme
|
112
|
-
else
|
78
|
+
# :scheme
|
113
79
|
CodeRay::FileType.fetch @filename, :plaintext
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
def line_attr(no)
|
118
|
-
r = []
|
119
|
-
r << "id=\"#{no}\""
|
120
|
-
r << "class=\"highlight-line\"" if @highlight_lines.include?(no)
|
121
|
-
r.join(" ")
|
122
|
-
end
|
123
|
-
|
124
|
-
ANCHOR_OFFSET = 3
|
125
|
-
|
126
|
-
def create_anchorlink(str)
|
127
|
-
if @highlight_lines
|
128
|
-
lines = str.split("\n")
|
129
|
-
|
130
|
-
codes = @highlight_lines.map {|no|
|
131
|
-
" <tr><td class=\"line_numbers\">#{no}</td> <td class=\"code\"><pre><a href=\"##{[no - ANCHOR_OFFSET, 1].max}\">#{lines[no - 1]}</a></pre></td> </tr>"
|
132
|
-
}.join("\n")
|
133
|
-
|
134
|
-
<<EOF
|
135
|
-
<span class="match-num">#{@highlight_lines.size} results</span>
|
136
|
-
<table class="CodeRay anchor-table">
|
137
|
-
#{codes}
|
138
|
-
</table>
|
139
|
-
<p>
|
140
|
-
EOF
|
141
80
|
else
|
142
|
-
|
81
|
+
CodeRay::FileType.fetch @filename, :plaintext
|
143
82
|
end
|
144
83
|
end
|
145
|
-
|
146
|
-
def is_ornament?
|
147
|
-
Util::larger_than_oneline(@content)
|
148
|
-
end
|
149
|
-
|
150
84
|
end
|
151
85
|
end
|
152
86
|
|
@@ -14,6 +14,7 @@ require 'milkode/common/util'
|
|
14
14
|
|
15
15
|
module Milkode
|
16
16
|
def view(record, params, before)
|
17
|
+
@setting = WebSetting.new
|
17
18
|
@title = record.shortpath
|
18
19
|
@path = record.shortpath
|
19
20
|
|
@@ -22,7 +23,7 @@ module Milkode
|
|
22
23
|
if (Util::larger_than_oneline(record.content) and q and !q.keywords.empty?)
|
23
24
|
grep = Grep.new(record.content)
|
24
25
|
match_lines = grep.match_lines_and(q.keywords)
|
25
|
-
@record_content = CodeRayWrapper.new(record.content, record.shortpath, match_lines).
|
26
|
+
@record_content = CodeRayWrapper.new(record.content, record.shortpath, match_lines).to_html
|
26
27
|
else
|
27
28
|
@record_content = CodeRayWrapper.new(record.content, record.shortpath).to_html
|
28
29
|
end
|
@@ -32,6 +33,7 @@ module Milkode
|
|
32
33
|
end
|
33
34
|
|
34
35
|
def search(path, params, before)
|
36
|
+
@setting = WebSetting.new
|
35
37
|
@path = path
|
36
38
|
query = Query.new(params[:query])
|
37
39
|
@title = "'#{query.query_string}' in #{path_title(path)}"
|
@@ -51,6 +53,7 @@ module Milkode
|
|
51
53
|
end
|
52
54
|
|
53
55
|
def filelist(path, params, before)
|
56
|
+
@setting = WebSetting.new
|
54
57
|
@title = filelist_title(path)
|
55
58
|
@path = path
|
56
59
|
fileList = Database.instance.fileList(path)
|
@@ -23,16 +23,18 @@ module Milkode
|
|
23
23
|
@@db_dir = db_dir
|
24
24
|
end
|
25
25
|
|
26
|
+
def self.dbdir
|
27
|
+
@@db_dir || Dbdir.default_dir
|
28
|
+
end
|
29
|
+
|
26
30
|
attr_reader :yaml
|
27
31
|
|
28
32
|
def initialize
|
29
|
-
|
30
|
-
open(db_dir)
|
31
|
-
@yaml = YamlFileWrapper.load_if(db_dir)
|
33
|
+
open(Database.dbdir)
|
32
34
|
end
|
33
35
|
|
34
36
|
def yaml_reload
|
35
|
-
@yaml = YamlFileWrapper.load_if(@@db_dir || Dbdir.default_dir)
|
37
|
+
# @yaml = YamlFileWrapper.load_if(@@db_dir || Dbdir.default_dir)
|
36
38
|
end
|
37
39
|
|
38
40
|
def open(db_dir)
|
@@ -106,7 +108,7 @@ module Milkode
|
|
106
108
|
|
107
109
|
# yamlからパッケージの総数を得る
|
108
110
|
def yaml_package_num
|
109
|
-
|
111
|
+
yaml_load.contents.size
|
110
112
|
end
|
111
113
|
|
112
114
|
# @sample test/test_database.rb:43 TestDatabase#t_fileList
|
@@ -116,7 +118,7 @@ module Milkode
|
|
116
118
|
|
117
119
|
# 'depth==0'の時はMilkodeYaml#contentsからファイルリストを生成して高速化
|
118
120
|
if (base_depth == 0)
|
119
|
-
return
|
121
|
+
return yaml_load.contents.sort_by{|v| v.name}.map{|v| [v.name, false] }
|
120
122
|
end
|
121
123
|
|
122
124
|
# shortpathにマッチするものだけに絞り込む
|
@@ -180,7 +182,7 @@ module Milkode
|
|
180
182
|
def reopen_patch
|
181
183
|
# 削除系のコマンドが上手く動作しないためのパッチ
|
182
184
|
# 本質的な解決にはなっていないと思う
|
183
|
-
open(
|
185
|
+
open(Database.dbdir)
|
184
186
|
end
|
185
187
|
|
186
188
|
def searchMain(patterns, packages, fpaths, suffixs, offset, limit)
|
@@ -288,7 +290,11 @@ module Milkode
|
|
288
290
|
end
|
289
291
|
|
290
292
|
def expand_packages(keyword)
|
291
|
-
|
293
|
+
yaml_load.match_all(keyword).map{|p| p.directory}
|
294
|
+
end
|
295
|
+
|
296
|
+
def yaml_load
|
297
|
+
YamlFileWrapper.load_if(Database.dbdir)
|
292
298
|
end
|
293
299
|
|
294
300
|
# --- error ---
|
@@ -51,7 +51,26 @@ module Milkode
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def html_contents
|
54
|
-
@match_records.
|
54
|
+
match_groups = @match_records.reduce([]) do |g, m|
|
55
|
+
if (g.empty?)
|
56
|
+
g << [m]
|
57
|
+
else
|
58
|
+
prev = g[-1][-1]
|
59
|
+
|
60
|
+
if (m.match_line.index - prev.match_line.index <= NTH * 2 &&
|
61
|
+
m.record.shortpath == prev.record.shortpath)
|
62
|
+
g[-1] << m # グループの末尾に追加
|
63
|
+
g
|
64
|
+
else
|
65
|
+
g << [m] # 新規グループ
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# 近接マッチ無効
|
70
|
+
# g << [m]
|
71
|
+
end
|
72
|
+
|
73
|
+
match_groups.map{|g|result_match_record(g)}.join
|
55
74
|
end
|
56
75
|
|
57
76
|
def html_pagination
|
@@ -129,21 +148,23 @@ EOF
|
|
129
148
|
return false
|
130
149
|
end
|
131
150
|
|
132
|
-
def result_match_record(
|
133
|
-
record =
|
134
|
-
match_line = match_record.match_line
|
151
|
+
def result_match_record(match_group)
|
152
|
+
record = match_group[0].record
|
135
153
|
|
136
|
-
first_index = match_line.index - NTH
|
137
|
-
last_index
|
154
|
+
first_index = match_group[0].match_line.index - NTH
|
155
|
+
last_index = match_group[-1].match_line.index + NTH
|
156
|
+
match_lines = match_group.map{|m| m.match_line}
|
138
157
|
|
139
|
-
coderay = CodeRayWrapper.new(record.content, record.shortpath,
|
158
|
+
coderay = CodeRayWrapper.new(record.content, record.shortpath, match_lines)
|
140
159
|
coderay.col_limit(COL_LIMIT)
|
141
160
|
coderay.set_range(first_index..last_index)
|
142
161
|
|
162
|
+
url = "/home/" + record_link(record)
|
163
|
+
|
143
164
|
<<EOS
|
144
|
-
<dt class='result-record'><a href='#{
|
165
|
+
<dt class='result-record'><a href='#{url + "#n#{coderay.line_number_start}"}'>#{Util::relative_path record.shortpath, @path}</a></dt>
|
145
166
|
<dd>
|
146
|
-
#{coderay.
|
167
|
+
#{coderay.to_html_anchorlink(url)}
|
147
168
|
</dd>
|
148
169
|
EOS
|
149
170
|
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# @file
|
4
|
+
# @brief
|
5
|
+
# @author ongaeshi
|
6
|
+
# @date 2012/03/24
|
7
|
+
|
8
|
+
require 'milkode/cdweb/lib/database'
|
9
|
+
require 'yaml'
|
10
|
+
|
11
|
+
module Milkode
|
12
|
+
class WebSetting
|
13
|
+
DEFAULT_SETTING = {
|
14
|
+
:home_title => "Milkode",
|
15
|
+
:home_icon => "/images/MilkodeIcon135.png",
|
16
|
+
|
17
|
+
:header_title => "Milkode",
|
18
|
+
:header_icon => "/images/MilkodeIcon135.png",
|
19
|
+
|
20
|
+
:display_about_milkode => true
|
21
|
+
}
|
22
|
+
|
23
|
+
def self.hash_method(name)
|
24
|
+
define_method(name) do
|
25
|
+
@data[name]
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def initialize
|
30
|
+
fname = File.join(Database.dbdir, "milkweb.yaml")
|
31
|
+
if FileTest.exist? fname
|
32
|
+
open(fname) do |f|
|
33
|
+
@data = YAML.load(f.read)
|
34
|
+
end
|
35
|
+
else
|
36
|
+
@data = DEFAULT_SETTING
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
hash_method :home_title
|
41
|
+
hash_method :home_icon
|
42
|
+
|
43
|
+
hash_method :header_title
|
44
|
+
hash_method :header_icon
|
45
|
+
|
46
|
+
def about_milkode
|
47
|
+
if (@data[:display_about_milkode])
|
48
|
+
', <a href="http://milkode.ongaeshi.me">milkodeについて</a>'
|
49
|
+
else
|
50
|
+
''
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
@@ -1,131 +1,120 @@
|
|
1
1
|
.CodeRay {
|
2
|
-
background-color:
|
2
|
+
background-color: hsl(0,0%,95%);
|
3
3
|
border: 1px solid silver;
|
4
|
-
|
5
|
-
|
4
|
+
color: black;
|
5
|
+
}
|
6
|
+
.CodeRay pre {
|
7
|
+
margin: 0px;
|
6
8
|
}
|
7
|
-
.CodeRay pre { margin: 0px }
|
8
|
-
|
9
|
-
div.CodeRay { }
|
10
9
|
|
11
|
-
span.CodeRay { white-space: pre; border: 0px; padding: 2px }
|
10
|
+
span.CodeRay { white-space: pre; border: 0px; padding: 2px; }
|
12
11
|
|
13
|
-
table.CodeRay { border-collapse: collapse; width: 100%; padding: 2px }
|
14
|
-
table.CodeRay td { padding: 2px 4px; vertical-align: top }
|
12
|
+
table.CodeRay { border-collapse: collapse; width: 100%; padding: 2px; }
|
13
|
+
table.CodeRay td { padding: 2px 4px; vertical-align: top; }
|
15
14
|
|
16
|
-
.CodeRay .
|
17
|
-
background-color:
|
15
|
+
.CodeRay .line-numbers {
|
16
|
+
background-color: hsl(180,65%,90%);
|
18
17
|
color: gray;
|
19
18
|
text-align: right;
|
19
|
+
-webkit-user-select: none;
|
20
|
+
-moz-user-select: none;
|
21
|
+
user-select: none;
|
22
|
+
}
|
23
|
+
.CodeRay .line-numbers a {
|
24
|
+
background-color: hsl(180,65%,90%) !important;
|
25
|
+
color: gray !important;
|
26
|
+
text-decoration: none !important;
|
20
27
|
}
|
21
|
-
.CodeRay .
|
22
|
-
.CodeRay .
|
28
|
+
.CodeRay .line-numbers a:target { color: blue !important; }
|
29
|
+
.CodeRay .line-numbers .highlighted { color: red !important; }
|
30
|
+
.CodeRay .line-numbers .highlighted a { color: red !important; }
|
31
|
+
.CodeRay span.line-numbers { padding: 0px 4px; }
|
23
32
|
.CodeRay .line { display: block; float: left; width: 100%; }
|
24
|
-
.CodeRay .
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
.CodeRay .
|
31
|
-
|
32
|
-
.CodeRay .
|
33
|
-
|
34
|
-
.CodeRay .
|
35
|
-
.CodeRay .
|
36
|
-
.CodeRay .
|
37
|
-
.CodeRay .
|
38
|
-
.CodeRay .
|
39
|
-
.CodeRay .
|
40
|
-
.CodeRay .
|
41
|
-
|
42
|
-
.CodeRay .
|
43
|
-
.CodeRay .
|
44
|
-
.CodeRay .
|
45
|
-
|
46
|
-
.CodeRay .
|
47
|
-
.CodeRay .
|
48
|
-
.CodeRay .
|
49
|
-
.CodeRay .
|
50
|
-
.CodeRay .
|
51
|
-
.CodeRay .
|
52
|
-
.CodeRay .
|
53
|
-
.CodeRay .
|
54
|
-
.CodeRay .
|
55
|
-
.CodeRay .
|
56
|
-
.CodeRay .
|
57
|
-
.CodeRay .
|
58
|
-
.CodeRay .
|
59
|
-
.CodeRay .
|
60
|
-
.CodeRay .
|
61
|
-
.CodeRay .
|
62
|
-
.CodeRay .
|
63
|
-
.CodeRay .
|
64
|
-
.CodeRay .
|
65
|
-
.CodeRay .
|
66
|
-
.CodeRay .
|
67
|
-
.CodeRay .
|
68
|
-
|
69
|
-
.CodeRay .
|
70
|
-
.CodeRay .
|
71
|
-
.CodeRay .
|
72
|
-
.CodeRay .
|
73
|
-
.CodeRay .
|
74
|
-
|
75
|
-
.CodeRay .
|
76
|
-
.CodeRay .
|
77
|
-
.CodeRay .
|
78
|
-
.CodeRay .
|
79
|
-
.CodeRay .
|
80
|
-
.CodeRay .
|
81
|
-
.CodeRay .
|
82
|
-
.CodeRay .
|
83
|
-
.CodeRay .
|
84
|
-
.CodeRay .
|
85
|
-
.CodeRay .
|
86
|
-
.CodeRay .
|
87
|
-
.CodeRay .
|
88
|
-
.CodeRay .
|
89
|
-
|
90
|
-
.CodeRay .
|
91
|
-
.CodeRay .
|
92
|
-
.CodeRay .
|
93
|
-
.CodeRay .
|
94
|
-
|
95
|
-
.CodeRay .
|
96
|
-
.CodeRay .
|
97
|
-
.CodeRay .
|
98
|
-
|
99
|
-
.CodeRay .
|
100
|
-
|
101
|
-
.CodeRay .
|
102
|
-
.CodeRay .s .s { background-color:#ffe0e0 }
|
103
|
-
.CodeRay .s .s .s { background-color:#ffd0d0 }
|
104
|
-
.CodeRay .s .k { }
|
105
|
-
.CodeRay .s .ch { color: #b0b; }
|
106
|
-
.CodeRay .s .dl { color: #710; }
|
107
|
-
|
108
|
-
.CodeRay .sh { background-color:#f0fff0; color:#2B2 }
|
109
|
-
.CodeRay .sh .k { }
|
110
|
-
.CodeRay .sh .dl { color:#161 }
|
111
|
-
|
112
|
-
.CodeRay .sy { color:#A60 }
|
113
|
-
.CodeRay .sy .k { color:#A60 }
|
114
|
-
.CodeRay .sy .dl { color:#630 }
|
115
|
-
|
116
|
-
.CodeRay .ta { color:#070 }
|
117
|
-
.CodeRay .tf { color:#070; font-weight:bold }
|
118
|
-
.CodeRay .ts { color:#D70; font-weight:bold }
|
119
|
-
.CodeRay .ty { color:#339; font-weight:bold }
|
120
|
-
.CodeRay .v { color:#036 }
|
121
|
-
.CodeRay .xt { color:#444 }
|
122
|
-
|
123
|
-
.CodeRay .ins { background: #afa; }
|
124
|
-
.CodeRay .del { background: #faa; }
|
125
|
-
.CodeRay .chg { color: #aaf; background: #007; }
|
33
|
+
.CodeRay .code { width: 100%; }
|
34
|
+
|
35
|
+
.CodeRay .debug { color: white !important; background: blue !important; }
|
36
|
+
|
37
|
+
.CodeRay .annotation { color:#007 }
|
38
|
+
.CodeRay .attribute-name { color:#b48 }
|
39
|
+
.CodeRay .attribute-value { color:#700 }
|
40
|
+
.CodeRay .binary { color:#509 }
|
41
|
+
.CodeRay .char .content { color:#D20 }
|
42
|
+
.CodeRay .char .delimiter { color:#710 }
|
43
|
+
.CodeRay .char { color:#D20 }
|
44
|
+
.CodeRay .class { color:#B06; font-weight:bold }
|
45
|
+
.CodeRay .class-variable { color:#369 }
|
46
|
+
.CodeRay .color { color:#0A0 }
|
47
|
+
.CodeRay .comment { color:#777 }
|
48
|
+
.CodeRay .comment .char { color:#444 }
|
49
|
+
.CodeRay .comment .delimiter { color:#444 }
|
50
|
+
.CodeRay .complex { color:#A08 }
|
51
|
+
.CodeRay .constant { color:#036; font-weight:bold }
|
52
|
+
.CodeRay .decorator { color:#B0B }
|
53
|
+
.CodeRay .definition { color:#099; font-weight:bold }
|
54
|
+
.CodeRay .delimiter { color:black }
|
55
|
+
.CodeRay .directive { color:#088; font-weight:bold }
|
56
|
+
.CodeRay .doc { color:#970 }
|
57
|
+
.CodeRay .doc-string { color:#D42; font-weight:bold }
|
58
|
+
.CodeRay .doctype { color:#34b }
|
59
|
+
.CodeRay .entity { color:#800; font-weight:bold }
|
60
|
+
.CodeRay .error { color:#F00; background-color:#FAA }
|
61
|
+
.CodeRay .escape { color:#666 }
|
62
|
+
.CodeRay .exception { color:#C00; font-weight:bold }
|
63
|
+
.CodeRay .float { color:#60E }
|
64
|
+
.CodeRay .function { color:#06B; font-weight:bold }
|
65
|
+
.CodeRay .global-variable { color:#d70 }
|
66
|
+
.CodeRay .hex { color:#02b }
|
67
|
+
.CodeRay .imaginary { color:#f00 }
|
68
|
+
.CodeRay .include { color:#B44; font-weight:bold }
|
69
|
+
.CodeRay .inline { background-color: hsla(0,0%,0%,0.07); color: black }
|
70
|
+
.CodeRay .inline-delimiter { font-weight: bold; color: #666 }
|
71
|
+
.CodeRay .instance-variable { color:#33B }
|
72
|
+
.CodeRay .integer { color:#00D }
|
73
|
+
.CodeRay .key .char { color: #60f }
|
74
|
+
.CodeRay .key .delimiter { color: #404 }
|
75
|
+
.CodeRay .key { color: #606 }
|
76
|
+
.CodeRay .keyword { color:#080; font-weight:bold }
|
77
|
+
.CodeRay .label { color:#970; font-weight:bold }
|
78
|
+
.CodeRay .local-variable { color:#963 }
|
79
|
+
.CodeRay .namespace { color:#707; font-weight:bold }
|
80
|
+
.CodeRay .octal { color:#40E }
|
81
|
+
.CodeRay .operator { }
|
82
|
+
.CodeRay .predefined { color:#369; font-weight:bold }
|
83
|
+
.CodeRay .predefined-constant { color:#069 }
|
84
|
+
.CodeRay .predefined-type { color:#0a5; font-weight:bold }
|
85
|
+
.CodeRay .preprocessor { color:#579 }
|
86
|
+
.CodeRay .pseudo-class { color:#00C; font-weight:bold }
|
87
|
+
.CodeRay .regexp .content { color:#808 }
|
88
|
+
.CodeRay .regexp .delimiter { color:#404 }
|
89
|
+
.CodeRay .regexp .modifier { color:#C2C }
|
90
|
+
.CodeRay .regexp { background-color:hsla(300,100%,50%,0.06); }
|
91
|
+
.CodeRay .reserved { color:#080; font-weight:bold }
|
92
|
+
.CodeRay .shell .content { color:#2B2 }
|
93
|
+
.CodeRay .shell .delimiter { color:#161 }
|
94
|
+
.CodeRay .shell { background-color:hsla(120,100%,50%,0.06); }
|
95
|
+
.CodeRay .string .char { color: #b0b }
|
96
|
+
.CodeRay .string .content { color: #D20 }
|
97
|
+
.CodeRay .string .delimiter { color: #710 }
|
98
|
+
.CodeRay .string .modifier { color: #E40 }
|
99
|
+
.CodeRay .string { background-color:hsla(0,100%,50%,0.05); }
|
100
|
+
.CodeRay .symbol .content { color:#A60 }
|
101
|
+
.CodeRay .symbol .delimiter { color:#630 }
|
102
|
+
.CodeRay .symbol { color:#A60 }
|
103
|
+
.CodeRay .tag { color:#070 }
|
104
|
+
.CodeRay .type { color:#339; font-weight:bold }
|
105
|
+
.CodeRay .value { color: #088; }
|
106
|
+
.CodeRay .variable { color:#037 }
|
107
|
+
|
108
|
+
.CodeRay .insert { background: hsla(120,100%,50%,0.12) }
|
109
|
+
.CodeRay .delete { background: hsla(0,100%,50%,0.12) }
|
110
|
+
.CodeRay .change { color: #bbf; background: #007; }
|
126
111
|
.CodeRay .head { color: #f8f; background: #505 }
|
112
|
+
.CodeRay .head .filename { color: white; }
|
113
|
+
|
114
|
+
.CodeRay .delete .eyecatcher { background-color: hsla(0,100%,50%,0.2); border: 1px solid hsla(0,100%,45%,0.5); margin: -1px; border-bottom: none; border-top-left-radius: 5px; border-top-right-radius: 5px; }
|
115
|
+
.CodeRay .insert .eyecatcher { background-color: hsla(120,100%,50%,0.2); border: 1px solid hsla(120,100%,25%,0.5); margin: -1px; border-top: none; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; }
|
127
116
|
|
128
|
-
.CodeRay .
|
129
|
-
.CodeRay .
|
130
|
-
.CodeRay .
|
131
|
-
.CodeRay .head .head { color: #f4f
|
117
|
+
.CodeRay .insert .insert { color: #0c0; background:transparent; font-weight:bold }
|
118
|
+
.CodeRay .delete .delete { color: #c00; background:transparent; font-weight:bold }
|
119
|
+
.CodeRay .change .change { color: #88f }
|
120
|
+
.CodeRay .head .head { color: #f4f }
|
@@ -1,5 +1,5 @@
|
|
1
1
|
.header
|
2
2
|
%h1
|
3
|
-
<a href="/"><img src
|
4
|
-
|
3
|
+
<a href="/"><img src=#{@setting.header_icon} alt="milkode-icon-mini" border="0" height="75px"/></a>
|
4
|
+
#{@setting.header_title}
|
5
5
|
= create_headmenu(@path, params, defined?(flistpath) ? flistpath : '')
|
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
.header
|
4
4
|
%h1
|
5
|
-
<a href="/"><img src
|
6
|
-
#{@title} -
|
5
|
+
<a href="/"><img src=#{@setting.header_icon} alt="milkode-icon-mini" border="0" height="75px"/></a>
|
6
|
+
#{@title} - #{@setting.header_title}
|
7
7
|
|
8
8
|
.content
|
9
9
|
.sample-code
|
@@ -1,6 +1,6 @@
|
|
1
1
|
%div(align="center")
|
2
2
|
.header_home
|
3
|
-
%h1 <a href="/"><img src
|
3
|
+
%h1 <a href="/"><img src=#{@setting.home_icon} alt="milkode-icon" border="0" height="135px"/></a> #{@setting.home_title} <font class="version">#{@version}</font>
|
4
4
|
|
5
5
|
.content
|
6
6
|
%form(method="post" action="/search")
|
@@ -12,7 +12,7 @@
|
|
12
12
|
.footer_home
|
13
13
|
<a href="/home">#{@package_num}</a>のパッケージ<br>
|
14
14
|
<a href="/home?query=f:*">#{@file_num}</a>のファイル<br>
|
15
|
-
<a href="/help">ヘルプ</a>
|
16
|
-
|
15
|
+
<a href="/help">ヘルプ</a>
|
16
|
+
= @setting.about_milkode
|
17
17
|
|
18
18
|
|
data/milkode.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{milkode}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.5.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-
|
12
|
+
s.date = %q{2012-03-24}
|
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"]
|
@@ -31,21 +31,24 @@ Gem::Specification.new do |s|
|
|
31
31
|
"bin/milk",
|
32
32
|
"lib/milkode/cdstk/cdstk.rb",
|
33
33
|
"lib/milkode/cdstk/cdstk_command.rb",
|
34
|
-
"lib/milkode/cdstk/cdstk_yaml.rb",
|
35
34
|
"lib/milkode/cdstk/cli_cdstk.rb",
|
36
35
|
"lib/milkode/cdstk/cli_cdstksub.rb",
|
36
|
+
"lib/milkode/cdstk/milkode_yaml.rb",
|
37
|
+
"lib/milkode/cdstk/package.rb",
|
38
|
+
"lib/milkode/cdstk/yaml_file_wrapper.rb",
|
37
39
|
"lib/milkode/cdweb/app.rb",
|
38
40
|
"lib/milkode/cdweb/cli_cdweb.rb",
|
39
41
|
"lib/milkode/cdweb/config.ru",
|
42
|
+
"lib/milkode/cdweb/lib/coderay_html2.rb",
|
40
43
|
"lib/milkode/cdweb/lib/coderay_wrapper.rb",
|
41
44
|
"lib/milkode/cdweb/lib/command.rb",
|
42
45
|
"lib/milkode/cdweb/lib/database.rb",
|
43
46
|
"lib/milkode/cdweb/lib/grep.rb",
|
44
47
|
"lib/milkode/cdweb/lib/mkurl.rb",
|
45
|
-
"lib/milkode/cdweb/lib/my_nokogiri.rb",
|
46
48
|
"lib/milkode/cdweb/lib/query.rb",
|
47
49
|
"lib/milkode/cdweb/lib/search_contents.rb",
|
48
50
|
"lib/milkode/cdweb/lib/search_files.rb",
|
51
|
+
"lib/milkode/cdweb/lib/web_setting.rb",
|
49
52
|
"lib/milkode/cdweb/public/css/coderay-patch.css",
|
50
53
|
"lib/milkode/cdweb/public/css/coderay.css",
|
51
54
|
"lib/milkode/cdweb/public/css/milkode.css",
|
@@ -56,10 +59,12 @@ Gem::Specification.new do |s|
|
|
56
59
|
"lib/milkode/cdweb/public/images/go-home-5.png",
|
57
60
|
"lib/milkode/cdweb/public/js/milkode.js",
|
58
61
|
"lib/milkode/cdweb/views/filelist.haml",
|
62
|
+
"lib/milkode/cdweb/views/header_menu.haml",
|
59
63
|
"lib/milkode/cdweb/views/help.haml",
|
60
64
|
"lib/milkode/cdweb/views/index.haml",
|
61
65
|
"lib/milkode/cdweb/views/layout.haml",
|
62
66
|
"lib/milkode/cdweb/views/search.haml",
|
67
|
+
"lib/milkode/cdweb/views/search_form.haml",
|
63
68
|
"lib/milkode/cdweb/views/view.haml",
|
64
69
|
"lib/milkode/common/archive-zip.rb",
|
65
70
|
"lib/milkode/common/dbdir.rb",
|
@@ -67,6 +72,8 @@ Gem::Specification.new do |s|
|
|
67
72
|
"lib/milkode/common/display_util.rb",
|
68
73
|
"lib/milkode/common/grenfiletest.rb",
|
69
74
|
"lib/milkode/common/grensnip.rb",
|
75
|
+
"lib/milkode/common/ignore_checker.rb",
|
76
|
+
"lib/milkode/common/ignore_setting.rb",
|
70
77
|
"lib/milkode/common/platform.rb",
|
71
78
|
"lib/milkode/common/string_snip.rb",
|
72
79
|
"lib/milkode/common/util.rb",
|
@@ -74,11 +81,14 @@ Gem::Specification.new do |s|
|
|
74
81
|
"lib/milkode/findgrep/result.rb",
|
75
82
|
"lib/milkode/grep/cli_grep.rb",
|
76
83
|
"milkode.gemspec",
|
84
|
+
"test/data/.gitignore",
|
77
85
|
"test/data/a_project/cdstk.rb",
|
78
86
|
"test/data/a_project/cdstk_yaml.rb",
|
79
87
|
"test/data/abc.zip",
|
80
88
|
"test/data/b_project/runner.rb",
|
81
89
|
"test/data/b_project/test_dir.rb",
|
90
|
+
"test/data/no_auto_ignore/.gitignore",
|
91
|
+
"test/data/no_auto_ignore/a.txt",
|
82
92
|
"test/data/nodir_abc.zip",
|
83
93
|
"test/data/nodir_abc_xpi.xpi",
|
84
94
|
"test/file_assert.rb",
|
@@ -89,7 +99,6 @@ Gem::Specification.new do |s|
|
|
89
99
|
"test/test_bin_exec.rb",
|
90
100
|
"test/test_cdstk.rb",
|
91
101
|
"test/test_cdstk_command.rb",
|
92
|
-
"test/test_cdstk_yaml.rb",
|
93
102
|
"test/test_cli_cdstk.rb",
|
94
103
|
"test/test_cli_grep.rb",
|
95
104
|
"test/test_coderay_wrapper.rb",
|
@@ -99,10 +108,15 @@ Gem::Specification.new do |s|
|
|
99
108
|
"test/test_dir.rb",
|
100
109
|
"test/test_gren_util.rb",
|
101
110
|
"test/test_helper.rb",
|
111
|
+
"test/test_ignore_checker.rb",
|
112
|
+
"test/test_ignore_setting.rb",
|
113
|
+
"test/test_milkode_yaml.rb",
|
102
114
|
"test/test_mkurl.rb",
|
115
|
+
"test/test_package.rb",
|
103
116
|
"test/test_query.rb",
|
104
117
|
"test/test_string_snip.rb",
|
105
|
-
"test/test_util.rb"
|
118
|
+
"test/test_util.rb",
|
119
|
+
"test/test_yaml_file_wrapper.rb"
|
106
120
|
]
|
107
121
|
s.homepage = %q{http://github.com/ongaeshi/milkode}
|
108
122
|
s.licenses = ["MIT"]
|
@@ -123,13 +137,11 @@ Gem::Specification.new do |s|
|
|
123
137
|
s.add_runtime_dependency(%q<rack>, [">= 1.3.4"])
|
124
138
|
s.add_runtime_dependency(%q<sinatra>, [">= 1.2.6"])
|
125
139
|
s.add_runtime_dependency(%q<launchy>, [">= 0.3.7"])
|
126
|
-
s.add_runtime_dependency(%q<coderay>, ["
|
140
|
+
s.add_runtime_dependency(%q<coderay>, [">= 1.0.5"])
|
127
141
|
s.add_runtime_dependency(%q<thin>, [">= 1.2.10"])
|
128
142
|
s.add_runtime_dependency(%q<archive-zip>, [">= 0.4.0"])
|
129
143
|
s.add_runtime_dependency(%q<haml>, [">= 3.1.2"])
|
130
144
|
s.add_runtime_dependency(%q<sass>, [">= 3.1.3"])
|
131
|
-
s.add_runtime_dependency(%q<nokogiri>, [">= 1.5.0"])
|
132
|
-
s.add_runtime_dependency(%q<hpricot>, [">= 0.8.2"])
|
133
145
|
else
|
134
146
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
135
147
|
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
@@ -139,13 +151,11 @@ Gem::Specification.new do |s|
|
|
139
151
|
s.add_dependency(%q<rack>, [">= 1.3.4"])
|
140
152
|
s.add_dependency(%q<sinatra>, [">= 1.2.6"])
|
141
153
|
s.add_dependency(%q<launchy>, [">= 0.3.7"])
|
142
|
-
s.add_dependency(%q<coderay>, ["
|
154
|
+
s.add_dependency(%q<coderay>, [">= 1.0.5"])
|
143
155
|
s.add_dependency(%q<thin>, [">= 1.2.10"])
|
144
156
|
s.add_dependency(%q<archive-zip>, [">= 0.4.0"])
|
145
157
|
s.add_dependency(%q<haml>, [">= 3.1.2"])
|
146
158
|
s.add_dependency(%q<sass>, [">= 3.1.3"])
|
147
|
-
s.add_dependency(%q<nokogiri>, [">= 1.5.0"])
|
148
|
-
s.add_dependency(%q<hpricot>, [">= 0.8.2"])
|
149
159
|
end
|
150
160
|
else
|
151
161
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
@@ -156,13 +166,11 @@ Gem::Specification.new do |s|
|
|
156
166
|
s.add_dependency(%q<rack>, [">= 1.3.4"])
|
157
167
|
s.add_dependency(%q<sinatra>, [">= 1.2.6"])
|
158
168
|
s.add_dependency(%q<launchy>, [">= 0.3.7"])
|
159
|
-
s.add_dependency(%q<coderay>, ["
|
169
|
+
s.add_dependency(%q<coderay>, [">= 1.0.5"])
|
160
170
|
s.add_dependency(%q<thin>, [">= 1.2.10"])
|
161
171
|
s.add_dependency(%q<archive-zip>, [">= 0.4.0"])
|
162
172
|
s.add_dependency(%q<haml>, [">= 3.1.2"])
|
163
173
|
s.add_dependency(%q<sass>, [">= 3.1.3"])
|
164
|
-
s.add_dependency(%q<nokogiri>, [">= 1.5.0"])
|
165
|
-
s.add_dependency(%q<hpricot>, [">= 0.8.2"])
|
166
174
|
end
|
167
175
|
end
|
168
176
|
|
@@ -15,9 +15,6 @@ module Milkode
|
|
15
15
|
def test_basic
|
16
16
|
CodeRayWrapper.new(JS_SHORT_CODE, "console-dir.js").to_html
|
17
17
|
CodeRayWrapper.new(JS_CODE, "console-dir.js").to_html
|
18
|
-
|
19
|
-
CodeRayWrapper.new(JS_SHORT_CODE, "console-dir.js").to_html_anchor
|
20
|
-
CodeRayWrapper.new(JS_CODE, "console-dir.js").to_html_anchor
|
21
18
|
end
|
22
19
|
end
|
23
20
|
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:
|
4
|
+
hash: 13
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 0.5.
|
9
|
+
- 3
|
10
|
+
version: 0.5.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-03-
|
18
|
+
date: 2012-03-24 00:00:00 +09:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -151,14 +151,14 @@ dependencies:
|
|
151
151
|
version_requirements: &id009 !ruby/object:Gem::Requirement
|
152
152
|
none: false
|
153
153
|
requirements:
|
154
|
-
- - "
|
154
|
+
- - ">="
|
155
155
|
- !ruby/object:Gem::Version
|
156
|
-
hash:
|
156
|
+
hash: 29
|
157
157
|
segments:
|
158
|
+
- 1
|
158
159
|
- 0
|
159
|
-
-
|
160
|
-
|
161
|
-
version: 0.9.8
|
160
|
+
- 5
|
161
|
+
version: 1.0.5
|
162
162
|
requirement: *id009
|
163
163
|
- !ruby/object:Gem::Dependency
|
164
164
|
type: :runtime
|
@@ -224,38 +224,6 @@ dependencies:
|
|
224
224
|
- 3
|
225
225
|
version: 3.1.3
|
226
226
|
requirement: *id013
|
227
|
-
- !ruby/object:Gem::Dependency
|
228
|
-
type: :runtime
|
229
|
-
prerelease: false
|
230
|
-
name: nokogiri
|
231
|
-
version_requirements: &id014 !ruby/object:Gem::Requirement
|
232
|
-
none: false
|
233
|
-
requirements:
|
234
|
-
- - ">="
|
235
|
-
- !ruby/object:Gem::Version
|
236
|
-
hash: 3
|
237
|
-
segments:
|
238
|
-
- 1
|
239
|
-
- 5
|
240
|
-
- 0
|
241
|
-
version: 1.5.0
|
242
|
-
requirement: *id014
|
243
|
-
- !ruby/object:Gem::Dependency
|
244
|
-
type: :runtime
|
245
|
-
prerelease: false
|
246
|
-
name: hpricot
|
247
|
-
version_requirements: &id015 !ruby/object:Gem::Requirement
|
248
|
-
none: false
|
249
|
-
requirements:
|
250
|
-
- - ">="
|
251
|
-
- !ruby/object:Gem::Version
|
252
|
-
hash: 59
|
253
|
-
segments:
|
254
|
-
- 0
|
255
|
-
- 8
|
256
|
-
- 2
|
257
|
-
version: 0.8.2
|
258
|
-
requirement: *id015
|
259
227
|
description: Line based local source code search engine & grep-command & web-app.
|
260
228
|
email: ongaeshi0621@gmail.com
|
261
229
|
executables:
|
@@ -288,15 +256,16 @@ files:
|
|
288
256
|
- lib/milkode/cdweb/app.rb
|
289
257
|
- lib/milkode/cdweb/cli_cdweb.rb
|
290
258
|
- lib/milkode/cdweb/config.ru
|
259
|
+
- lib/milkode/cdweb/lib/coderay_html2.rb
|
291
260
|
- lib/milkode/cdweb/lib/coderay_wrapper.rb
|
292
261
|
- lib/milkode/cdweb/lib/command.rb
|
293
262
|
- lib/milkode/cdweb/lib/database.rb
|
294
263
|
- lib/milkode/cdweb/lib/grep.rb
|
295
264
|
- lib/milkode/cdweb/lib/mkurl.rb
|
296
|
-
- lib/milkode/cdweb/lib/my_nokogiri.rb
|
297
265
|
- lib/milkode/cdweb/lib/query.rb
|
298
266
|
- lib/milkode/cdweb/lib/search_contents.rb
|
299
267
|
- lib/milkode/cdweb/lib/search_files.rb
|
268
|
+
- lib/milkode/cdweb/lib/web_setting.rb
|
300
269
|
- lib/milkode/cdweb/public/css/coderay-patch.css
|
301
270
|
- lib/milkode/cdweb/public/css/coderay.css
|
302
271
|
- lib/milkode/cdweb/public/css/milkode.css
|
@@ -1,34 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
#
|
3
|
-
# @file
|
4
|
-
# @brief
|
5
|
-
# @author ongaeshi
|
6
|
-
# @date 2011/12/02
|
7
|
-
|
8
|
-
require 'hpricot'
|
9
|
-
require 'nokogiri'
|
10
|
-
require 'milkode/common/util'
|
11
|
-
|
12
|
-
module Hpricot
|
13
|
-
class Elements
|
14
|
-
alias_method :at_css, :search
|
15
|
-
end
|
16
|
-
|
17
|
-
module Traverse
|
18
|
-
alias_method :at_css, :search
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
module Milkode
|
23
|
-
class MyNokogiri
|
24
|
-
def self.HTML(html)
|
25
|
-
if Util::ruby19?
|
26
|
-
Nokogiri::HTML(html)
|
27
|
-
else
|
28
|
-
Hpricot(html)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
|