nkpart-accidently 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +6 -0
- data/Manifest.txt +21 -0
- data/PostInstall.txt +7 -0
- data/README.rdoc +65 -0
- data/Rakefile +28 -0
- data/TODO +4 -0
- data/accidently.gemspec +41 -0
- data/etc/examples.rb +21 -0
- data/etc/textmate_command.rb +16 -0
- data/lib/accidently.rb +34 -0
- data/lib/accidently/mad_hax.rb +24 -0
- data/lib/accidently/method_invoker.rb +54 -0
- data/lib/accidently/patches/kernel.rb +12 -0
- data/lib/accidently/patches/thread.rb +11 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/spec/accidently_spec.rb +85 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +16 -0
- data/tasks/rspec.rake +29 -0
- metadata +104 -0
data/History.txt
ADDED
data/Manifest.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
History.txt
|
2
|
+
Manifest.txt
|
3
|
+
PostInstall.txt
|
4
|
+
README.rdoc
|
5
|
+
Rakefile
|
6
|
+
TODO
|
7
|
+
accidently.gemspec
|
8
|
+
etc/examples.rb
|
9
|
+
etc/textmate_command.rb
|
10
|
+
lib/accidently.rb
|
11
|
+
lib/accidently/mad_hax.rb
|
12
|
+
lib/accidently/method_invoker.rb
|
13
|
+
lib/accidently/patches/kernel.rb
|
14
|
+
lib/accidently/patches/thread.rb
|
15
|
+
script/console
|
16
|
+
script/destroy
|
17
|
+
script/generate
|
18
|
+
spec/accidently_spec.rb
|
19
|
+
spec/spec.opts
|
20
|
+
spec/spec_helper.rb
|
21
|
+
tasks/rspec.rake
|
data/PostInstall.txt
ADDED
data/README.rdoc
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
= Accidently!
|
2
|
+
|
3
|
+
* http://github.com/nkpart/accidently
|
4
|
+
|
5
|
+
== What?
|
6
|
+
|
7
|
+
Accidently helps you out when you know what you want to do something, but you can't remember the function name
|
8
|
+
|
9
|
+
== How
|
10
|
+
|
11
|
+
$ sudo gem install nkpart-accidently
|
12
|
+
$ irb
|
13
|
+
|
14
|
+
>> require 'accidently'
|
15
|
+
>> 1.accidently == '1'
|
16
|
+
=> ["to_s", "inspect"]
|
17
|
+
|
18
|
+
== Examples:
|
19
|
+
|
20
|
+
> [1,2,3].accidently == 3
|
21
|
+
=> ["last", "pop", "length", "size", "nitems", "max"]
|
22
|
+
|
23
|
+
> [1,nil,3,5].accidently == [1,3,5]
|
24
|
+
=> ["select", "compact", "compact!", "find_all"]
|
25
|
+
|
26
|
+
> [:a, :b, :c].accidently(:b) == 1
|
27
|
+
=> ["index", "rindex"]
|
28
|
+
|
29
|
+
> [:a, :b, :c, :d].accidently(2,3) == [:c, :d]
|
30
|
+
=> ["slice", "indexes", "values_at", "indices", "slice!", "[]"]
|
31
|
+
|
32
|
+
> "abc".accidently(/\w/) == ["a","b","c"]
|
33
|
+
=> ["scan"]
|
34
|
+
|
35
|
+
> [1,2,3,4,5].accidently{|a,b| a + b} == 15
|
36
|
+
=> ["inject"]
|
37
|
+
|
38
|
+
== Requirements
|
39
|
+
|
40
|
+
* prohax - http://github.com/nkpart/prohax
|
41
|
+
|
42
|
+
== License
|
43
|
+
|
44
|
+
(The MIT License)
|
45
|
+
|
46
|
+
Copyright (c) 2008 nkpart
|
47
|
+
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
49
|
+
a copy of this software and associated documentation files (the
|
50
|
+
'Software'), to deal in the Software without restriction, including
|
51
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
52
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
53
|
+
permit persons to whom the Software is furnished to do so, subject to
|
54
|
+
the following conditions:
|
55
|
+
|
56
|
+
The above copyright notice and this permission notice shall be
|
57
|
+
included in all copies or substantial portions of the Software.
|
58
|
+
|
59
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
60
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
61
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
62
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
63
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
64
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
65
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
%w[rubygems rake rake/clean fileutils newgem rubigen].each { |f| require f }
|
2
|
+
require File.dirname(__FILE__) + '/lib/accidently'
|
3
|
+
|
4
|
+
# Generate all the Rake tasks
|
5
|
+
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
6
|
+
$hoe = Hoe.new('accidently', Accidently::VERSION) do |p|
|
7
|
+
p.developer('nkpart', 'nkpart@gmail.com')
|
8
|
+
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
9
|
+
p.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
|
10
|
+
p.rubyforge_name = p.name # TODO this is default value
|
11
|
+
p.extra_deps = [
|
12
|
+
['nkpart-prohax','>= 1.0.1']
|
13
|
+
]
|
14
|
+
p.extra_dev_deps = [
|
15
|
+
['newgem', ">= #{::Newgem::VERSION}"]
|
16
|
+
]
|
17
|
+
|
18
|
+
p.clean_globs |= %w[**/.DS_Store tmp *.log]
|
19
|
+
path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
|
20
|
+
p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc')
|
21
|
+
p.rsync_args = '-av --delete --ignore-errors'
|
22
|
+
end
|
23
|
+
|
24
|
+
require 'newgem/tasks'
|
25
|
+
Dir['tasks/**/*.rake'].each { |t| load t }
|
26
|
+
|
27
|
+
task "build" => ["spec", "verify_rcov"]
|
28
|
+
task :default => [:build]
|
data/TODO
ADDED
@@ -0,0 +1,4 @@
|
|
1
|
+
* Do a fuzzy search. Methods that return things of the same type as the expected thing should be found.
|
2
|
+
* Create a type to wrap the returned methods.
|
3
|
+
* Find a method which expects parameters even when we haven't supplied the arguments.
|
4
|
+
* Would need to knock up our own arguments in the MethodInvoker...
|
data/accidently.gemspec
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{accidently}
|
5
|
+
s.version = "0.0.1"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["nkpart"]
|
9
|
+
s.date = %q{2008-11-18}
|
10
|
+
s.description = %q{}
|
11
|
+
s.email = ["nkpart@gmail.com"]
|
12
|
+
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc"]
|
13
|
+
s.files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "TODO", "accidently.gemspec", "etc/examples.rb", "etc/textmate_command.rb", "lib/accidently.rb", "lib/accidently/mad_hax.rb", "lib/accidently/method_invoker.rb", "lib/accidently/patches/kernel.rb", "lib/accidently/patches/thread.rb", "script/console", "script/destroy", "script/generate", "spec/accidently_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "tasks/rspec.rake"]
|
14
|
+
s.has_rdoc = true
|
15
|
+
s.homepage = %q{http://github.com/nkpart/accidently}
|
16
|
+
s.post_install_message = %q{PostInstall.txt}
|
17
|
+
s.rdoc_options = ["--main", "README.rdoc"]
|
18
|
+
s.require_paths = ["lib"]
|
19
|
+
s.rubyforge_project = %q{accidently}
|
20
|
+
s.rubygems_version = %q{1.3.1}
|
21
|
+
s.summary = %q{}
|
22
|
+
|
23
|
+
if s.respond_to? :specification_version then
|
24
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
25
|
+
s.specification_version = 2
|
26
|
+
|
27
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
28
|
+
s.add_runtime_dependency(%q<nkpart-prohax>, [">= 1.0.1"])
|
29
|
+
s.add_development_dependency(%q<newgem>, [">= 1.1.0"])
|
30
|
+
s.add_development_dependency(%q<hoe>, [">= 1.8.0"])
|
31
|
+
else
|
32
|
+
s.add_dependency(%q<nkpart-prohax>, [">= 1.0.1"])
|
33
|
+
s.add_dependency(%q<newgem>, [">= 1.1.0"])
|
34
|
+
s.add_dependency(%q<hoe>, [">= 1.8.0"])
|
35
|
+
end
|
36
|
+
else
|
37
|
+
s.add_dependency(%q<nkpart-prohax>, [">= 1.0.1"])
|
38
|
+
s.add_dependency(%q<newgem>, [">= 1.1.0"])
|
39
|
+
s.add_dependency(%q<hoe>, [">= 1.8.0"])
|
40
|
+
end
|
41
|
+
end
|
data/etc/examples.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require '../lib/accidently'
|
2
|
+
|
3
|
+
examples = <<EXAMPLES
|
4
|
+
[1,2,3].accidently == 3
|
5
|
+
[1,nil,3,5].accidently == [1,3,5]
|
6
|
+
[:a, :b, :c].accidently(:b) == 1
|
7
|
+
[:a, :b, :c, :d].accidently(2,3) == [:c, :d]
|
8
|
+
"abc".accidently(/\\w/) == ["a","b","c"]
|
9
|
+
[1,2,3,4,5].accidently{|a,b| a + b} == 15
|
10
|
+
EXAMPLES
|
11
|
+
|
12
|
+
examples.split("\n").each do |example|
|
13
|
+
next if example.empty?
|
14
|
+
puts "> #{example}\n => #{eval(example).inspect}"
|
15
|
+
puts ""
|
16
|
+
end
|
17
|
+
|
18
|
+
1.accidently == '1'
|
19
|
+
|
20
|
+
[1,2,3].accidently(2) == [1,2]
|
21
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
gem 'accidently'
|
5
|
+
require 'accidently'
|
6
|
+
input = STDIN.read
|
7
|
+
answers = eval(input)
|
8
|
+
if !answers.empty?
|
9
|
+
puts "# #{input}"
|
10
|
+
puts answers.map { |a|
|
11
|
+
input.gsub(/accidently/, a)
|
12
|
+
}.join("\n")
|
13
|
+
else
|
14
|
+
puts $TM_SELECTED_TEXT + " # No match"
|
15
|
+
end
|
16
|
+
|
data/lib/accidently.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
$: << File.expand_path(File.dirname(__FILE__))
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
gem 'nkpart-prohax'
|
5
|
+
require 'prohax'
|
6
|
+
require 'accidently/mad_hax'
|
7
|
+
|
8
|
+
class Object
|
9
|
+
def accidently *args, &block
|
10
|
+
Accidently::Proxy.new(self).with(*args, &block)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
module Accidently
|
15
|
+
VERSION = '0.0.1'
|
16
|
+
|
17
|
+
class Proxy
|
18
|
+
def initialize object
|
19
|
+
@object = object
|
20
|
+
@args = []
|
21
|
+
@block = nil
|
22
|
+
end
|
23
|
+
|
24
|
+
def == result
|
25
|
+
MadHax.find_how @object, result, @args, &@block
|
26
|
+
end
|
27
|
+
|
28
|
+
def with *args, &block
|
29
|
+
@args.concat args
|
30
|
+
@block = block
|
31
|
+
self
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'accidently/method_invoker'
|
2
|
+
|
3
|
+
module Accidently
|
4
|
+
module MadHax
|
5
|
+
|
6
|
+
@@blacklist = %w(daemonize display exec exit! fork sleep system syscall what? what ri accidently)
|
7
|
+
|
8
|
+
module_function
|
9
|
+
|
10
|
+
def select_candidates methods
|
11
|
+
methods.select { |m| m !~ /(should)|(assert)|(methods)/ && !@@blacklist.include?(m)}
|
12
|
+
end
|
13
|
+
|
14
|
+
def find_how original, target, args = [], &blk
|
15
|
+
let(
|
16
|
+
:f => proc { |m| MethodInvoker.invoke(original, m, args, &blk) },
|
17
|
+
:candidates => proc { select_candidates(original.methods) }
|
18
|
+
).in {
|
19
|
+
candidates.select { |m| f(m) == target }
|
20
|
+
}
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'accidently/patches/kernel'
|
2
|
+
require 'accidently/patches/thread'
|
3
|
+
|
4
|
+
class InvocationResult < Strucked.build(:result, :block_used); end
|
5
|
+
|
6
|
+
module Accidently
|
7
|
+
class MethodInvoker
|
8
|
+
def self.invoke v, meth, args, &blk
|
9
|
+
self.new(v).invoke(meth, args, &blk)
|
10
|
+
end
|
11
|
+
|
12
|
+
def initialize v
|
13
|
+
@v = v
|
14
|
+
end
|
15
|
+
|
16
|
+
def invoke meth, args, &blk
|
17
|
+
v, warns = yield_and_collect_stderr {
|
18
|
+
invocation_result, fail = either { do_send(meth, args, &blk) }
|
19
|
+
if should_do_block_execute(invocation_result, fail) then
|
20
|
+
either { invoke_and_infer_block(meth, args) }.compact.first
|
21
|
+
else
|
22
|
+
invocation_result
|
23
|
+
end
|
24
|
+
}
|
25
|
+
# TODO handle the warns
|
26
|
+
v
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def should_do_block_execute(invocation_result, fail)
|
32
|
+
let(
|
33
|
+
:is_a_187_block_result => proc { |x| defined?(Enumerable::Enumerator) && x.is_a?(Enumerable::Enumerator) },
|
34
|
+
:failed_because_no_block => proc { |fail| (fail && fail.is_a?(LocalJumpError)) }
|
35
|
+
).in {
|
36
|
+
failed_because_no_block(fail) || is_a_187_block_result(invocation_result)
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
def do_send meth, args, &blk
|
41
|
+
# Executing with timeout in case of endless methods, like Array#cycle in 1.8.7
|
42
|
+
Thread.execute_with_timeout { dup(@v).send(meth, *args, &blk) }
|
43
|
+
end
|
44
|
+
|
45
|
+
def dup value
|
46
|
+
(value.is_a? Fixnum) ? value : value.dup
|
47
|
+
end
|
48
|
+
|
49
|
+
def invoke_and_infer_block m, args
|
50
|
+
blk = proc { |x| x }
|
51
|
+
do_send(m, args, &blk)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
data/script/console
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# File: script/console
|
3
|
+
irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
|
4
|
+
|
5
|
+
libs = " -r irb/completion"
|
6
|
+
# Perhaps use a console_lib to store any extra methods I may want available in the cosole
|
7
|
+
# libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
|
8
|
+
libs << " -r #{File.dirname(__FILE__) + '/../lib/how_does.rb'}"
|
9
|
+
puts "Loading how_does gem"
|
10
|
+
exec "#{irb} #{libs} --simple-prompt"
|
data/script/destroy
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'rubigen'
|
6
|
+
rescue LoadError
|
7
|
+
require 'rubygems'
|
8
|
+
require 'rubigen'
|
9
|
+
end
|
10
|
+
require 'rubigen/scripts/destroy'
|
11
|
+
|
12
|
+
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
+
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
+
RubiGen::Scripts::Destroy.new.run(ARGV)
|
data/script/generate
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'rubigen'
|
6
|
+
rescue LoadError
|
7
|
+
require 'rubygems'
|
8
|
+
require 'rubigen'
|
9
|
+
end
|
10
|
+
require 'rubigen/scripts/generate'
|
11
|
+
|
12
|
+
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
+
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
+
RubiGen::Scripts::Generate.new.run(ARGV)
|
@@ -0,0 +1,85 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper.rb'
|
2
|
+
|
3
|
+
include Accidently
|
4
|
+
|
5
|
+
describe Accidently do
|
6
|
+
it "should figure out length of an array" do
|
7
|
+
methods = "dog".accidently == 3
|
8
|
+
assert methods.include?("length")
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should figure out array reversal" do
|
12
|
+
methods = [1, 2].accidently == [2, 1]
|
13
|
+
assert methods.include?("reverse")
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should figure out select" do
|
17
|
+
methods = [1, false, 2].accidently == [1, 2]
|
18
|
+
assert methods.include?("select { |x| x }")
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should figure out index" do
|
22
|
+
methods = [:a, :b, :c].accidently == :a
|
23
|
+
assert methods.include?("first")
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should be able to be guided by a parameter" do
|
27
|
+
methods = [:a, :b, :c].accidently(:b) == 1
|
28
|
+
assert methods.include?("index")
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should be able to be guided by more than one parameter" do
|
32
|
+
methods = [:a, :b, :c, :d, :e].accidently(1, 2) == [:b, :c]
|
33
|
+
assert methods.include?("slice")
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should be able to take a block suggestion" do
|
37
|
+
m = [1, 2, 3].accidently{ |a, b| a + b } == 6
|
38
|
+
assert m.include?("inject")
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should not fail for fixnums" do
|
42
|
+
m = 1.accidently == "1"
|
43
|
+
assert m.include?("to_s")
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe Accidently::MethodInvoker do
|
48
|
+
it "should invoke a simple no args method" do
|
49
|
+
r = MethodInvoker.invoke [], :size, []
|
50
|
+
assert_equal 0, r
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should invoke a no args method that takes a block" do
|
54
|
+
r = MethodInvoker.invoke [1], :select, []
|
55
|
+
assert_equal [1], r
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
describe "Kernel patches" do
|
60
|
+
it "should collect warns" do
|
61
|
+
a, warns = yield_and_collect_stderr {
|
62
|
+
warn "fail"
|
63
|
+
warn "2"
|
64
|
+
5
|
65
|
+
}
|
66
|
+
|
67
|
+
a.should == 5
|
68
|
+
warns.should == "fail\n2\n"
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
describe "Thread patches" do
|
73
|
+
it "should execute with a timeout" do
|
74
|
+
Thread.execute_with_timeout(0.1) do
|
75
|
+
5
|
76
|
+
end.should == 5
|
77
|
+
end
|
78
|
+
|
79
|
+
it "should terminate early if longer than timeout" do
|
80
|
+
Thread.execute_with_timeout(0.1) do sleep(0.2); 1 end.should == nil
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
|
85
|
+
|
data/spec/spec.opts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--colour
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
begin
|
2
|
+
require 'spec'
|
3
|
+
rescue LoadError
|
4
|
+
require 'rubygems'
|
5
|
+
gem 'rspec'
|
6
|
+
require 'spec'
|
7
|
+
end
|
8
|
+
|
9
|
+
require 'test/unit/assertions'
|
10
|
+
|
11
|
+
include Test::Unit::Assertions
|
12
|
+
|
13
|
+
$:.unshift(File.dirname(__FILE__) + '/../lib')
|
14
|
+
require 'accidently'
|
15
|
+
require 'accidently/method_invoker'
|
16
|
+
require 'accidently/patches/kernel'
|
data/tasks/rspec.rake
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
begin
|
2
|
+
require 'spec'
|
3
|
+
rescue LoadError
|
4
|
+
require 'rubygems'
|
5
|
+
require 'spec'
|
6
|
+
end
|
7
|
+
begin
|
8
|
+
require 'spec/rake/spectask'
|
9
|
+
require 'spec/rake/verify_rcov'
|
10
|
+
rescue LoadError
|
11
|
+
puts <<-EOS
|
12
|
+
To use rspec for testing you must install rspec gem:
|
13
|
+
gem install rspec
|
14
|
+
EOS
|
15
|
+
exit(0)
|
16
|
+
end
|
17
|
+
|
18
|
+
desc "coverage"
|
19
|
+
RCov::VerifyTask.new do |t|
|
20
|
+
t.threshold = 100
|
21
|
+
end
|
22
|
+
|
23
|
+
desc "Run the specs under spec/models"
|
24
|
+
Spec::Rake::SpecTask.new do |t|
|
25
|
+
t.spec_opts = ['--options', "spec/spec.opts"]
|
26
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
27
|
+
t.rcov_opts = ['--exclude', 'spec,rcov.rb']
|
28
|
+
t.rcov = true
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: nkpart-accidently
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- nkpart
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-11-18 00:00:00 -08:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: nkpart-prohax
|
17
|
+
version_requirement:
|
18
|
+
version_requirements: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.0.1
|
23
|
+
version:
|
24
|
+
- !ruby/object:Gem::Dependency
|
25
|
+
name: newgem
|
26
|
+
version_requirement:
|
27
|
+
version_requirements: !ruby/object:Gem::Requirement
|
28
|
+
requirements:
|
29
|
+
- - ">="
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: 1.1.0
|
32
|
+
version:
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: hoe
|
35
|
+
version_requirement:
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.8.0
|
41
|
+
version:
|
42
|
+
description: ""
|
43
|
+
email:
|
44
|
+
- nkpart@gmail.com
|
45
|
+
executables: []
|
46
|
+
|
47
|
+
extensions: []
|
48
|
+
|
49
|
+
extra_rdoc_files:
|
50
|
+
- History.txt
|
51
|
+
- Manifest.txt
|
52
|
+
- PostInstall.txt
|
53
|
+
- README.rdoc
|
54
|
+
files:
|
55
|
+
- History.txt
|
56
|
+
- Manifest.txt
|
57
|
+
- PostInstall.txt
|
58
|
+
- README.rdoc
|
59
|
+
- Rakefile
|
60
|
+
- TODO
|
61
|
+
- accidently.gemspec
|
62
|
+
- etc/examples.rb
|
63
|
+
- etc/textmate_command.rb
|
64
|
+
- lib/accidently.rb
|
65
|
+
- lib/accidently/mad_hax.rb
|
66
|
+
- lib/accidently/method_invoker.rb
|
67
|
+
- lib/accidently/patches/kernel.rb
|
68
|
+
- lib/accidently/patches/thread.rb
|
69
|
+
- script/console
|
70
|
+
- script/destroy
|
71
|
+
- script/generate
|
72
|
+
- spec/accidently_spec.rb
|
73
|
+
- spec/spec.opts
|
74
|
+
- spec/spec_helper.rb
|
75
|
+
- tasks/rspec.rake
|
76
|
+
has_rdoc: true
|
77
|
+
homepage: http://github.com/nkpart/accidently
|
78
|
+
post_install_message: PostInstall.txt
|
79
|
+
rdoc_options:
|
80
|
+
- --main
|
81
|
+
- README.rdoc
|
82
|
+
require_paths:
|
83
|
+
- lib
|
84
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: "0"
|
89
|
+
version:
|
90
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: "0"
|
95
|
+
version:
|
96
|
+
requirements: []
|
97
|
+
|
98
|
+
rubyforge_project: accidently
|
99
|
+
rubygems_version: 1.2.0
|
100
|
+
signing_key:
|
101
|
+
specification_version: 2
|
102
|
+
summary: ""
|
103
|
+
test_files: []
|
104
|
+
|