ymdp 0.1.10 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/Gemfile +8 -1
- data/History.txt +13 -2
- data/Rakefile +7 -0
- data/VERSION +1 -1
- data/features/data/app/assets/yrb/en-US/keys_en-US.pres +1 -0
- data/features/data/app/javascripts/application.js +7 -0
- data/features/data/app/stylesheets/application.css +3 -0
- data/features/data/app/views/layouts/application.html.haml +25 -0
- data/features/data/app/views/page.html.haml +2 -0
- data/{spec → features}/data/config/config.yml +5 -6
- data/features/data/config/content.yml +2 -0
- data/features/data/config/jslint.js +1 -0
- data/features/data/config/servers.yml +10 -0
- data/features/step_definitions/ymdp_steps.rb +54 -0
- data/features/support/env.rb +40 -0
- data/features/ymdp.feature +61 -0
- data/lib/ymdp.rb +7 -12
- data/lib/ymdp/base.rb +16 -65
- data/lib/ymdp/commands/generate.rb +2 -4
- data/lib/ymdp/compiler/base.rb +10 -8
- data/lib/ymdp/compiler/domains.rb +2 -1
- data/lib/ymdp/compiler/template.rb +29 -18
- data/lib/ymdp/{processor → compressor}/compressor.rb +6 -1
- data/{spec/data/script → lib/ymdp/compressor}/yuicompressor-2.4.2.jar +0 -0
- data/lib/ymdp/configuration/config.rb +3 -4
- data/lib/ymdp/configuration/constants.rb +22 -19
- data/lib/ymdp/tasks/ymdp.rake +0 -2
- data/{spec/data/script → lib/ymdp/validator}/jslint.js +0 -0
- data/lib/ymdp/{processor → validator}/validator.rb +30 -38
- data/lib/ymdp/{application.rb → view/application.rb} +0 -0
- data/lib/ymdp/{application_view.rb → view/application_view.rb} +4 -4
- data/lib/ymdp/{asset_tag_helper.rb → view/asset_tag_helper.rb} +0 -0
- data/lib/ymdp/{tag_helper.rb → view/tag_helper.rb} +0 -0
- data/spec/application_spec.rb +2 -0
- data/spec/application_view_spec.rb +6 -6
- data/spec/compiler_template_spec.rb +4 -4
- data/spec/compressor_spec.rb +11 -7
- data/spec/configuration_spec.rb +3 -0
- data/spec/default_settings.rb +1 -1
- data/spec/domains_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -0
- data/spec/stubs.rb +4 -1
- data/spec/validator_spec.rb +45 -40
- data/spec/ymdp_base_spec.rb +10 -7
- data/ymdp.gemspec +25 -76
- metadata +32 -76
- data/lib/ymdp/processor/form_post.rb +0 -62
- data/lib/ymdp/processor/w3c.rb +0 -24
- data/spec/data/Rakefile +0 -3
- data/spec/data/VERSION +0 -1
- data/spec/data/app/.gitignore +0 -1
- data/spec/data/app/assets/images/lightbox/lightbox_bg.png +0 -0
- data/spec/data/app/assets/javascripts/OpenMailIntl.js +0 -291
- data/spec/data/app/assets/javascripts/controls.js +0 -965
- data/spec/data/app/assets/javascripts/date.js +0 -104
- data/spec/data/app/assets/javascripts/dragdrop.js +0 -974
- data/spec/data/app/assets/javascripts/effects.js +0 -1123
- data/spec/data/app/assets/javascripts/lowpro.js +0 -320
- data/spec/data/app/assets/javascripts/prototype.js +0 -4874
- data/spec/data/app/assets/javascripts/scriptaculous.js +0 -68
- data/spec/data/app/assets/yrb/en-US/application_en-US.pres +0 -7
- data/spec/data/app/helpers/application_helper.rb +0 -3
- data/spec/data/app/javascripts/application.js +0 -580
- data/spec/data/app/javascripts/debug.js +0 -138
- data/spec/data/app/javascripts/flash.js +0 -96
- data/spec/data/app/javascripts/header.js +0 -13
- data/spec/data/app/javascripts/help.js +0 -76
- data/spec/data/app/javascripts/i18n.js +0 -235
- data/spec/data/app/javascripts/launcher.js +0 -159
- data/spec/data/app/javascripts/logger.js +0 -61
- data/spec/data/app/javascripts/tag_helper.js +0 -178
- data/spec/data/app/stylesheets/application.css +0 -0
- data/spec/data/app/stylesheets/ie.css +0 -0
- data/spec/data/app/stylesheets/ie6.css +0 -0
- data/spec/data/app/stylesheets/ie7.css +0 -0
- data/spec/data/app/stylesheets/ie8.css +0 -0
- data/spec/data/app/stylesheets/lightbox.css +0 -30
- data/spec/data/app/stylesheets/non_ie.css +0 -0
- data/spec/data/app/views/layouts/application.html.haml +0 -37
- data/spec/data/app/views/page.html.haml +0 -1
- data/spec/data/app/views/shared/_error.html.haml +0 -8
- data/spec/data/app/views/shared/_flash.html.haml +0 -2
- data/spec/data/app/views/shared/_javascripts.html.haml +0 -22
- data/spec/data/app/views/shared/_loading.html.haml +0 -13
- data/spec/data/app/views/shared/_stylesheets.html.haml +0 -23
- data/spec/data/config/categories.yml +0 -6
- data/spec/data/config/config.yml.example +0 -30
- data/spec/data/config/constants.rb +0 -52
- data/spec/data/config/content.yml +0 -2
- data/spec/data/config/servers.yml +0 -10
- data/spec/data/config/servers.yml.example +0 -10
- data/spec/data/lib/init.rb +0 -13
- data/spec/data/lib/tasks/environment.rake +0 -4
- data/spec/data/lib/tasks/keys.rake +0 -3
- data/spec/data/lib/tasks/setup.rake +0 -13
- data/spec/data/lib/tasks/ymdp.rake +0 -4
- data/spec/data/script/build +0 -9
- data/spec/data/script/config +0 -13
- data/spec/data/script/destroy +0 -18
- data/spec/data/script/generate +0 -4
- data/spec/data/script/gitrm +0 -17
- data/spec/data/script/growl +0 -6
- data/spec/data/script/images +0 -48
- data/spec/data/script/langs +0 -29
- data/spec/data/script/translate +0 -5
- data/spec/data/script/ymdt +0 -1895
- data/spec/data/script/ymdt.old +0 -1890
- data/test.rb +0 -46
data/.gitignore
CHANGED
data/Gemfile
CHANGED
@@ -1,17 +1,24 @@
|
|
1
1
|
gem "rspec", ">= 1.2.6"
|
2
|
+
gem "polyglot"
|
3
|
+
gem "treetop"
|
4
|
+
gem "cucumber"
|
2
5
|
gem "haml"
|
3
6
|
gem "json"
|
4
7
|
gem "hpricot"
|
8
|
+
gem "mime-types", :require_as => "mime/types"
|
5
9
|
gem "ruby-growl"
|
10
|
+
gem "grit"
|
6
11
|
gem "activesupport", :require_as => "active_support"
|
7
12
|
gem "sishen-rtranslate"
|
8
|
-
gem "progressions-basepath", :require_as => "basepath"
|
13
|
+
gem "progressions-basepath", :require_as => "basepath", :except => :cucumber
|
9
14
|
gem "progressions-g", :require_as => "g"
|
10
15
|
gem "timer"
|
11
16
|
gem "serenity"
|
17
|
+
gem "natural_time"
|
12
18
|
gem "ymdp_generator"
|
13
19
|
gem "ymdt"
|
14
20
|
gem "yrb"
|
15
21
|
gem "idiom"
|
22
|
+
gem "w3c_validators"
|
16
23
|
|
17
24
|
bin_path "vendor/bin"
|
data/History.txt
CHANGED
@@ -1,5 +1,16 @@
|
|
1
|
-
==
|
2
|
-
|
1
|
+
== 0.1.11 2010-01-25
|
2
|
+
* minor enhancements
|
3
|
+
* changed implementation of configuration object
|
4
|
+
* exposed "host" attribute within templates
|
5
|
+
* send content into template with <tt>yield</tt> instead of instance variable
|
6
|
+
* Cucumber tests
|
7
|
+
* refactor application_view into "view" folder
|
8
|
+
* rename "processor" folder into "compressor" and "validator" folders
|
9
|
+
* move JS validator and JS compressor into YMDP gem
|
10
|
+
* replace HTML validator with w3c_validator gem
|
11
|
+
* bug fixes
|
12
|
+
* fixed filename in form_post.rb
|
13
|
+
* removed unneeded data folder from /spec
|
3
14
|
|
4
15
|
== 0.1.10 2010-01-22
|
5
16
|
* minor enhancements
|
data/Rakefile
CHANGED
@@ -25,6 +25,7 @@ begin
|
|
25
25
|
gem.add_runtime_dependency "ymdp_generator", ">= 0"
|
26
26
|
gem.add_runtime_dependency "ymdt", ">= 0"
|
27
27
|
gem.add_runtime_dependency "yrb", ">= 0"
|
28
|
+
gem.add_runtime_dependency "w3c_validators", ">= 0"
|
28
29
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
29
30
|
end
|
30
31
|
Jeweler::GemcutterTasks.new
|
@@ -48,6 +49,7 @@ Spec::Rake::SpecTask.new(:rcov) do |spec|
|
|
48
49
|
end
|
49
50
|
|
50
51
|
task :bundle do
|
52
|
+
YMDP_TEST = true
|
51
53
|
require 'vendor/gems/environment'
|
52
54
|
Bundler.require_env
|
53
55
|
end
|
@@ -65,3 +67,8 @@ Rake::RDocTask.new do |rdoc|
|
|
65
67
|
rdoc.rdoc_files.include('README*')
|
66
68
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
67
69
|
end
|
70
|
+
|
71
|
+
require 'cucumber/rake/task'
|
72
|
+
Cucumber::Rake::Task.new do |t|
|
73
|
+
t.cucumber_opts = "--format pretty"
|
74
|
+
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.11
|
@@ -0,0 +1 @@
|
|
1
|
+
KEY=value
|
@@ -0,0 +1,25 @@
|
|
1
|
+
!!!
|
2
|
+
%html
|
3
|
+
%head
|
4
|
+
/
|
5
|
+
= "Sprint #{@version} #{@sprint_name}"
|
6
|
+
= "'#{@view}' view for #{@domain}: #{@server}.#{@host}"
|
7
|
+
= "built at #{Time.now}"
|
8
|
+
= "commit #{@hash}, '#{@message}'"
|
9
|
+
|
10
|
+
%title= "#{@view} view for #{@domain}: #{@server}.#{@host}"
|
11
|
+
|
12
|
+
= render :stylesheet => 'application'
|
13
|
+
|
14
|
+
%body{:class => @view}
|
15
|
+
|
16
|
+
#content
|
17
|
+
= yield
|
18
|
+
|
19
|
+
= render :javascript => 'application'
|
20
|
+
|
21
|
+
/
|
22
|
+
= "Sprint #{@version} #{@sprint_name}"
|
23
|
+
= "'#{@view}' view for #{@domain}: #{@server}.#{@host}"
|
24
|
+
= "built at #{Time.now}"
|
25
|
+
= "commit #{@hash}, '#{@message}'"
|
@@ -1,11 +1,10 @@
|
|
1
1
|
config:
|
2
|
-
username:
|
2
|
+
username: username
|
3
3
|
password: password
|
4
4
|
default_server: staging
|
5
|
-
host: myserver.com
|
6
5
|
production_server: my
|
7
|
-
|
8
|
-
growl:
|
6
|
+
host: mysite.com
|
7
|
+
growl: true
|
9
8
|
|
10
9
|
verbose: false
|
11
10
|
compress:
|
@@ -17,10 +16,10 @@ config:
|
|
17
16
|
html:
|
18
17
|
doctype: HTML 4.0 Transitional
|
19
18
|
build: true
|
20
|
-
deploy:
|
19
|
+
deploy: false
|
21
20
|
embedded_js:
|
22
21
|
build: true
|
23
|
-
deploy:
|
22
|
+
deploy: false
|
24
23
|
js_assets:
|
25
24
|
build: false
|
26
25
|
deploy: false
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1,54 @@
|
|
1
|
+
Given %r{I load config.yml} do
|
2
|
+
require 'ymdp/configuration/constants'
|
3
|
+
end
|
4
|
+
|
5
|
+
Then %r{my "([^\"]*)" setting should be "([^\"]*)"} do |key, value|
|
6
|
+
YMDP::Base.configuration.send(key).should == value
|
7
|
+
end
|
8
|
+
|
9
|
+
Given %r{I compile the application with the message "([^\"]*)"} do |message|
|
10
|
+
begin
|
11
|
+
@options = {
|
12
|
+
:commit => false,
|
13
|
+
:branch => "master",
|
14
|
+
:base_path => BASE_PATH,
|
15
|
+
:servers => SERVERS,
|
16
|
+
:message => message
|
17
|
+
}
|
18
|
+
Object.send(:remove_const, :YMDP_ENV) if defined?(YMDP_ENV)
|
19
|
+
YMDP_ENV = "build"
|
20
|
+
YMDP::Compiler::Domains.new(@options).compile
|
21
|
+
rescue StandardError => e
|
22
|
+
@exception = e.message
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
And %r{I should see "([^\"]*)" in "([^\"]*)"} do |content, path|
|
27
|
+
File.read("#{BASE_PATH}/#{path}").should =~ /#{content}/
|
28
|
+
end
|
29
|
+
|
30
|
+
Given %r{the file "([^\"]*)" exists with "([^\"]*)"} do |filename, content|
|
31
|
+
content.gsub!("\\n", "\n")
|
32
|
+
File.open("#{BASE_PATH}/#{filename}", "w") do |f|
|
33
|
+
content.split("\n").each do |line|
|
34
|
+
f.puts line
|
35
|
+
end
|
36
|
+
end
|
37
|
+
@files << "#{BASE_PATH}/#{filename}"
|
38
|
+
end
|
39
|
+
|
40
|
+
Then /^an exception should have been raised with the message "([^\"]*)"$/ do |message|
|
41
|
+
@exception.should == message
|
42
|
+
end
|
43
|
+
|
44
|
+
Then %r{no exceptions should have been raised} do
|
45
|
+
@exception.should be_nil
|
46
|
+
end
|
47
|
+
|
48
|
+
And %r{I remove the file "([^\"]*)"} do |filename|
|
49
|
+
system "rm #{BASE_PATH}/#{filename}"
|
50
|
+
end
|
51
|
+
|
52
|
+
When %r{I deploy the application} do
|
53
|
+
|
54
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'vendor/gems/environment'
|
2
|
+
Bundler.require_env :cucumber
|
3
|
+
|
4
|
+
require 'spec/expectations'
|
5
|
+
require 'spec/mocks'
|
6
|
+
|
7
|
+
require 'lib/ymdp'
|
8
|
+
require 'compiler/domains'
|
9
|
+
|
10
|
+
require 'spec/stubs'
|
11
|
+
|
12
|
+
Before do
|
13
|
+
unless defined?(BASE_PATH)
|
14
|
+
BASE_PATH = File.expand_path("./features/data")
|
15
|
+
APPLICATION_PATH = File.expand_path("./features/data/app")
|
16
|
+
CONFIG_PATH = File.expand_path("./features/data/config")
|
17
|
+
SERVERS_PATH = File.expand_path("./features/data/servers")
|
18
|
+
TMP_PATH = File.expand_path("./features/data/tmp")
|
19
|
+
end
|
20
|
+
|
21
|
+
@exception = nil
|
22
|
+
@files = []
|
23
|
+
|
24
|
+
$rspec_mocks ||= Spec::Mocks::Space.new
|
25
|
+
|
26
|
+
stub_growl
|
27
|
+
|
28
|
+
@git_helper = 'git_helper'
|
29
|
+
@git_helper.stub(:commit).as_null_object
|
30
|
+
YMDP::GitHelper.stub!(:new).and_return(@git_helper)
|
31
|
+
|
32
|
+
@ymdt = "ymdt"
|
33
|
+
YMDT::Base.stub!(:new).and_return(@ymdt)
|
34
|
+
end
|
35
|
+
|
36
|
+
After do
|
37
|
+
@files.each do |file|
|
38
|
+
system "rm #{file}"
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
Feature: Configuration
|
2
|
+
|
3
|
+
Background:
|
4
|
+
Given I load config.yml
|
5
|
+
|
6
|
+
Scenario: Load the config file
|
7
|
+
Then my "username" setting should be "username"
|
8
|
+
And my "password" setting should be "password"
|
9
|
+
|
10
|
+
@wip
|
11
|
+
Scenario: Ensure the commit message is in the view
|
12
|
+
Given I compile the application with the message "this is my commit message"
|
13
|
+
Then I should see "this is my commit message" in "servers/production/views/page"
|
14
|
+
Then I should see "this is my commit message" in "servers/development/views/page"
|
15
|
+
And I should see "Apple" in "servers/production/views/page"
|
16
|
+
And I should see "Apple" in "servers/development/views/page"
|
17
|
+
And I should see "mysite.com" in "servers/production/views/page"
|
18
|
+
And I should see "mysite.com" in "servers/development/views/page"
|
19
|
+
And I should see "font-family:Arial,Helvetica,sans-serif;" in "servers/production/views/page"
|
20
|
+
And I should see "font-family:Arial,Helvetica,sans-serif;" in "servers/development/views/page"
|
21
|
+
And I should see "var Application" in "servers/production/views/page"
|
22
|
+
And I should see "var Application" in "servers/development/views/page"
|
23
|
+
And no exceptions should have been raised
|
24
|
+
|
25
|
+
|
26
|
+
Scenario: Build application with invalid HTML
|
27
|
+
Given the file "app/views/invalid.html.haml" exists with "%span\n #invalid_div This won't validate"
|
28
|
+
And I compile the application with the message "this shouldn't validate"
|
29
|
+
Then an exception should have been raised with the message "HTML Validation Errors"
|
30
|
+
|
31
|
+
|
32
|
+
Scenario: Render nil on nonexistent scripts
|
33
|
+
Given the file "app/views/valid.html.haml" exists with "%p Hello\n= render :javascript => 'nonexistent'\n%p Goodbye"
|
34
|
+
And I compile the application with the message "this should have no javascript"
|
35
|
+
Then I should see "<p>Hello</p>\n \n <p>Goodbye</p>" in "servers/production/views/valid"
|
36
|
+
And no exceptions should have been raised
|
37
|
+
|
38
|
+
|
39
|
+
Scenario: Render nil on nonexistent stylesheets
|
40
|
+
Given the file "app/views/valid.html.haml" exists with "%p Hello\n= render :stylesheet => 'nonexistent'\n%p Goodbye"
|
41
|
+
And I compile the application with the message "this should have no stylesheet"
|
42
|
+
Then I should see "<p>Hello</p>\n \n <p>Goodbye</p>" in "servers/production/views/valid"
|
43
|
+
And no exceptions should have been raised
|
44
|
+
|
45
|
+
|
46
|
+
Scenario: Build application with valid JavaScript
|
47
|
+
Given the file "app/views/valid.html.haml" exists with "= render :javascript => 'valid'"
|
48
|
+
And the file "app/javascripts/valid.js" exists with "var a = 'hello'; alert(a);"
|
49
|
+
And I compile the application with the message "this should validate"
|
50
|
+
Then no exceptions should have been raised
|
51
|
+
|
52
|
+
|
53
|
+
Scenario: Build application with invalid JavaScript
|
54
|
+
Given the file "app/javascripts/invalid.js" exists with "A = function() { alert('hello'); }"
|
55
|
+
And the file "app/views/invalid.html.haml" exists with "= render :javascript => 'invalid'"
|
56
|
+
And I compile the application with the message "this shouldn't validate"
|
57
|
+
Then an exception should have been raised with the message "JavaScript Errors embedded in /tmp/invalid.js"
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
|
data/lib/ymdp.rb
CHANGED
@@ -8,18 +8,13 @@ $LOAD_PATH.unshift dir unless $LOAD_PATH.include?(dir)
|
|
8
8
|
#
|
9
9
|
|
10
10
|
require 'rubygems'
|
11
|
+
require 'haml'
|
11
12
|
require 'erb'
|
12
13
|
require 'set'
|
13
14
|
|
14
|
-
require
|
15
|
-
require
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
["support", "configuration"].each do |directory|
|
22
|
-
Dir["#{dir}/#{directory}/*.rb"].each do |path|
|
23
|
-
require File.expand_path(path)
|
24
|
-
end
|
25
|
-
end
|
15
|
+
require 'base'
|
16
|
+
require 'validator/validator'
|
17
|
+
require 'view/tag_helper'
|
18
|
+
require 'view/asset_tag_helper'
|
19
|
+
require 'support/file'
|
20
|
+
require 'configuration/config'
|
data/lib/ymdp/base.rb
CHANGED
@@ -31,62 +31,41 @@ module YMDP
|
|
31
31
|
# These options are still evolving.
|
32
32
|
#
|
33
33
|
class Base
|
34
|
-
|
35
|
-
|
36
|
-
#
|
37
|
-
def self.configure
|
38
|
-
setter = YMDP::Configuration::Setter.new
|
39
|
-
|
40
|
-
yield setter
|
41
|
-
|
42
|
-
@@paths = setter.paths if setter.paths.try(:any?)
|
43
|
-
@@servers = setter.servers if setter.servers.try(:any?)
|
44
|
-
|
45
|
-
@@content_variables ||= {}
|
46
|
-
|
47
|
-
setter.instance_variables.each do |key|
|
48
|
-
unless ["@servers", "@paths", "@content_variables"].include?(key)
|
49
|
-
value = setter.instance_variable_get(key)
|
50
|
-
create_accessor(key, value)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
if setter.content_variables.any?
|
55
|
-
content_variables = @@content_variables.merge(setter.content_variables)
|
56
|
-
create_accessor("content_variables", content_variables)
|
57
|
-
end
|
34
|
+
def self.configuration
|
35
|
+
@@configuration ||= YMDP::Configuration::Setter.new
|
58
36
|
end
|
59
37
|
|
60
|
-
|
61
|
-
|
62
|
-
#
|
63
|
-
def self.servers
|
64
|
-
@@servers
|
38
|
+
def content_variables
|
39
|
+
configuration.content_variables
|
65
40
|
end
|
66
41
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
42
|
+
def configuration
|
43
|
+
@@configuration
|
44
|
+
end
|
45
|
+
|
46
|
+
# Configures global YMDP settings. Sends a YMDP::Configuration::Setter instance to
|
47
|
+
# the block, which is used to define global settings.
|
48
|
+
#
|
49
|
+
def self.configure
|
50
|
+
yield configuration
|
72
51
|
end
|
73
52
|
|
74
53
|
# Returns the server definition hash as an instance variable, making it available to
|
75
54
|
# instances of any class derived from YMDP::Base.
|
76
55
|
#
|
77
56
|
def servers
|
78
|
-
|
57
|
+
configuration.servers
|
79
58
|
end
|
80
59
|
|
81
60
|
# Returns the paths definition hash as an instance variable, making it available to
|
82
61
|
# instances of any class derived from YMDP::Base.
|
83
62
|
#
|
84
63
|
def paths
|
85
|
-
|
64
|
+
configuration.paths
|
86
65
|
end
|
87
66
|
|
88
67
|
def self.base_path
|
89
|
-
paths[:base_path]
|
68
|
+
configuration.paths[:base_path]
|
90
69
|
end
|
91
70
|
|
92
71
|
def base_path
|
@@ -104,33 +83,5 @@ module YMDP
|
|
104
83
|
def display_path(path)
|
105
84
|
self.class.display_path(path)
|
106
85
|
end
|
107
|
-
|
108
|
-
|
109
|
-
private
|
110
|
-
|
111
|
-
# Creates class- and instance-level accessors for the key and value.
|
112
|
-
#
|
113
|
-
def self.create_accessor(key, value)
|
114
|
-
if key
|
115
|
-
value_str = "\"#{value}\""
|
116
|
-
|
117
|
-
key = key.to_s.gsub("@", "")
|
118
|
-
|
119
|
-
class_eval %(
|
120
|
-
class << self
|
121
|
-
attr_accessor :#{key}
|
122
|
-
end
|
123
|
-
)
|
124
|
-
|
125
|
-
self.send("#{key}=".to_sym, value)
|
126
|
-
|
127
|
-
eval %(
|
128
|
-
def #{key}
|
129
|
-
#{self}.#{key}
|
130
|
-
end
|
131
|
-
)
|
132
|
-
end
|
133
|
-
end
|
134
86
|
end
|
135
87
|
end
|
136
|
-
|