darkext 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/History.txt +140 -0
- data/LICENSE +21 -0
- data/README.md +45 -0
- data/Rakefile +45 -0
- data/TODO +4 -0
- data/VERSION.yml +4 -0
- data/app_generators/sinatra_app_generator.rb +57 -0
- data/app_generators/templates/app.rb +16 -0
- data/app_generators/templates/config.ru +2 -0
- data/app_generators/templates/error.rb +8 -0
- data/app_generators/templates/gitignore +0 -0
- data/app_generators/templates/helpers.rb +12 -0
- data/app_generators/templates/http_method.rb +8 -0
- data/app_generators/templates/options.rb +9 -0
- data/bin/sinatra-app +14 -0
- data/darkext.gemspec +105 -0
- data/lib/darkext.rb +13 -0
- data/lib/darkext/array.rb +52 -0
- data/lib/darkext/beagle.rb +88 -0
- data/lib/darkext/boolean.rb +17 -0
- data/lib/darkext/fiber.rb +48 -0
- data/lib/darkext/float.rb +6 -0
- data/lib/darkext/hash.rb +38 -0
- data/lib/darkext/integer.rb +10 -0
- data/lib/darkext/io.rb +37 -0
- data/lib/darkext/net.rb +28 -0
- data/lib/darkext/numeric.rb +35 -0
- data/lib/darkext/object.rb +11 -0
- data/lib/darkext/sinatra.rb +70 -0
- data/lib/darkext/sitemap_generator.rb +90 -0
- data/lib/darkext/statistics.rb +197 -0
- data/lib/darkext/string.rb +63 -0
- data/lib/darkext/symbol.rb +7 -0
- data/spec/array_spec.rb +112 -0
- data/spec/beagle_spec.rb +42 -0
- data/spec/boolean_spec.rb +53 -0
- data/spec/fiber_spec.rb +35 -0
- data/spec/float_spec.rb +18 -0
- data/spec/hash_spec.rb +26 -0
- data/spec/integer_spec.rb +22 -0
- data/spec/io_spec.rb +44 -0
- data/spec/net_spec.rb +23 -0
- data/spec/numeric_spec.rb +52 -0
- data/spec/object_spec.rb +28 -0
- data/spec/spec.opts +3 -0
- data/spec/spec_helper.rb +13 -0
- data/spec/statistics_spec.rb +162 -0
- data/spec/string_spec.rb +54 -0
- data/spec/symbol_spec.rb +16 -0
- metadata +119 -0
data/.gitignore
ADDED
data/History.txt
ADDED
@@ -0,0 +1,140 @@
|
|
1
|
+
== 0.9.7 2009-3-2
|
2
|
+
|
3
|
+
* Close when done fiber
|
4
|
+
|
5
|
+
== 0.9.6 2009-3-2
|
6
|
+
|
7
|
+
* Remove printn
|
8
|
+
|
9
|
+
== 0.9.5 2009-3-2
|
10
|
+
|
11
|
+
* add fibers
|
12
|
+
* add string#ends_with? and string#starts_with?
|
13
|
+
* make beagle not suck as much, but still suck a bit
|
14
|
+
* don't load sitemap_generator on include
|
15
|
+
|
16
|
+
== 0.9.4 2009-2-27
|
17
|
+
|
18
|
+
* Speed up beagle a bit...
|
19
|
+
|
20
|
+
== 0.9.3 2009-2-27
|
21
|
+
|
22
|
+
* Download open/write any file if not HTTPOK
|
23
|
+
|
24
|
+
== 0.9.2 2009-2-27
|
25
|
+
|
26
|
+
* Few fixes
|
27
|
+
|
28
|
+
== 0.9.1 2009-2-26
|
29
|
+
|
30
|
+
* go back to regular partial
|
31
|
+
|
32
|
+
== 0.9.0 2009-2-26
|
33
|
+
|
34
|
+
* fix and let's release a new minor
|
35
|
+
|
36
|
+
== 0.8.7 2009-2-25
|
37
|
+
|
38
|
+
* Stupid $end
|
39
|
+
|
40
|
+
== 0.8.6 2009-2-25
|
41
|
+
|
42
|
+
* better partials
|
43
|
+
|
44
|
+
== 0.8.5 2009-2-25
|
45
|
+
|
46
|
+
* enable(:sessions) for sinatra stuff since flash needs it
|
47
|
+
|
48
|
+
== 0.8.4 2009-2-24
|
49
|
+
|
50
|
+
* Add slash prefix option
|
51
|
+
|
52
|
+
== 0.8.3 2009-2-23
|
53
|
+
|
54
|
+
* Fix up sinatra stuff to be extensions
|
55
|
+
* Don't include sinatra stuff by default. you must require explicitly.
|
56
|
+
|
57
|
+
== 0.8.2 2009-2-21
|
58
|
+
|
59
|
+
* Okay the one needed to be there...
|
60
|
+
|
61
|
+
== 0.8.1 2009-2-21
|
62
|
+
|
63
|
+
* Get rid of stupid variables in sinatra helpers
|
64
|
+
|
65
|
+
== 0.8.0 2009-2-20
|
66
|
+
|
67
|
+
* Fixed Beagle stuff indexing everything instead of just files
|
68
|
+
* Added sinatra helpers
|
69
|
+
|
70
|
+
== 0.7.2 2009-2-14
|
71
|
+
|
72
|
+
* Added running? and status to Beagle module
|
73
|
+
|
74
|
+
== 0.7.1 2009-2-14
|
75
|
+
|
76
|
+
* Added printn to String
|
77
|
+
|
78
|
+
== 0.7.0 2009-2-14
|
79
|
+
|
80
|
+
* Added Beagle module for working with the beagle index and search daemon
|
81
|
+
|
82
|
+
== 0.6.0 2009-2-11
|
83
|
+
|
84
|
+
* Added additions to Net module to download and download and save files
|
85
|
+
|
86
|
+
== 0.5.6 2009-2-11
|
87
|
+
|
88
|
+
* Fixed bug in string
|
89
|
+
|
90
|
+
== 0.5.5 2009-2-11
|
91
|
+
|
92
|
+
* Fixed a string thing so you can do ranges with letters too
|
93
|
+
* Fixed a capture IO thing
|
94
|
+
|
95
|
+
== 0.5.4 2009-1-25
|
96
|
+
|
97
|
+
* Added some new fun things to hash (nested_find, among others)
|
98
|
+
* Add sitemap builder for phpBB sites (infancy, but it works)
|
99
|
+
|
100
|
+
== 0.5.3 2009-1-18
|
101
|
+
|
102
|
+
* Move float stuff to its own file
|
103
|
+
* Add geometric standard deviation
|
104
|
+
|
105
|
+
== 0.5.2 2009-1-11
|
106
|
+
|
107
|
+
* Add root method to Numeric
|
108
|
+
* Add equals? to Float with tolerance
|
109
|
+
* Add harmonic mean and geometric mean
|
110
|
+
|
111
|
+
== 0.4.0 2008-12-2
|
112
|
+
|
113
|
+
* Fix some statistics stuff
|
114
|
+
* Move stats into proper module
|
115
|
+
* New sum_of_squares method on array to calculate sum((v - v_bar)^2)
|
116
|
+
|
117
|
+
== 0.3.2 2008-11-26
|
118
|
+
|
119
|
+
* Add print method on String
|
120
|
+
|
121
|
+
== 0.3.1 2008-11-25
|
122
|
+
|
123
|
+
* Added destructive randomize! to array
|
124
|
+
* Added check to Symbol#to_proc to only define if not respond_to?
|
125
|
+
|
126
|
+
== 0.3.0 2008-11-24
|
127
|
+
|
128
|
+
* Added factorial method to Integer
|
129
|
+
* Added cube method to Numeric
|
130
|
+
|
131
|
+
== 0.2.0 2008-11-24
|
132
|
+
|
133
|
+
* Added Regression module to Statistics
|
134
|
+
* Only method thus far is least_squares
|
135
|
+
* Aliased some methods on arrays in Statistics module
|
136
|
+
|
137
|
+
== 0.0.1 2008-11-21
|
138
|
+
|
139
|
+
* 1 major enhancement:
|
140
|
+
* Initial release
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2009 Daniel Huckstep
|
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
|
13
|
+
all 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
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# darkext
|
2
|
+
|
3
|
+
## DESCRIPTION:
|
4
|
+
|
5
|
+
Just some useful Ruby functionality. No particular focus, except usefulness
|
6
|
+
|
7
|
+
## FEATURES:
|
8
|
+
|
9
|
+
* Adds to Array
|
10
|
+
* rotate, rotate_reverse
|
11
|
+
* sum, product
|
12
|
+
* squares, squares!
|
13
|
+
* random, randomize, randomize!
|
14
|
+
* Adds to TrueClass and FalseClass
|
15
|
+
* intern
|
16
|
+
* Adds to Hash
|
17
|
+
* with_defaults, with_defaults!
|
18
|
+
* Adds to Integer
|
19
|
+
* fact
|
20
|
+
* Adds to Numeric
|
21
|
+
* square, cube
|
22
|
+
* sqrt
|
23
|
+
* ln, log
|
24
|
+
* Adds to Object
|
25
|
+
* try
|
26
|
+
* is_boolean?
|
27
|
+
* Adds to String
|
28
|
+
* to_range
|
29
|
+
* exec
|
30
|
+
* print
|
31
|
+
* Adds IO package
|
32
|
+
* Adds statistical package
|
33
|
+
|
34
|
+
## USAGE:
|
35
|
+
|
36
|
+
$ require 'darkext'
|
37
|
+
|
38
|
+
## INSTALLATION:
|
39
|
+
|
40
|
+
* $ gem sources -a http://gems.github.com # unless you already have done this
|
41
|
+
* $ gem install darkhelmet-darkext
|
42
|
+
|
43
|
+
## LICENSE:
|
44
|
+
|
45
|
+
See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'rake'
|
2
|
+
|
3
|
+
begin
|
4
|
+
require 'jeweler'
|
5
|
+
Jeweler::Tasks.new do |s|
|
6
|
+
s.name = 'darkext'
|
7
|
+
s.summary = %q{Just some useful Ruby functionality}
|
8
|
+
s.email = 'darkhelmet@darkhelmetlive.com'
|
9
|
+
s.homepage = 'http://github.com/darkhelmet/darkext'
|
10
|
+
s.description = %q{Just some useful Ruby functionality. No particular focus, except usefulness}
|
11
|
+
s.authors = ['Daniel Huckstep']
|
12
|
+
end
|
13
|
+
rescue LoadError
|
14
|
+
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
15
|
+
end
|
16
|
+
|
17
|
+
require 'rake/rdoctask'
|
18
|
+
Rake::RDocTask.new do |rdoc|
|
19
|
+
rdoc.rdoc_dir = 'rdoc'
|
20
|
+
rdoc.title = 'foo'
|
21
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
22
|
+
rdoc.rdoc_files.include('README*')
|
23
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
24
|
+
end
|
25
|
+
|
26
|
+
begin
|
27
|
+
require 'rcov/rcovtask'
|
28
|
+
Rcov::RcovTask.new do |t|
|
29
|
+
t.test_files = FileList['test/**/*_test.rb']
|
30
|
+
t.verbose = true
|
31
|
+
end
|
32
|
+
rescue LoadError
|
33
|
+
puts 'RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov'
|
34
|
+
end
|
35
|
+
|
36
|
+
begin
|
37
|
+
require 'spec/rake/spectask'
|
38
|
+
Spec::Rake::SpecTask.new do |t|
|
39
|
+
t.spec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""]
|
40
|
+
end
|
41
|
+
rescue LoadError
|
42
|
+
puts 'rspec is not available. In order to run rspec, you must: sudo gem install rspec'
|
43
|
+
end
|
44
|
+
|
45
|
+
task :default => :spec
|
data/TODO
ADDED
data/VERSION.yml
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'rbconfig'
|
2
|
+
|
3
|
+
class SinatraAppGenerator < RubiGen::Base
|
4
|
+
DEFAULT_SHEBANG = File.join(Config::CONFIG['bindir'],
|
5
|
+
Config::CONFIG['ruby_install_name'])
|
6
|
+
|
7
|
+
default_options(:shebang => DEFAULT_SHEBANG)
|
8
|
+
|
9
|
+
attr_accessor :app_name, :module_name, :app_name_fixed
|
10
|
+
|
11
|
+
def initialize(runtime_args, runtime_options = {})
|
12
|
+
super
|
13
|
+
usage if args.empty?
|
14
|
+
@destination_root = args.shift
|
15
|
+
self.app_name = File.basename(File.expand_path(@destination_root))
|
16
|
+
self.app_name_fixed = self.app_name.split('-').map(&:capitalize).join
|
17
|
+
self.module_name = app_name.camelize
|
18
|
+
end
|
19
|
+
|
20
|
+
def manifest
|
21
|
+
# Use /usr/bin/env if no special shebang was specified
|
22
|
+
script_options = { :chmod => 0755, :shebang => options[:shebang] == DEFAULT_SHEBANG ? nil : options[:shebang] }
|
23
|
+
windows = (RUBY_PLATFORM =~ /dos|win32|cygwin/i) || (RUBY_PLATFORM =~ /(:?mswin|mingw)/)
|
24
|
+
|
25
|
+
record do |m|
|
26
|
+
# Root directory and all subdirectories.
|
27
|
+
m.directory('')
|
28
|
+
%w(lib public views tmp).each { |path| m.directory(path) }
|
29
|
+
%w(get put post delete).each do |path|
|
30
|
+
m.template('http_method.rb',
|
31
|
+
"lib/#{path}.rb",
|
32
|
+
:assigns => { :method => path })
|
33
|
+
end
|
34
|
+
m.template('helpers.rb', 'lib/helpers.rb')
|
35
|
+
m.template('options.rb', 'lib/options.rb')
|
36
|
+
m.template('error.rb', 'lib/error.rb')
|
37
|
+
m.template('app.rb', "#{app_name}.rb", script_options)
|
38
|
+
m.template('gitignore', '.gitignore')
|
39
|
+
m.template('gitignore', 'tmp/.gitignore')
|
40
|
+
m.template('config.ru', 'config.ru')
|
41
|
+
#m.dependency "install_rubigen_scripts", [destination_root, "rubygems"], :shebang => options[:shebang]
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
protected
|
46
|
+
def banner
|
47
|
+
"Create a stub for #{File.basename $0} to get started."
|
48
|
+
end
|
49
|
+
|
50
|
+
def add_options!(opts)
|
51
|
+
opts.separator ''
|
52
|
+
opts.separator 'Options:'
|
53
|
+
opts.on("-r", "--ruby=path", String,
|
54
|
+
"Path to the Ruby binary of your choice (otherwise scripts use env, dispatchers current path).",
|
55
|
+
"Default: #{DEFAULT_SHEBANG}") { |v| options[:shebang] = v }
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
%w(rubygems haml sinatra/base darkext darkext/sinatra).each { |lib| require lib }
|
4
|
+
Dir['lib/*.rb'].each { |file| load file }
|
5
|
+
|
6
|
+
load 'local_options.rb' if File.exists?('local_options.rb')
|
7
|
+
|
8
|
+
class <%= app_name_fixed %>Site < Sinatra::Default
|
9
|
+
set(:app_file, File.expand_path(__FILE__))
|
10
|
+
register Sinatra::DarkHelpers
|
11
|
+
<% for lib in %w(Options Helpers Error Get Post Put Delete) %>
|
12
|
+
register Sinatra::<%= app_name_fixed %><%= lib %><% end %>
|
13
|
+
register Sinatra::LocalOptions unless defined?(Sinatra::LocalOptions).nil?
|
14
|
+
end
|
15
|
+
|
16
|
+
<%= app_name_fixed %>Site.run! if __FILE__ == $0
|
File without changes
|
data/bin/sinatra-app
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'rubigen'
|
5
|
+
|
6
|
+
if %w(-v --version).include? ARGV.first
|
7
|
+
require 'newgem/version'
|
8
|
+
puts "#{File.basename($0)} #{Newgem::VERSION}"
|
9
|
+
exit(0)
|
10
|
+
end
|
11
|
+
|
12
|
+
require 'rubigen/scripts/generate'
|
13
|
+
RubiGen::Base.use_application_sources!
|
14
|
+
RubiGen::Scripts::Generate.new.run(ARGV, :generator => 'SinatraApp')
|
data/darkext.gemspec
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE
|
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{darkext}
|
8
|
+
s.version = "0.12.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Daniel Huckstep"]
|
12
|
+
s.date = %q{2009-08-11}
|
13
|
+
s.default_executable = %q{sinatra-app}
|
14
|
+
s.description = %q{Just some useful Ruby functionality. No particular focus, except usefulness}
|
15
|
+
s.email = %q{darkhelmet@darkhelmetlive.com}
|
16
|
+
s.executables = ["sinatra-app"]
|
17
|
+
s.extra_rdoc_files = [
|
18
|
+
"LICENSE",
|
19
|
+
"README.md"
|
20
|
+
]
|
21
|
+
s.files = [
|
22
|
+
".gitignore",
|
23
|
+
"History.txt",
|
24
|
+
"LICENSE",
|
25
|
+
"README.md",
|
26
|
+
"Rakefile",
|
27
|
+
"TODO",
|
28
|
+
"VERSION.yml",
|
29
|
+
"app_generators/sinatra_app_generator.rb",
|
30
|
+
"app_generators/templates/app.rb",
|
31
|
+
"app_generators/templates/config.ru",
|
32
|
+
"app_generators/templates/error.rb",
|
33
|
+
"app_generators/templates/gitignore",
|
34
|
+
"app_generators/templates/helpers.rb",
|
35
|
+
"app_generators/templates/http_method.rb",
|
36
|
+
"app_generators/templates/options.rb",
|
37
|
+
"bin/sinatra-app",
|
38
|
+
"darkext.gemspec",
|
39
|
+
"lib/darkext.rb",
|
40
|
+
"lib/darkext/array.rb",
|
41
|
+
"lib/darkext/beagle.rb",
|
42
|
+
"lib/darkext/boolean.rb",
|
43
|
+
"lib/darkext/fiber.rb",
|
44
|
+
"lib/darkext/float.rb",
|
45
|
+
"lib/darkext/hash.rb",
|
46
|
+
"lib/darkext/integer.rb",
|
47
|
+
"lib/darkext/io.rb",
|
48
|
+
"lib/darkext/net.rb",
|
49
|
+
"lib/darkext/numeric.rb",
|
50
|
+
"lib/darkext/object.rb",
|
51
|
+
"lib/darkext/sinatra.rb",
|
52
|
+
"lib/darkext/sitemap_generator.rb",
|
53
|
+
"lib/darkext/statistics.rb",
|
54
|
+
"lib/darkext/string.rb",
|
55
|
+
"lib/darkext/symbol.rb",
|
56
|
+
"spec/array_spec.rb",
|
57
|
+
"spec/beagle_spec.rb",
|
58
|
+
"spec/boolean_spec.rb",
|
59
|
+
"spec/fiber_spec.rb",
|
60
|
+
"spec/float_spec.rb",
|
61
|
+
"spec/hash_spec.rb",
|
62
|
+
"spec/integer_spec.rb",
|
63
|
+
"spec/io_spec.rb",
|
64
|
+
"spec/net_spec.rb",
|
65
|
+
"spec/numeric_spec.rb",
|
66
|
+
"spec/object_spec.rb",
|
67
|
+
"spec/spec.opts",
|
68
|
+
"spec/spec_helper.rb",
|
69
|
+
"spec/statistics_spec.rb",
|
70
|
+
"spec/string_spec.rb",
|
71
|
+
"spec/symbol_spec.rb"
|
72
|
+
]
|
73
|
+
s.homepage = %q{http://github.com/darkhelmet/darkext}
|
74
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
75
|
+
s.require_paths = ["lib"]
|
76
|
+
s.rubygems_version = %q{1.3.5}
|
77
|
+
s.summary = %q{Just some useful Ruby functionality}
|
78
|
+
s.test_files = [
|
79
|
+
"spec/array_spec.rb",
|
80
|
+
"spec/beagle_spec.rb",
|
81
|
+
"spec/boolean_spec.rb",
|
82
|
+
"spec/fiber_spec.rb",
|
83
|
+
"spec/float_spec.rb",
|
84
|
+
"spec/hash_spec.rb",
|
85
|
+
"spec/integer_spec.rb",
|
86
|
+
"spec/io_spec.rb",
|
87
|
+
"spec/net_spec.rb",
|
88
|
+
"spec/numeric_spec.rb",
|
89
|
+
"spec/object_spec.rb",
|
90
|
+
"spec/statistics_spec.rb",
|
91
|
+
"spec/string_spec.rb",
|
92
|
+
"spec/symbol_spec.rb",
|
93
|
+
"spec/spec_helper.rb"
|
94
|
+
]
|
95
|
+
|
96
|
+
if s.respond_to? :specification_version then
|
97
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
98
|
+
s.specification_version = 3
|
99
|
+
|
100
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
101
|
+
else
|
102
|
+
end
|
103
|
+
else
|
104
|
+
end
|
105
|
+
end
|