duckstrings 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +48 -0
- data/.rspec +1 -0
- data/.rvmrc +1 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +28 -0
- data/README.md +10 -0
- data/Rakefile +49 -0
- data/duckstrings.gemspec +17 -0
- data/lib/duckstrings.rb +60 -0
- data/lib/duckstrings/version.rb +3 -0
- data/spec/duckstrings_spec.rb +33 -0
- data/spec/spec_helper.rb +12 -0
- metadata +62 -0
data/.document
ADDED
data/.gitignore
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# rcov generated
|
2
|
+
coverage
|
3
|
+
|
4
|
+
# rdoc generated
|
5
|
+
rdoc
|
6
|
+
|
7
|
+
# yard generated
|
8
|
+
doc
|
9
|
+
.yardoc
|
10
|
+
|
11
|
+
# bundler
|
12
|
+
.bundle
|
13
|
+
|
14
|
+
# jeweler generated
|
15
|
+
pkg
|
16
|
+
|
17
|
+
# Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
|
18
|
+
#
|
19
|
+
# * Create a file at ~/.gitignore
|
20
|
+
# * Include files you want ignored
|
21
|
+
# * Run: git config --global core.excludesfile ~/.gitignore
|
22
|
+
#
|
23
|
+
# After doing this, these files will be ignored in all your git projects,
|
24
|
+
# saving you from having to 'pollute' every project you touch with them
|
25
|
+
#
|
26
|
+
# Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
|
27
|
+
#
|
28
|
+
# For MacOS:
|
29
|
+
#
|
30
|
+
#.DS_Store
|
31
|
+
|
32
|
+
# For TextMate
|
33
|
+
#*.tmproj
|
34
|
+
#tmtags
|
35
|
+
|
36
|
+
# For emacs:
|
37
|
+
#*~
|
38
|
+
#\#*
|
39
|
+
#.\#*
|
40
|
+
|
41
|
+
# For vim:
|
42
|
+
#*.swp
|
43
|
+
|
44
|
+
# For redcar:
|
45
|
+
#.redcar
|
46
|
+
|
47
|
+
# For rubinius:
|
48
|
+
#*.rbc
|
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm use ruby-1.9.2@duckstrings
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
diff-lcs (1.1.3)
|
5
|
+
git (1.2.5)
|
6
|
+
jeweler (1.6.4)
|
7
|
+
bundler (~> 1.0)
|
8
|
+
git (>= 1.2.5)
|
9
|
+
rake
|
10
|
+
rake (0.9.2)
|
11
|
+
rcov (0.9.11)
|
12
|
+
rspec (2.3.0)
|
13
|
+
rspec-core (~> 2.3.0)
|
14
|
+
rspec-expectations (~> 2.3.0)
|
15
|
+
rspec-mocks (~> 2.3.0)
|
16
|
+
rspec-core (2.3.1)
|
17
|
+
rspec-expectations (2.3.0)
|
18
|
+
diff-lcs (~> 1.1.2)
|
19
|
+
rspec-mocks (2.3.0)
|
20
|
+
|
21
|
+
PLATFORMS
|
22
|
+
ruby
|
23
|
+
|
24
|
+
DEPENDENCIES
|
25
|
+
bundler (~> 1.0.0)
|
26
|
+
jeweler (~> 1.6.4)
|
27
|
+
rcov
|
28
|
+
rspec (~> 2.3.0)
|
data/README.md
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
+
gem.name = "duckstrings"
|
18
|
+
gem.homepage = "http://fogus.me/fun"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = %Q{Hardcore docstrings for Ruby}
|
21
|
+
gem.description = %Q{TODO: longer description of your gem}
|
22
|
+
gem.email = "me[at]fogus[dot]me"
|
23
|
+
gem.authors = ["fogus"]
|
24
|
+
# dependencies defined in Gemfile
|
25
|
+
end
|
26
|
+
Jeweler::RubygemsDotOrgTasks.new
|
27
|
+
|
28
|
+
require 'rspec/core'
|
29
|
+
require 'rspec/core/rake_task'
|
30
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
31
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
32
|
+
end
|
33
|
+
|
34
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
35
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
36
|
+
spec.rcov = true
|
37
|
+
end
|
38
|
+
|
39
|
+
task :default => :spec
|
40
|
+
|
41
|
+
require 'rake/rdoctask'
|
42
|
+
Rake::RDocTask.new do |rdoc|
|
43
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
44
|
+
|
45
|
+
rdoc.rdoc_dir = 'rdoc'
|
46
|
+
rdoc.title = "duckstrings #{version}"
|
47
|
+
rdoc.rdoc_files.include('README*')
|
48
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
49
|
+
end
|
data/duckstrings.gemspec
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require File.expand_path('../lib/duckstrings/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.name = 'duckstrings'
|
6
|
+
gem.description = %q{Hardcore docstrings for Ruby.}
|
7
|
+
gem.authors = ['Fogus']
|
8
|
+
gem.email = ['me-at-fogus-dot-me']
|
9
|
+
|
10
|
+
gem.version = Duckstrings::VERSION
|
11
|
+
gem.files = `git ls-files`.split("\n")
|
12
|
+
gem.homepage = 'http://github.com/fogus/Duckstrings'
|
13
|
+
gem.require_paths = ['lib']
|
14
|
+
gem.required_rubygems_version = Gem::Requirement.new('>= 1.3.6') if gem.respond_to? :required_rubygems_version=
|
15
|
+
gem.summary = gem.description
|
16
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
|
+
end
|
data/lib/duckstrings.rb
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
class Module
|
2
|
+
def ___ ds
|
3
|
+
@last_docstring = ds
|
4
|
+
end
|
5
|
+
|
6
|
+
def describe &printer
|
7
|
+
printer_impl = printer || lambda { |method_name|
|
8
|
+
20.times { print '-' }
|
9
|
+
puts
|
10
|
+
|
11
|
+
puts "#{self.inspect}##{method_name.to_s}"
|
12
|
+
puts "(args go here)"
|
13
|
+
puts " #{self.doc_for method_name}"
|
14
|
+
puts
|
15
|
+
}
|
16
|
+
|
17
|
+
puts "Instance Methods"
|
18
|
+
(self.instance_methods - Object.instance_methods).sort.each &printer_impl
|
19
|
+
|
20
|
+
puts "Class Methods"
|
21
|
+
(self.methods - Object.methods).sort.each &printer_impl
|
22
|
+
|
23
|
+
@docstrings.count
|
24
|
+
end
|
25
|
+
|
26
|
+
def doc_for method_name
|
27
|
+
@docstrings[method_name] # || (class << self; self; end).ancestors.find do |kind|
|
28
|
+
# if desc = kind.doc_for(method_name)
|
29
|
+
# return desc
|
30
|
+
# end
|
31
|
+
# end
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
alias old_method_added method_added
|
37
|
+
|
38
|
+
def do_magic method_name
|
39
|
+
if defined? @last_docstring
|
40
|
+
(@docstrings ||= {})[method_name] = @last_docstring
|
41
|
+
@last_docstring = nil
|
42
|
+
end
|
43
|
+
|
44
|
+
old_method_added method_name
|
45
|
+
end
|
46
|
+
|
47
|
+
def singleton_method_added method_name
|
48
|
+
do_magic method_name
|
49
|
+
end
|
50
|
+
|
51
|
+
def method_added method_name
|
52
|
+
do_magic method_name
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
<<-philos
|
57
|
+
Fogus refers first to Nietzsche and his figure of thought that all interactions and interpretations of the external world through the lens of an individual perspective are completed. Even something like "truth" is therefore subject to constant interpretation, occupational change, and the intake of alternative viewpoints is essential in order to reach a higher level of knowledge.
|
58
|
+
|
59
|
+
For the transmission of this figure of thought on the IT world Fogus notes that just a software developer of industry-high standards and best practices are shaped, are ultimately subjective in nature. Were strongly dependent on the subjective views of the developers of one's own history of the learned languages, and here comes again programming pioneer Alan Perlis into play...
|
60
|
+
philos
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
class Foo
|
4
|
+
___ "Ants!"
|
5
|
+
def self.bar
|
6
|
+
"blah"
|
7
|
+
end
|
8
|
+
|
9
|
+
___ "Monkeys!"
|
10
|
+
def baz
|
11
|
+
"boop"
|
12
|
+
end
|
13
|
+
|
14
|
+
def qux x
|
15
|
+
[x]
|
16
|
+
end
|
17
|
+
|
18
|
+
class << self
|
19
|
+
___ "Chins!"
|
20
|
+
def frob x, y
|
21
|
+
[x,y]
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe "Foo" do
|
27
|
+
it "has the expected docstrings" do
|
28
|
+
Foo.doc_for(:bar).should == "Ants!"
|
29
|
+
Foo.doc_for(:baz).should == "Monkeys!"
|
30
|
+
Foo.doc_for(:qux).should be_nil
|
31
|
+
Foo.describe
|
32
|
+
end
|
33
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -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 'duckstrings'
|
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,62 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: duckstrings
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Fogus
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-11-22 00:00:00.000000000 -05:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
description: Hardcore docstrings for Ruby.
|
16
|
+
email:
|
17
|
+
- me-at-fogus-dot-me
|
18
|
+
executables: []
|
19
|
+
extensions: []
|
20
|
+
extra_rdoc_files: []
|
21
|
+
files:
|
22
|
+
- .document
|
23
|
+
- .gitignore
|
24
|
+
- .rspec
|
25
|
+
- .rvmrc
|
26
|
+
- Gemfile
|
27
|
+
- Gemfile.lock
|
28
|
+
- README.md
|
29
|
+
- Rakefile
|
30
|
+
- duckstrings.gemspec
|
31
|
+
- lib/duckstrings.rb
|
32
|
+
- lib/duckstrings/version.rb
|
33
|
+
- spec/duckstrings_spec.rb
|
34
|
+
- spec/spec_helper.rb
|
35
|
+
has_rdoc: true
|
36
|
+
homepage: http://github.com/fogus/Duckstrings
|
37
|
+
licenses: []
|
38
|
+
post_install_message:
|
39
|
+
rdoc_options: []
|
40
|
+
require_paths:
|
41
|
+
- lib
|
42
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 1.3.6
|
54
|
+
requirements: []
|
55
|
+
rubyforge_project:
|
56
|
+
rubygems_version: 1.6.2
|
57
|
+
signing_key:
|
58
|
+
specification_version: 3
|
59
|
+
summary: Hardcore docstrings for Ruby.
|
60
|
+
test_files:
|
61
|
+
- spec/duckstrings_spec.rb
|
62
|
+
- spec/spec_helper.rb
|