gem-codesearch 0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +34 -0
- data/LICENSE +22 -0
- data/README.md +36 -0
- data/Rakefile +119 -0
- data/bin/gem-codesearch-setup +9 -0
- data/gem-codesearch.gemspec +28 -0
- metadata +113 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3ba88fec2f6fc7cb946e0a1ba82b5296f41b8a14
|
4
|
+
data.tar.gz: 4ca8bd6a6b62f3da81b3f2ace20f5a13fe0d4c45
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: fd31437425bf9d8d8693af6784a2cbafe95f0caedc0a56f8ea095151144174f11e1ecf6ac2f35ba12aba3b45cc86e3a8c0d52eed760c35b8b6be2787d4ad081c
|
7
|
+
data.tar.gz: 304fb9e178cd06cc2b8279bf1872b20fa30789e53ab5dca747f1442ebf131610782dc758fecdda6a13a4df64c94ce14ea87031e8160019ba2e9a7de80bcec076
|
data/.gitignore
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/test/tmp/
|
9
|
+
/test/version_tmp/
|
10
|
+
/tmp/
|
11
|
+
|
12
|
+
## Specific to RubyMotion:
|
13
|
+
.dat*
|
14
|
+
.repl_history
|
15
|
+
build/
|
16
|
+
|
17
|
+
## Documentation cache and generated files:
|
18
|
+
/.yardoc/
|
19
|
+
/_yardoc/
|
20
|
+
/doc/
|
21
|
+
/rdoc/
|
22
|
+
|
23
|
+
## Environment normalisation:
|
24
|
+
/.bundle/
|
25
|
+
/lib/bundler/man/
|
26
|
+
|
27
|
+
# for a library or gem, you might want to ignore these files since the code is
|
28
|
+
# intended to run in multiple environments; otherwise, check them in:
|
29
|
+
# Gemfile.lock
|
30
|
+
# .ruby-version
|
31
|
+
# .ruby-gemset
|
32
|
+
|
33
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
34
|
+
.rvmrc
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Tanaka Akira
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
22
|
+
|
data/README.md
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# gem-codesearch
|
2
|
+
|
3
|
+
gem-codesearch sets up a full text code search engine on mirror of rubygems.
|
4
|
+
It use rubygems-mirror to mirror rubygems and milkode for search engine.
|
5
|
+
|
6
|
+
## Usage
|
7
|
+
|
8
|
+
This creates "latest-gem" package in milkode index.
|
9
|
+
|
10
|
+
% gem install gem-codesearch
|
11
|
+
% milk init --default # If you use milkode first time
|
12
|
+
% mkdir $HOME/gem-codesearch # Make a some directory
|
13
|
+
% cd $HOME/gem-codesearch
|
14
|
+
% gem-codesearch-setup all >& setup.log # It may take several days or more
|
15
|
+
|
16
|
+
If "gem-codesearch-setup all" fails due to network or server errors,
|
17
|
+
try again.
|
18
|
+
|
19
|
+
After the index is created, enjoy code search.
|
20
|
+
|
21
|
+
% gmilk -p latest-gem sort_by
|
22
|
+
|
23
|
+
## Usage without install
|
24
|
+
|
25
|
+
% gem install rubygems-mirror milkode
|
26
|
+
% milk init --default # If you use milkode first time
|
27
|
+
% cd $HOME
|
28
|
+
% git clone https://github.com/akr/gem-codesearch.git
|
29
|
+
% cd gem-codesearch
|
30
|
+
% rake all >& setup.log # It may take several days or more
|
31
|
+
|
32
|
+
## Author
|
33
|
+
|
34
|
+
Tanaka Akira
|
35
|
+
akr@fsij.org
|
36
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
require 'rbconfig'
|
2
|
+
require 'fileutils'
|
3
|
+
require 'find'
|
4
|
+
require 'pp'
|
5
|
+
|
6
|
+
task :default => :help
|
7
|
+
|
8
|
+
task :help do
|
9
|
+
puts <<'End'
|
10
|
+
Usage:
|
11
|
+
rake help
|
12
|
+
rake all # mirror, unpack, index
|
13
|
+
rake mirror
|
14
|
+
rake unpack
|
15
|
+
rake index
|
16
|
+
End
|
17
|
+
end
|
18
|
+
|
19
|
+
task :all => [:mirror, :unpack, :index]
|
20
|
+
|
21
|
+
MIRROR_DIR = "#{Dir.pwd}/mirror"
|
22
|
+
LATEST_DIR = "#{Dir.pwd}/latest-gem"
|
23
|
+
LOG_DIR = "#{Dir.pwd}/log"
|
24
|
+
|
25
|
+
GEM_COMMAND = "#{RbConfig::CONFIG["bindir"]}/gem"
|
26
|
+
MILK_COMMAND = "#{RbConfig::CONFIG["bindir"]}/milk"
|
27
|
+
|
28
|
+
file ".gem/.mirrorrc" do |t|
|
29
|
+
FileUtils.mkpath File.dirname(t.name)
|
30
|
+
File.write(t.name, <<"End")
|
31
|
+
---
|
32
|
+
- from: http://production.s3.rubygems.org
|
33
|
+
to: #{MIRROR_DIR}
|
34
|
+
End
|
35
|
+
end
|
36
|
+
|
37
|
+
task :mirror => ".gem/.mirrorrc" do
|
38
|
+
FileUtils.mkpath MIRROR_DIR
|
39
|
+
# HOME is set because gem mirror reads $HOME/.gem/.mirrorrc.
|
40
|
+
sh "HOME=#{Dir.pwd} #{GEM_COMMAND} mirror --verbose"
|
41
|
+
end
|
42
|
+
|
43
|
+
task :unpack do
|
44
|
+
FileUtils.mkpath LOG_DIR
|
45
|
+
|
46
|
+
available_gems = {}
|
47
|
+
Dir.foreach("#{MIRROR_DIR}/gems") {|filename|
|
48
|
+
next if /\.gem\z/ !~ filename
|
49
|
+
available_gems[filename] = true
|
50
|
+
}
|
51
|
+
FileUtils.mkpath LATEST_DIR
|
52
|
+
all_specs = File.open("#{MIRROR_DIR}/specs.4.8") {|f| Marshal.load(f) }
|
53
|
+
all_specs = all_specs.reject {|name,version,platform|
|
54
|
+
/\A\./ =~ name ||
|
55
|
+
/\A[0-9a-zA-Z._-]+\z/ !~ name ||
|
56
|
+
/\A[0-9a-zA-Z._-]+\z/ !~ version.to_s ||
|
57
|
+
platform != 'ruby' ||
|
58
|
+
!available_gems["#{name}-#{version}.gem"]
|
59
|
+
}
|
60
|
+
|
61
|
+
#all_specs = all_specs.reject {|name,version,platform| /\Afoo-/ !~ name }
|
62
|
+
|
63
|
+
latest_vnames = []
|
64
|
+
nonlatest_vnames = []
|
65
|
+
h = all_specs.group_by {|name,version| name }
|
66
|
+
h.each {|name, list|
|
67
|
+
list = list.sort_by {|name,version| version }
|
68
|
+
vnames = list.map {|name,version| "#{name}-#{version}" }
|
69
|
+
latest_vnames << vnames.pop
|
70
|
+
nonlatest_vnames.concat list
|
71
|
+
}
|
72
|
+
|
73
|
+
already_unpacked = Dir.entries(LATEST_DIR)
|
74
|
+
(already_unpacked & nonlatest_vnames).each {|vname|
|
75
|
+
puts "remove: #{vname}
|
76
|
+
FileUtils.rmtree("#{LATEST_DIR}/#{vname}")
|
77
|
+
}
|
78
|
+
|
79
|
+
File.open("#{LOG_DIR}/unpack.log.#{Time.now.strftime '%FT%T%:z'}", "a") {|log|
|
80
|
+
(latest_vnames - already_unpacked).each {|vname|
|
81
|
+
puts "unpack: #{vname}"
|
82
|
+
system GEM_COMMAND, 'unpack', "#{MIRROR_DIR}/gems/#{vname}.gem", :chdir => LATEST_DIR, :out => log
|
83
|
+
if !$?.success?
|
84
|
+
puts "failed to unpack #{vname}"
|
85
|
+
end
|
86
|
+
fix_permission("#{LATEST_DIR}/#{vname}")
|
87
|
+
}
|
88
|
+
}
|
89
|
+
|
90
|
+
end
|
91
|
+
|
92
|
+
task :index do
|
93
|
+
# Assume default database for milkode is already created.
|
94
|
+
# If not, do it as follows:
|
95
|
+
# milk init --default
|
96
|
+
milkode_package_list = IO.popen([MILK_COMMAND, 'list']) {|f| f.read }
|
97
|
+
package_name = File.basename(LATEST_DIR)
|
98
|
+
if /^#{Regexp.escape package_name}$/ !~ milkode_package_list
|
99
|
+
system MILK_COMMAND, 'add', '--verbose', LATEST_DIR
|
100
|
+
else
|
101
|
+
system MILK_COMMAND, 'update', '--verbose', package_name
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
def fix_permission(dir)
|
106
|
+
return unless File.exist? dir
|
107
|
+
Find.find(dir) {|fn|
|
108
|
+
st = File.lstat(fn)
|
109
|
+
if st.file?
|
110
|
+
if !st.readable?
|
111
|
+
File.chmod(0644, fn)
|
112
|
+
end
|
113
|
+
elsif st.directory?
|
114
|
+
if !st.readable? || !st.executable?
|
115
|
+
File.chmod(0755, fn)
|
116
|
+
end
|
117
|
+
end
|
118
|
+
}
|
119
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = 'gem-codesearch'
|
3
|
+
s.version = '0.1'
|
4
|
+
s.date = '2015-01-09'
|
5
|
+
s.author = 'Tanaka Akira'
|
6
|
+
s.email = 'akr@fsij.org'
|
7
|
+
s.required_ruby_version = '>= 2.2.0'
|
8
|
+
s.add_runtime_dependency 'rubygems-mirror', '~> 1.0', '>= 1.0.1'
|
9
|
+
s.add_runtime_dependency 'milkode', '~> 1.8', '>= 1.8.6'
|
10
|
+
s.add_runtime_dependency 'rake', '~> 10.4', '>= 10.4.2'
|
11
|
+
s.executables << 'gem-codesearch-setup'
|
12
|
+
s.files = %w[
|
13
|
+
.gitignore
|
14
|
+
LICENSE
|
15
|
+
README.md
|
16
|
+
Rakefile
|
17
|
+
bin/gem-codesearch-setup
|
18
|
+
gem-codesearch.gemspec
|
19
|
+
]
|
20
|
+
s.homepage = 'https://github.com/akr/gem-codesearch'
|
21
|
+
s.license = 'MIT'
|
22
|
+
s.summary = 'Set up a full text code search engine for rubygems mirror'
|
23
|
+
s.description = <<'End'
|
24
|
+
gem-codesearch sets up a full text code search engine for rubygems mirror.
|
25
|
+
It use rubygems-mirror to mirror rubygems and
|
26
|
+
milkode for search engine.
|
27
|
+
End
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gem-codesearch
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.1'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Tanaka Akira
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-01-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rubygems-mirror
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.0.1
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.0'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.0.1
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: milkode
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '1.8'
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 1.8.6
|
43
|
+
type: :runtime
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '1.8'
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 1.8.6
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: rake
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - "~>"
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '10.4'
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 10.4.2
|
63
|
+
type: :runtime
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '10.4'
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: 10.4.2
|
73
|
+
description: |
|
74
|
+
gem-codesearch sets up a full text code search engine for rubygems mirror.
|
75
|
+
It use rubygems-mirror to mirror rubygems and
|
76
|
+
milkode for search engine.
|
77
|
+
email: akr@fsij.org
|
78
|
+
executables:
|
79
|
+
- gem-codesearch-setup
|
80
|
+
extensions: []
|
81
|
+
extra_rdoc_files: []
|
82
|
+
files:
|
83
|
+
- ".gitignore"
|
84
|
+
- LICENSE
|
85
|
+
- README.md
|
86
|
+
- Rakefile
|
87
|
+
- bin/gem-codesearch-setup
|
88
|
+
- gem-codesearch.gemspec
|
89
|
+
homepage: https://github.com/akr/gem-codesearch
|
90
|
+
licenses:
|
91
|
+
- MIT
|
92
|
+
metadata: {}
|
93
|
+
post_install_message:
|
94
|
+
rdoc_options: []
|
95
|
+
require_paths:
|
96
|
+
- lib
|
97
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: 2.2.0
|
102
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
requirements: []
|
108
|
+
rubyforge_project:
|
109
|
+
rubygems_version: 2.4.5
|
110
|
+
signing_key:
|
111
|
+
specification_version: 4
|
112
|
+
summary: Set up a full text code search engine for rubygems mirror
|
113
|
+
test_files: []
|