auser-dslify 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- metadata +5 -41
- data/History.txt +0 -4
- data/Manifest.txt +0 -34
- data/PostInstall.txt +0 -5
- data/README.txt +0 -60
- data/Rakefile +0 -69
- data/config/hoe.rb +0 -73
- data/config/requirements.rb +0 -15
- data/dslify.gemspec +0 -38
- data/lib/dslify/core/object.rb +0 -15
- data/lib/dslify/core/string.rb +0 -12
- data/lib/dslify/core.rb +0 -1
- data/lib/dslify/modules/configurable.rb +0 -33
- data/lib/dslify/modules/method_missing_sugar.rb +0 -21
- data/lib/dslify/modules.rb +0 -4
- data/lib/dslify/version.rb +0 -10
- data/lib/dslify.rb +0 -12
- data/script/console +0 -10
- data/script/destroy +0 -14
- data/script/generate +0 -14
- data/script/txt2html +0 -82
- data/setup.rb +0 -1585
- data/spec/configureable_spec.rb +0 -29
- data/spec/method_missing_spec.rb +0 -20
- data/spec/spec_helper.rb +0 -14
- data/tasks/deployment.rake +0 -34
- data/tasks/environment.rake +0 -7
- data/tasks/website.rake +0 -17
- data/website/index.html +0 -11
- data/website/index.txt +0 -83
- data/website/javascripts/rounded_corners_lite.inc.js +0 -285
- data/website/stylesheets/screen.css +0 -138
- data/website/template.html.erb +0 -48
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: auser-dslify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ari Lerner
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2009-01-27 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
requirements:
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 1.8.
|
22
|
+
version: 1.8.0
|
23
23
|
version:
|
24
24
|
description: Easily add DSL-like calls to any class
|
25
25
|
email:
|
@@ -28,47 +28,11 @@ executables: []
|
|
28
28
|
|
29
29
|
extensions: []
|
30
30
|
|
31
|
-
extra_rdoc_files:
|
32
|
-
|
33
|
-
- Manifest.txt
|
34
|
-
- PostInstall.txt
|
35
|
-
- README.txt
|
36
|
-
- website/index.txt
|
31
|
+
extra_rdoc_files: []
|
32
|
+
|
37
33
|
files:
|
38
|
-
- History.txt
|
39
|
-
- Manifest.txt
|
40
|
-
- PostInstall.txt
|
41
|
-
- README.txt
|
42
|
-
- Rakefile
|
43
|
-
- config/hoe.rb
|
44
|
-
- config/requirements.rb
|
45
|
-
- dslify.gemspec
|
46
|
-
- lib/dslify.rb
|
47
|
-
- lib/dslify/core.rb
|
48
|
-
- lib/dslify/core/object.rb
|
49
|
-
- lib/dslify/core/string.rb
|
50
|
-
- lib/dslify/modules.rb
|
51
|
-
- lib/dslify/modules/configurable.rb
|
52
|
-
- lib/dslify/modules/method_missing_sugar.rb
|
53
|
-
- lib/dslify/version.rb
|
54
|
-
- script/console
|
55
|
-
- script/destroy
|
56
|
-
- script/generate
|
57
|
-
- script/txt2html
|
58
|
-
- setup.rb
|
59
|
-
- spec/configureable_spec.rb
|
60
|
-
- spec/method_missing_spec.rb
|
61
|
-
- spec/spec_helper.rb
|
62
|
-
- tasks/deployment.rake
|
63
|
-
- tasks/environment.rake
|
64
|
-
- tasks/website.rake
|
65
34
|
- test/test_dslify.rb
|
66
35
|
- test/test_helper.rb
|
67
|
-
- website/index.html
|
68
|
-
- website/index.txt
|
69
|
-
- website/javascripts/rounded_corners_lite.inc.js
|
70
|
-
- website/stylesheets/screen.css
|
71
|
-
- website/template.html.erb
|
72
36
|
has_rdoc: true
|
73
37
|
homepage: http://dslify.rubyforge.org
|
74
38
|
post_install_message: |-
|
data/History.txt
DELETED
data/Manifest.txt
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
History.txt
|
2
|
-
Manifest.txt
|
3
|
-
PostInstall.txt
|
4
|
-
README.txt
|
5
|
-
Rakefile
|
6
|
-
config/hoe.rb
|
7
|
-
config/requirements.rb
|
8
|
-
dslify.gemspec
|
9
|
-
lib/dslify.rb
|
10
|
-
lib/dslify/core.rb
|
11
|
-
lib/dslify/core/object.rb
|
12
|
-
lib/dslify/core/string.rb
|
13
|
-
lib/dslify/modules.rb
|
14
|
-
lib/dslify/modules/configurable.rb
|
15
|
-
lib/dslify/modules/method_missing_sugar.rb
|
16
|
-
lib/dslify/version.rb
|
17
|
-
script/console
|
18
|
-
script/destroy
|
19
|
-
script/generate
|
20
|
-
script/txt2html
|
21
|
-
setup.rb
|
22
|
-
spec/configureable_spec.rb
|
23
|
-
spec/method_missing_spec.rb
|
24
|
-
spec/spec_helper.rb
|
25
|
-
tasks/deployment.rake
|
26
|
-
tasks/environment.rake
|
27
|
-
tasks/website.rake
|
28
|
-
test/test_dslify.rb
|
29
|
-
test/test_helper.rb
|
30
|
-
website/index.html
|
31
|
-
website/index.txt
|
32
|
-
website/javascripts/rounded_corners_lite.inc.js
|
33
|
-
website/stylesheets/screen.css
|
34
|
-
website/template.html.erb
|
data/PostInstall.txt
DELETED
data/README.txt
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
= dslify
|
2
|
-
|
3
|
-
== DESCRIPTION:
|
4
|
-
|
5
|
-
Easily add DSL accessors to any class without bothering to mess with the gory details of their implementation
|
6
|
-
|
7
|
-
== SYNOPSIS:
|
8
|
-
|
9
|
-
Simply add Dslify to your class, like so:
|
10
|
-
class MyClass
|
11
|
-
include Dslify
|
12
|
-
end
|
13
|
-
|
14
|
-
Then, you can call *any* method on your object and, if it is not a method on the instance, it will set the value on the class as an option. Note, you can always check these by checking out the options on the object.
|
15
|
-
|
16
|
-
instance = MyClass.new
|
17
|
-
instance.name #=> nil
|
18
|
-
instance.name "frank"
|
19
|
-
instance.name #=> "frank"
|
20
|
-
|
21
|
-
You can also define default values with the singleton method:
|
22
|
-
default_options({:name => "bob"})
|
23
|
-
|
24
|
-
instance = MyClass.new
|
25
|
-
instance.name #=> "bob"
|
26
|
-
instance.name "frank"
|
27
|
-
instance.name #=> "frank"
|
28
|
-
|
29
|
-
== REQUIREMENTS:
|
30
|
-
|
31
|
-
ruby
|
32
|
-
|
33
|
-
== INSTALL:
|
34
|
-
|
35
|
-
sudo gem install auser-dslify
|
36
|
-
|
37
|
-
== LICENSE:
|
38
|
-
|
39
|
-
(The MIT License)
|
40
|
-
|
41
|
-
Copyright (c) 2008 Ari Lerner
|
42
|
-
|
43
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
44
|
-
a copy of this software and associated documentation files (the
|
45
|
-
'Software'), to deal in the Software without restriction, including
|
46
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
47
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
48
|
-
permit persons to whom the Software is furnished to do so, subject to
|
49
|
-
the following conditions:
|
50
|
-
|
51
|
-
The above copyright notice and this permission notice shall be
|
52
|
-
included in all copies or substantial portions of the Software.
|
53
|
-
|
54
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
55
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
56
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
57
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
58
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
59
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
60
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
require 'config/requirements'
|
2
|
-
require 'config/hoe' # setup Hoe + all gem configuration
|
3
|
-
|
4
|
-
Dir['tasks/**/*.rake'].each { |rake| load rake }
|
5
|
-
|
6
|
-
desc "Clean tmp directory"
|
7
|
-
task :clean_tmp do |t|
|
8
|
-
%x[rm #{File.dirname(__FILE__)}/Manifest.txt; touch #{File.dirname(__FILE__)}/Manifest.txt]
|
9
|
-
%w(logs tmp).each do |dir|
|
10
|
-
FileUtils.rm_rf("#{File.dirname(__FILE__)}/#{dir}") if ::File.exists?("#{File.dirname(__FILE__)}/#{dir}")
|
11
|
-
end
|
12
|
-
end
|
13
|
-
desc "Remove the pkg directory"
|
14
|
-
task :clean_pkg do |t|
|
15
|
-
%w(pkg).each do |dir|
|
16
|
-
FileUtils.rm_rf("#{File.dirname(__FILE__)}/#{dir}") if ::File.exists?("#{File.dirname(__FILE__)}/#{dir}")
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
desc "Generate a new manifest and a new gem"
|
21
|
-
task :build_local_gem => [:clean_tmp, :clean_pkg, :"manifest:refresh", :package]
|
22
|
-
|
23
|
-
desc "Packge with timestamp"
|
24
|
-
task :update_timestamp do
|
25
|
-
data = open("PostInstall.txt").read
|
26
|
-
str = "Updated at #{Time.now.strftime("%H:%M %D")}"
|
27
|
-
|
28
|
-
if data.scan(/Updated at/).empty?
|
29
|
-
data = data ^ {:updated_at => str}
|
30
|
-
else
|
31
|
-
data = data.gsub(/just installed PoolParty\!(.*)$/, "just installed PoolParty! (#{str})")
|
32
|
-
end
|
33
|
-
::File.open("PostInstall.txt", "w+") {|f| f << data }
|
34
|
-
end
|
35
|
-
|
36
|
-
desc "Release to github"
|
37
|
-
task :github_release => [:clean_tmp, :clean_pkg, :"manifest:refresh", :update_timestamp, :package] do
|
38
|
-
res = %x[rake debug_gem]
|
39
|
-
res = res.split("\n")[1..-1].join("\n")
|
40
|
-
::File.open("#{GEM_NAME.downcase}.gemspec", "w+") do |f|
|
41
|
-
f << res
|
42
|
-
end
|
43
|
-
`mv #{::File.expand_path(::File.dirname(__FILE__))}/pkg/*.gem #{::File.expand_path(::File.dirname(__FILE__))}/pkg/poolparty.gem`
|
44
|
-
end
|
45
|
-
|
46
|
-
desc "Generate gemspec"
|
47
|
-
task :gemspec => [:clean_tmp, :"manifest:refresh", :build_local_gem] do |t|
|
48
|
-
res = %x[rake debug_gem]
|
49
|
-
res = res.split("\n")[1..-1].join("\n")
|
50
|
-
::File.open("#{GEM_NAME.downcase}.gemspec", "w+") do |f|
|
51
|
-
f << res
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
desc "Generate gemspec for github"
|
56
|
-
task :gh => [:github_release] do
|
57
|
-
filepath = ::File.join(::File.dirname(__FILE__), "poolparty.gemspec")
|
58
|
-
data = open(filepath).read
|
59
|
-
spec = eval("$SAFE = 3\n#{data}")
|
60
|
-
yml = YAML.dump spec
|
61
|
-
File.open(filepath, "w+") do |f|
|
62
|
-
f << yml
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
desc "Generate github gemspec and latest gem"
|
67
|
-
task :ghgem => [:gh] do
|
68
|
-
%x[sudo gem install pkg/poolparty.gem]
|
69
|
-
end
|
data/config/hoe.rb
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
require 'dslify/version'
|
2
|
-
|
3
|
-
AUTHOR = 'Ari Lerner' # can also be an array of Authors
|
4
|
-
EMAIL = "arilerner@mac.com"
|
5
|
-
DESCRIPTION = "Easily add DSL-like calls to any class"
|
6
|
-
GEM_NAME = 'dslify' # what ppl will type to install your gem
|
7
|
-
RUBYFORGE_PROJECT = 'dslify' # The unix name for your project
|
8
|
-
HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
|
9
|
-
DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
|
10
|
-
EXTRA_DEPENDENCIES = [
|
11
|
-
# ['activesupport', '>= 1.3.1']
|
12
|
-
] # An array of rubygem dependencies [name, version]
|
13
|
-
|
14
|
-
@config_file = "~/.rubyforge/user-config.yml"
|
15
|
-
@config = nil
|
16
|
-
RUBYFORGE_USERNAME = "auser"
|
17
|
-
def rubyforge_username
|
18
|
-
unless @config
|
19
|
-
begin
|
20
|
-
@config = YAML.load(File.read(File.expand_path(@config_file)))
|
21
|
-
rescue
|
22
|
-
puts <<-EOS
|
23
|
-
ERROR: No rubyforge config file found: #{@config_file}
|
24
|
-
Run 'rubyforge setup' to prepare your env for access to Rubyforge
|
25
|
-
- See http://newgem.rubyforge.org/rubyforge.html for more details
|
26
|
-
EOS
|
27
|
-
exit
|
28
|
-
end
|
29
|
-
end
|
30
|
-
RUBYFORGE_USERNAME.replace @config["username"]
|
31
|
-
end
|
32
|
-
|
33
|
-
|
34
|
-
REV = nil
|
35
|
-
# UNCOMMENT IF REQUIRED:
|
36
|
-
# REV = YAML.load(`svn info`)['Revision']
|
37
|
-
VERS = Dslify::VERSION::STRING + (REV ? ".#{REV}" : "")
|
38
|
-
RDOC_OPTS = ['--quiet', '--title', 'dslify documentation',
|
39
|
-
"--opname", "index.html",
|
40
|
-
"--line-numbers",
|
41
|
-
"--main", "README",
|
42
|
-
"--inline-source"]
|
43
|
-
|
44
|
-
class Hoe
|
45
|
-
def extra_deps
|
46
|
-
@extra_deps.reject! { |x| Array(x).first == 'hoe' }
|
47
|
-
@extra_deps
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
# Generate all the Rake tasks
|
52
|
-
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
53
|
-
$hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
54
|
-
p.developer(AUTHOR, EMAIL)
|
55
|
-
p.description = DESCRIPTION
|
56
|
-
p.summary = DESCRIPTION
|
57
|
-
p.url = HOMEPATH
|
58
|
-
p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
|
59
|
-
p.test_globs = ["test/**/test_*.rb"]
|
60
|
-
p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
|
61
|
-
|
62
|
-
# == Optional
|
63
|
-
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
64
|
-
#p.extra_deps = EXTRA_DEPENDENCIES
|
65
|
-
|
66
|
-
#p.spec_extras = {} # A hash of extra values to set in the gemspec.
|
67
|
-
end
|
68
|
-
|
69
|
-
CHANGES = $hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
|
70
|
-
PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
|
71
|
-
$hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
|
72
|
-
$hoe.rsync_args = '-av --delete --ignore-errors'
|
73
|
-
$hoe.spec.post_install_message = File.open(File.dirname(__FILE__) + "/../PostInstall.txt").read rescue ""
|
data/config/requirements.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
include FileUtils
|
3
|
-
|
4
|
-
require 'rubygems'
|
5
|
-
%w[rake hoe newgem rubigen].each do |req_gem|
|
6
|
-
begin
|
7
|
-
require req_gem
|
8
|
-
rescue LoadError
|
9
|
-
puts "This Rakefile requires the '#{req_gem}' RubyGem."
|
10
|
-
puts "Installation: gem install #{req_gem} -y"
|
11
|
-
exit
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
$:.unshift(File.join(File.dirname(__FILE__), %w[.. lib]))
|
data/dslify.gemspec
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
Gem::Specification.new do |s|
|
2
|
-
s.name = %q{dslify}
|
3
|
-
s.version = "0.0.1"
|
4
|
-
|
5
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
6
|
-
s.authors = ["Ari Lerner"]
|
7
|
-
s.date = %q{2008-12-19}
|
8
|
-
s.description = %q{Easily add DSL-like calls to any class}
|
9
|
-
s.email = ["arilerner@mac.com"]
|
10
|
-
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.txt", "website/index.txt"]
|
11
|
-
s.files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.txt", "Rakefile", "config/hoe.rb", "config/requirements.rb", "dslify.gemspec", "lib/dslify.rb", "lib/dslify/core.rb", "lib/dslify/core/object.rb", "lib/dslify/core/string.rb", "lib/dslify/modules.rb", "lib/dslify/modules/configurable.rb", "lib/dslify/modules/method_missing_sugar.rb", "lib/dslify/version.rb", "script/console", "script/destroy", "script/generate", "script/txt2html", "setup.rb", "spec/configureable_spec.rb", "spec/method_missing_spec.rb", "spec/spec_helper.rb", "tasks/deployment.rake", "tasks/environment.rake", "tasks/website.rake", "test/test_dslify.rb", "test/test_helper.rb", "website/index.html", "website/index.txt", "website/javascripts/rounded_corners_lite.inc.js", "website/stylesheets/screen.css", "website/template.html.erb"]
|
12
|
-
s.has_rdoc = true
|
13
|
-
s.homepage = %q{http://dslify.rubyforge.org}
|
14
|
-
s.post_install_message = %q{Thanks for installing dslify!
|
15
|
-
|
16
|
-
For more information on dslify, see http://dslify.rubyforge.org
|
17
|
-
|
18
|
-
Ari Lerner}
|
19
|
-
s.rdoc_options = ["--main", "README.txt"]
|
20
|
-
s.require_paths = ["lib"]
|
21
|
-
s.rubyforge_project = %q{dslify}
|
22
|
-
s.rubygems_version = %q{1.2.0}
|
23
|
-
s.summary = %q{Easily add DSL-like calls to any class}
|
24
|
-
s.test_files = ["test/test_dslify.rb", "test/test_helper.rb"]
|
25
|
-
|
26
|
-
if s.respond_to? :specification_version then
|
27
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
28
|
-
s.specification_version = 2
|
29
|
-
|
30
|
-
if current_version >= 3 then
|
31
|
-
s.add_development_dependency(%q<hoe>, [">= 1.8.2"])
|
32
|
-
else
|
33
|
-
s.add_dependency(%q<hoe>, [">= 1.8.2"])
|
34
|
-
end
|
35
|
-
else
|
36
|
-
s.add_dependency(%q<hoe>, [">= 1.8.2"])
|
37
|
-
end
|
38
|
-
end
|
data/lib/dslify/core/object.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
class Object
|
2
|
-
def vputs(m="", o=self)
|
3
|
-
puts m if o.verbose rescue ""
|
4
|
-
end
|
5
|
-
def returning(receiver)
|
6
|
-
yield receiver
|
7
|
-
receiver
|
8
|
-
end
|
9
|
-
def run_in_context(context=self, &block)
|
10
|
-
name="temp_#{self.class}_#{respond_to?(:parent) ? parent.to_s : Time.now.to_i}".to_sym
|
11
|
-
meta_def name, &block
|
12
|
-
self.send name, context
|
13
|
-
meta_undef name rescue ""
|
14
|
-
end
|
15
|
-
end
|
data/lib/dslify/core/string.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
class String
|
2
|
-
def constantize
|
3
|
-
names = self.split('::')
|
4
|
-
names.shift if names.empty? || names.first.empty?
|
5
|
-
|
6
|
-
constant = Object
|
7
|
-
names.each do |name|
|
8
|
-
constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name)
|
9
|
-
end
|
10
|
-
constant
|
11
|
-
end
|
12
|
-
end
|
data/lib/dslify/core.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
Dir["#{File.dirname(__FILE__)}/core/*.rb"].each {|f| require f }
|
@@ -1,33 +0,0 @@
|
|
1
|
-
module Dslify
|
2
|
-
module Configurable
|
3
|
-
module ClassMethods
|
4
|
-
def default_options(h={})
|
5
|
-
@default_options ||= h
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
|
-
module InstanceMethods
|
10
|
-
def options(h={})
|
11
|
-
@options ||= self.class.default_options.merge(h)
|
12
|
-
end
|
13
|
-
|
14
|
-
def configure(h={})
|
15
|
-
options(h).merge!(h)
|
16
|
-
end
|
17
|
-
|
18
|
-
def reconfigure(h={})
|
19
|
-
@options = nil
|
20
|
-
options(h)
|
21
|
-
end
|
22
|
-
|
23
|
-
def set_vars_from_options(opts={})
|
24
|
-
opts.each {|k,v| self.send k.to_sym, v } unless opts.empty?
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def self.included(receiver)
|
29
|
-
receiver.extend ClassMethods
|
30
|
-
receiver.send :include, InstanceMethods
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
module Dslify
|
2
|
-
module MethodMissingSugar
|
3
|
-
|
4
|
-
def method_missing(m, *args, &block)
|
5
|
-
if block_given?
|
6
|
-
(args[0].class == self.class) ? args[0].run_in_context(&block) : super
|
7
|
-
else
|
8
|
-
get_from_options(m, *args, &block)
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
def get_from_options(m, *args, &block)
|
13
|
-
if args.empty?
|
14
|
-
options.has_key?(m) ? options[m] : nil
|
15
|
-
else
|
16
|
-
options[m] = (args.is_a?(Array) && args.size > 1) ? args : args[0]
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
21
|
-
end
|
data/lib/dslify/modules.rb
DELETED
data/lib/dslify/version.rb
DELETED
data/lib/dslify.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
$:.unshift(File.dirname(__FILE__)) unless
|
2
|
-
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
3
|
-
|
4
|
-
Dir["#{File.dirname(__FILE__)}/dslify/*.rb"].each {|f| require f }
|
5
|
-
|
6
|
-
module Dslify
|
7
|
-
def self.included(base)
|
8
|
-
%w(Configurable MethodMissingSugar).each do |inc|
|
9
|
-
base.send :include, "Dslify::#{inc}".constantize
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
data/script/console
DELETED
@@ -1,10 +0,0 @@
|
|
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/dslify.rb'}"
|
9
|
-
puts "Loading dslify gem"
|
10
|
-
exec "#{irb} #{libs} --simple-prompt"
|
data/script/destroy
DELETED
@@ -1,14 +0,0 @@
|
|
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
DELETED
@@ -1,14 +0,0 @@
|
|
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)
|
data/script/txt2html
DELETED
@@ -1,82 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
GEM_NAME = 'dslify' # what ppl will type to install your gem
|
4
|
-
RUBYFORGE_PROJECT = 'dslify'
|
5
|
-
|
6
|
-
require 'rubygems'
|
7
|
-
begin
|
8
|
-
require 'newgem'
|
9
|
-
require 'rubyforge'
|
10
|
-
rescue LoadError
|
11
|
-
puts "\n\nGenerating the website requires the newgem RubyGem"
|
12
|
-
puts "Install: gem install newgem\n\n"
|
13
|
-
exit(1)
|
14
|
-
end
|
15
|
-
require 'redcloth'
|
16
|
-
require 'syntax/convertors/html'
|
17
|
-
require 'erb'
|
18
|
-
require File.dirname(__FILE__) + "/../lib/#{GEM_NAME}/version.rb"
|
19
|
-
|
20
|
-
version = Dslify::VERSION::STRING
|
21
|
-
download = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
|
22
|
-
|
23
|
-
def rubyforge_project_id
|
24
|
-
RubyForge.new.configure.autoconfig["group_ids"][RUBYFORGE_PROJECT]
|
25
|
-
end
|
26
|
-
|
27
|
-
class Fixnum
|
28
|
-
def ordinal
|
29
|
-
# teens
|
30
|
-
return 'th' if (10..19).include?(self % 100)
|
31
|
-
# others
|
32
|
-
case self % 10
|
33
|
-
when 1: return 'st'
|
34
|
-
when 2: return 'nd'
|
35
|
-
when 3: return 'rd'
|
36
|
-
else return 'th'
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
class Time
|
42
|
-
def pretty
|
43
|
-
return "#{mday}#{mday.ordinal} #{strftime('%B')} #{year}"
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
def convert_syntax(syntax, source)
|
48
|
-
return Syntax::Convertors::HTML.for_syntax(syntax).convert(source).gsub(%r!^<pre>|</pre>$!,'')
|
49
|
-
end
|
50
|
-
|
51
|
-
if ARGV.length >= 1
|
52
|
-
src, template = ARGV
|
53
|
-
template ||= File.join(File.dirname(__FILE__), '/../website/template.html.erb')
|
54
|
-
else
|
55
|
-
puts("Usage: #{File.split($0).last} source.txt [template.html.erb] > output.html")
|
56
|
-
exit!
|
57
|
-
end
|
58
|
-
|
59
|
-
template = ERB.new(File.open(template).read)
|
60
|
-
|
61
|
-
title = nil
|
62
|
-
body = nil
|
63
|
-
File.open(src) do |fsrc|
|
64
|
-
title_text = fsrc.readline
|
65
|
-
body_text_template = fsrc.read
|
66
|
-
body_text = ERB.new(body_text_template).result(binding)
|
67
|
-
syntax_items = []
|
68
|
-
body_text.gsub!(%r!<(pre|code)[^>]*?syntax=['"]([^'"]+)[^>]*>(.*?)</\1>!m){
|
69
|
-
ident = syntax_items.length
|
70
|
-
element, syntax, source = $1, $2, $3
|
71
|
-
syntax_items << "<#{element} class='syntax'>#{convert_syntax(syntax, source)}</#{element}>"
|
72
|
-
"syntax-temp-#{ident}"
|
73
|
-
}
|
74
|
-
title = RedCloth.new(title_text).to_html.gsub(%r!<.*?>!,'').strip
|
75
|
-
body = RedCloth.new(body_text).to_html
|
76
|
-
body.gsub!(%r!(?:<pre><code>)?syntax-temp-(\d+)(?:</code></pre>)?!){ syntax_items[$1.to_i] }
|
77
|
-
end
|
78
|
-
stat = File.stat(src)
|
79
|
-
created = stat.ctime
|
80
|
-
modified = stat.mtime
|
81
|
-
|
82
|
-
$stdout << template.result(binding)
|