repl_index 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile ADDED
@@ -0,0 +1,15 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
8
+ group :development do
9
+ gem "rspec", "~> 2.3.0"
10
+ gem "bundler", "~> 1.0.0"
11
+ gem "jeweler", "~> 1.5.2"
12
+ gem "rcov", ">= 0"
13
+ end
14
+
15
+ gem 'mharris_ext'
data/Gemfile.lock ADDED
@@ -0,0 +1,34 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ diff-lcs (1.1.3)
5
+ facets (2.9.1)
6
+ fattr (2.2.1)
7
+ git (1.2.5)
8
+ jeweler (1.5.2)
9
+ bundler (~> 1.0.0)
10
+ git (>= 1.2.5)
11
+ rake
12
+ mharris_ext (1.5.0)
13
+ facets
14
+ fattr
15
+ rake (0.9.2.2)
16
+ rcov (0.9.9)
17
+ rspec (2.3.0)
18
+ rspec-core (~> 2.3.0)
19
+ rspec-expectations (~> 2.3.0)
20
+ rspec-mocks (~> 2.3.0)
21
+ rspec-core (2.3.1)
22
+ rspec-expectations (2.3.0)
23
+ diff-lcs (~> 1.1.2)
24
+ rspec-mocks (2.3.0)
25
+
26
+ PLATFORMS
27
+ x86-mingw32
28
+
29
+ DEPENDENCIES
30
+ bundler (~> 1.0.0)
31
+ jeweler (~> 1.5.2)
32
+ mharris_ext
33
+ rcov
34
+ rspec (~> 2.3.0)
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2012 Mike Harris
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,19 @@
1
+ = repl_index
2
+
3
+ Description goes here.
4
+
5
+ == Contributing to repl_index
6
+
7
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
8
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
9
+ * Fork the project
10
+ * Start a feature/bugfix branch
11
+ * Commit and push until you are happy with your contribution
12
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2012 Mike Harris. See LICENSE.txt for
18
+ further details.
19
+
data/Rakefile ADDED
@@ -0,0 +1,50 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'rake'
11
+
12
+ require 'jeweler'
13
+ Jeweler::Tasks.new do |gem|
14
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
15
+ gem.name = "repl_index"
16
+ gem.homepage = "http://github.com/mharris717/repl_index"
17
+ gem.license = "MIT"
18
+ gem.summary = %Q{repl_index}
19
+ gem.description = %Q{repl_index}
20
+ gem.email = "mharris@indians.com"
21
+ gem.authors = ["Mike Harris"]
22
+ # Include your dependencies below. Runtime dependencies are required when using your gem,
23
+ # and development dependencies are only needed for development (ie running rake tasks, tests, etc)
24
+ # gem.add_runtime_dependency 'jabber4r', '> 0.1'
25
+ # gem.add_development_dependency 'rspec', '> 1.2.3'
26
+ end
27
+ Jeweler::RubygemsDotOrgTasks.new
28
+
29
+ require 'rspec/core'
30
+ require 'rspec/core/rake_task'
31
+ RSpec::Core::RakeTask.new(:spec) do |spec|
32
+ spec.pattern = FileList['spec/**/*_spec.rb']
33
+ end
34
+
35
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
36
+ spec.pattern = 'spec/**/*_spec.rb'
37
+ spec.rcov = true
38
+ end
39
+
40
+ task :default => :spec
41
+
42
+ require 'rake/rdoctask'
43
+ Rake::RDocTask.new do |rdoc|
44
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
45
+
46
+ rdoc.rdoc_dir = 'rdoc'
47
+ rdoc.title = "repl_index #{version}"
48
+ rdoc.rdoc_files.include('README*')
49
+ rdoc.rdoc_files.include('lib/**/*.rb')
50
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
data/lib/repl_index.rb ADDED
@@ -0,0 +1,100 @@
1
+ require 'mharris_ext'
2
+
3
+ class ReplIndex
4
+ include FromHash
5
+ class << self
6
+ fattr(:instance) { new }
7
+ def method_missing(sym,*args,&b)
8
+ instance.send(sym,*args,&b)
9
+ end
10
+ end
11
+ #fattr(:dirs) { ["c:/code/dw_gems/combine","c:/code/sql_tools"] }
12
+ fattr(:dirs) { [File.expand_path(Dir.getwd)] }
13
+ fattr(:exts) { %w(rb js ktr) }
14
+ fattr(:addl_globs) do
15
+ res = []
16
+ #res << "c:/code/sql_tools/views/*.sql"
17
+ #res << "C:/Documents and Settings/mharris.TRIBE/Desktop/*.sql"
18
+ #res << "c:/code/dw_gems/combine/**/*.sql"
19
+ res
20
+ end
21
+ def globs
22
+ ext_str = "{" + exts.join(",") + "}"
23
+ dirs.map { |dir| "#{dir}/**/*.#{ext_str}" } + addl_globs
24
+ end
25
+ fattr(:files) do
26
+ globs.map do |glob|
27
+ Dir[glob]
28
+ end.flatten
29
+ end
30
+ fattr(:bodies) do
31
+ files.inject({}) do |h,f|
32
+ h.merge(f.downcase => File.read(f))
33
+ end
34
+ end
35
+ def add_file(f)
36
+ f = f.downcase
37
+ return if bodies[f]
38
+ return unless f =~ /\.rb$/i || f =~ /rake/i
39
+ bodies[f] = File.read(f)
40
+ end
41
+ def add_all_loaded!
42
+ $".each { |f| add_file(f) }
43
+ end
44
+ def include_file_in_search?(f,ops)
45
+ return false if ops[:ext] && f.split(".").last.downcase != ops[:ext].to_s.downcase
46
+ true
47
+ end
48
+ def find(strs,ops={})
49
+ res = []
50
+ strs = [strs].flatten
51
+ bodies.each do |f,body|
52
+ res << f if strs.all? { |str| include_file_in_search?(f,ops) && (f =~ /#{str}/i || body =~ /#{str}/i) }
53
+ end
54
+ #res#.map { |x| x.gsub("#{dir}","CB") }
55
+ res
56
+ end
57
+ def open!(f)
58
+ #cmd = "\"c:\\progra~1\\sublime text 2\\sublime_text.exe\" #{f}"
59
+ #ec cmd
60
+ dir = File.dirname(f).gsub("/","\\")
61
+ `explorer "#{dir}"`
62
+ end
63
+ def green(*args); puts(*args); end
64
+ def red(*args); puts(*args); end
65
+
66
+ class << self
67
+ def fcf(*args)
68
+ ops = args.last.kind_of?(Hash) ? args.pop : {}
69
+ strs = [args].flatten.map { |x| x.to_s }
70
+ add_all_loaded!
71
+ files = ReplIndex.find(strs,ops)
72
+ puts "\n#{green(files.size.to_s)} matches for #{green(strs.inspect)}"
73
+ files.each_with_index { |x,i| puts "#{i+1}. #{x}" }
74
+ puts "\n"
75
+
76
+ if ops[:choose]
77
+ i = STDIN.gets.to_i
78
+ ReplIndex.open! files[i-1] if i > 0
79
+ end
80
+
81
+ nil
82
+ end
83
+ end
84
+ end
85
+
86
+ def fcf(str,ext=:rb)
87
+ ReplIndex.fcf(str, :ext => ext)
88
+ end
89
+
90
+ def fcfa(str)
91
+ ReplIndex.fcf(str)
92
+ end
93
+
94
+
95
+
96
+
97
+
98
+
99
+
100
+
@@ -0,0 +1,67 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{repl_index}
8
+ s.version = "0.0.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Mike Harris"]
12
+ s.date = %q{2012-05-15}
13
+ s.description = %q{repl_index}
14
+ s.email = %q{mharris@indians.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".rspec",
22
+ "Gemfile",
23
+ "Gemfile.lock",
24
+ "LICENSE.txt",
25
+ "README.rdoc",
26
+ "Rakefile",
27
+ "VERSION",
28
+ "lib/repl_index.rb",
29
+ "repl_index.gemspec",
30
+ "spec/repl_index_spec.rb",
31
+ "spec/spec_helper.rb"
32
+ ]
33
+ s.homepage = %q{http://github.com/mharris717/repl_index}
34
+ s.licenses = ["MIT"]
35
+ s.require_paths = ["lib"]
36
+ s.rubygems_version = %q{1.5.2}
37
+ s.summary = %q{repl_index}
38
+ s.test_files = [
39
+ "spec/repl_index_spec.rb",
40
+ "spec/spec_helper.rb"
41
+ ]
42
+
43
+ if s.respond_to? :specification_version then
44
+ s.specification_version = 3
45
+
46
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
47
+ s.add_runtime_dependency(%q<mharris_ext>, [">= 0"])
48
+ s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
49
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
50
+ s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
51
+ s.add_development_dependency(%q<rcov>, [">= 0"])
52
+ else
53
+ s.add_dependency(%q<mharris_ext>, [">= 0"])
54
+ s.add_dependency(%q<rspec>, ["~> 2.3.0"])
55
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
56
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
57
+ s.add_dependency(%q<rcov>, [">= 0"])
58
+ end
59
+ else
60
+ s.add_dependency(%q<mharris_ext>, [">= 0"])
61
+ s.add_dependency(%q<rspec>, ["~> 2.3.0"])
62
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
63
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
64
+ s.add_dependency(%q<rcov>, [">= 0"])
65
+ end
66
+ end
67
+
@@ -0,0 +1,7 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "ReplIndex" do
4
+ it "fails" do
5
+ fail "hey buddy, you should probably rename this file and start specing for real"
6
+ end
7
+ end
@@ -0,0 +1,12 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
+ require 'rspec'
4
+ require 'repl_index'
5
+
6
+ # Requires supporting files with custom matchers and macros, etc,
7
+ # in ./support/ and its subdirectories.
8
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
9
+
10
+ RSpec.configure do |config|
11
+
12
+ end
metadata ADDED
@@ -0,0 +1,121 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: repl_index
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Mike Harris
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-05-15 00:00:00.000000000 -04:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: mharris_ext
17
+ requirement: &16055784 !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: '0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: *16055784
26
+ - !ruby/object:Gem::Dependency
27
+ name: rspec
28
+ requirement: &16055448 !ruby/object:Gem::Requirement
29
+ none: false
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 2.3.0
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: *16055448
37
+ - !ruby/object:Gem::Dependency
38
+ name: bundler
39
+ requirement: &16055136 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ~>
43
+ - !ruby/object:Gem::Version
44
+ version: 1.0.0
45
+ type: :development
46
+ prerelease: false
47
+ version_requirements: *16055136
48
+ - !ruby/object:Gem::Dependency
49
+ name: jeweler
50
+ requirement: &16054824 !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ~>
54
+ - !ruby/object:Gem::Version
55
+ version: 1.5.2
56
+ type: :development
57
+ prerelease: false
58
+ version_requirements: *16054824
59
+ - !ruby/object:Gem::Dependency
60
+ name: rcov
61
+ requirement: &16054476 !ruby/object:Gem::Requirement
62
+ none: false
63
+ requirements:
64
+ - - ! '>='
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ type: :development
68
+ prerelease: false
69
+ version_requirements: *16054476
70
+ description: repl_index
71
+ email: mharris@indians.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files:
75
+ - LICENSE.txt
76
+ - README.rdoc
77
+ files:
78
+ - .document
79
+ - .rspec
80
+ - Gemfile
81
+ - Gemfile.lock
82
+ - LICENSE.txt
83
+ - README.rdoc
84
+ - Rakefile
85
+ - VERSION
86
+ - lib/repl_index.rb
87
+ - repl_index.gemspec
88
+ - spec/repl_index_spec.rb
89
+ - spec/spec_helper.rb
90
+ has_rdoc: true
91
+ homepage: http://github.com/mharris717/repl_index
92
+ licenses:
93
+ - MIT
94
+ post_install_message:
95
+ rdoc_options: []
96
+ require_paths:
97
+ - lib
98
+ required_ruby_version: !ruby/object:Gem::Requirement
99
+ none: false
100
+ requirements:
101
+ - - ! '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ segments:
105
+ - 0
106
+ hash: -49020497
107
+ required_rubygems_version: !ruby/object:Gem::Requirement
108
+ none: false
109
+ requirements:
110
+ - - ! '>='
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ requirements: []
114
+ rubyforge_project:
115
+ rubygems_version: 1.5.2
116
+ signing_key:
117
+ specification_version: 3
118
+ summary: repl_index
119
+ test_files:
120
+ - spec/repl_index_spec.rb
121
+ - spec/spec_helper.rb