ycn 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/History.txt ADDED
@@ -0,0 +1,4 @@
1
+ == 0.0.1 2008-09-22
2
+
3
+ * 1 major enhancement:
4
+ * Initial release
data/License.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2008 FIXME full name
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Manifest.txt ADDED
@@ -0,0 +1,36 @@
1
+ History.txt
2
+ License.txt
3
+ Manifest.txt
4
+ PostInstall.txt
5
+ README.txt
6
+ Rakefile
7
+ bin/ycn-gen
8
+ config/hoe.rb
9
+ config/requirements.rb
10
+ lib/ycn.rb
11
+ lib/ycn/version.rb
12
+ lib/ycn/ycn.rb
13
+ lib/ycn/header.rb
14
+ lib/ycn/java_klass.rb
15
+ lib/ycn/klass.rb
16
+ lib/ycn/string_manip.rb
17
+ lib/ycn/ycn_functions.rb
18
+ script/console
19
+ script/console.cmd
20
+ script/destroy
21
+ script/destroy.cmd
22
+ script/generate
23
+ script/generate.cmd
24
+ script/txt2html
25
+ script/txt2html.cmd
26
+ setup.rb
27
+ tasks/deployment.rake
28
+ tasks/environment.rake
29
+ tasks/website.rake
30
+ test/test_helper.rb
31
+ test/test_ycn.rb
32
+ website/index.html
33
+ website/index.txt
34
+ website/javascripts/rounded_corners_lite.inc.js
35
+ website/stylesheets/screen.css
36
+ website/template.html.erb
data/PostInstall.txt ADDED
@@ -0,0 +1,7 @@
1
+
2
+ For more information on ycn, see http://ycn.rubyforge.org
3
+
4
+ NOTE: Change this information in PostInstall.txt
5
+ You can also delete it if you don't want it.
6
+
7
+
data/README.txt ADDED
@@ -0,0 +1,48 @@
1
+ = ycn
2
+
3
+ * FIX (url)
4
+
5
+ == DESCRIPTION:
6
+
7
+ FIX (describe your package)
8
+
9
+ == FEATURES/PROBLEMS:
10
+
11
+ * FIX (list of features or problems)
12
+
13
+ == SYNOPSIS:
14
+
15
+ FIX (code sample of usage)
16
+
17
+ == REQUIREMENTS:
18
+
19
+ * FIX (list of requirements)
20
+
21
+ == INSTALL:
22
+
23
+ * FIX (sudo gem install, anything else)
24
+
25
+ == LICENSE:
26
+
27
+ (The MIT License)
28
+
29
+ Copyright (c) 2008 FIXME full name
30
+
31
+ Permission is hereby granted, free of charge, to any person obtaining
32
+ a copy of this software and associated documentation files (the
33
+ 'Software'), to deal in the Software without restriction, including
34
+ without limitation the rights to use, copy, modify, merge, publish,
35
+ distribute, sublicense, and/or sell copies of the Software, and to
36
+ permit persons to whom the Software is furnished to do so, subject to
37
+ the following conditions:
38
+
39
+ The above copyright notice and this permission notice shall be
40
+ included in all copies or substantial portions of the Software.
41
+
42
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
43
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
44
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
45
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
46
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
47
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
48
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,4 @@
1
+ require 'config/requirements'
2
+ require 'config/hoe' # setup Hoe + all gem configuration
3
+
4
+ Dir['tasks/**/*.rake'].each { |rake| load rake }
data/bin/ycn-gen ADDED
@@ -0,0 +1,96 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ BASE_DIR = Dir.pwd
4
+ PROJECT_DIR = "#{BASE_DIR}/#{ARGV[0]}"
5
+ PCG_DIR = "#{PROJECT_DIR}/pcg"
6
+
7
+ Dir.mkdir(PROJECT_DIR)
8
+ Dir.mkdir(PCG_DIR)
9
+
10
+ example_file_content = <<TEXT
11
+ require 'ycn'
12
+
13
+ project = {
14
+ :name => "JavaExprat4AK - Le polymorphisme, les classes " +
15
+ "abstraites et les interfaces.",
16
+ :desc => "Gère une collection de cowboys, indiens, brigands " +
17
+ "et dames en détresse, ainsi que leurs boissons.",
18
+ :author => "Andrew Koster",
19
+
20
+ :package => 'cowboys et indiens'
21
+ }
22
+
23
+ Ycn.generate project, :java
24
+ TEXT
25
+
26
+ example_package_content = <<TEXT
27
+ humain:
28
+ new:
29
+ - nom, texte_parole
30
+ properties:
31
+ String:
32
+ - nom
33
+ - boisson_favorite = "de l'eau"
34
+ StringBuilder:
35
+ - texte_parole
36
+ methods:
37
+ void:
38
+ parler(string): |
39
+ getTexteParole().append(
40
+ "(" + getNom() + ") - " + psParoles + "\\n")
41
+ commenter(string): |
42
+ getTexteParole().append(psCommentaire + "\\n")
43
+ se_presenter: |
44
+ parler("Bonjour, je suis " + getNom() +
45
+ " et j'aime " + getBoissonFavorite() + ".")
46
+ boire: |
47
+ parler("Ah! Un bon verre avec " +
48
+ getBoissonFavorite() + "! GLOUPS!")
49
+
50
+ indien < humain:
51
+ new:
52
+ - nom, texte_parole
53
+ - nom, texte_parole, plumes
54
+ properties:
55
+ int:
56
+ - plumes = 0
57
+ String:
58
+ - totem = "Coyote"
59
+ - boisson_favorite = "du jus de racine"
60
+ methods:
61
+ void:
62
+ se_presenter: |
63
+ super.sePresenter()
64
+ parler("Mon totem est le " + getTotem() +
65
+ " et j'ai " + getPlumes() + " plume(s).")
66
+ scalper(cowboy): |
67
+ pvVisagePale.seFaireScalper(this)
68
+ setPlumes(getPlumes() + 1)
69
+
70
+ cowboy < humain:
71
+ new:
72
+ - nom, texte_parole
73
+ - nom, texte_parole, popularite
74
+ properties:
75
+ int:
76
+ - popularite = 0
77
+ String:
78
+ - adjectif = "vaillant"
79
+ methods:
80
+ void:
81
+ se_presenter: |
82
+ super.sePresenter()
83
+ parler("Je suis " + getAdjectif() + " et je suis" +
84
+ " populaire pour la libération de " +
85
+ getPopularite() + " dame(s).")
86
+ se_faire_scalper(indien): |
87
+ parler("Aïe! Ma tête, " + piIndien.getNom() + " !")
88
+ TEXT
89
+
90
+ open( "#{PROJECT_DIR}/ycn_example.rb", 'w' ) { |file|
91
+ file.print example_file_content
92
+ }
93
+
94
+ open( "#{PCG_DIR}/cowboys_et_indiens.yml", 'w' ) { |file|
95
+ file.print example_package_content
96
+ }
data/config/hoe.rb ADDED
@@ -0,0 +1,74 @@
1
+ require 'ycn/version'
2
+
3
+ AUTHOR = 'Andrew Koster' # can also be an array of Authors
4
+ EMAIL = "ak_avenger@hotmail.com"
5
+ DESCRIPTION = "Yaml Class Notation (YCN)"
6
+ GEM_NAME = 'ycn' # what ppl will type to install your gem
7
+ RUBYFORGE_PROJECT = 'ycn' # 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
+ ['configatron', '>= 1.2.1']
13
+ ] # An array of rubygem dependencies [name, version]
14
+
15
+ @config_file = 'C:/.rubyforge/user-config.yml'
16
+ @config = nil
17
+ RUBYFORGE_USERNAME = "naturalcode"
18
+ def rubyforge_username
19
+ unless @config
20
+ begin
21
+ @config = YAML.load(File.read(File.expand_path(@config_file)))
22
+ rescue
23
+ puts <<-EOS
24
+ ERROR: No rubyforge config file found: #{@config_file}
25
+ Run 'rubyforge setup' to prepare your env for access to Rubyforge
26
+ - See http://newgem.rubyforge.org/rubyforge.html for more details
27
+ EOS
28
+ exit
29
+ end
30
+ end
31
+ RUBYFORGE_USERNAME.replace @config["username"]
32
+ end
33
+
34
+
35
+ REV = nil
36
+ # UNCOMMENT IF REQUIRED:
37
+ # REV = YAML.load(`svn info`)['Revision']
38
+ VERS = Ycn::VERSION::STRING + (REV ? ".#{REV}" : "")
39
+ RDOC_OPTS = ['--quiet', '--title', 'ycn documentation',
40
+ "--opname", "index.html",
41
+ "--line-numbers",
42
+ "--main", "README",
43
+ "--inline-source"]
44
+
45
+ class Hoe
46
+ def extra_deps
47
+ @extra_deps.reject! { |x| Array(x).first == 'hoe' }
48
+ @extra_deps
49
+ end
50
+ end
51
+
52
+ # Generate all the Rake tasks
53
+ # Run 'rake -T' to see list of generated tasks (from gem root directory)
54
+ $hoe = Hoe.new(GEM_NAME, VERS) do |p|
55
+ p.developer(AUTHOR, EMAIL)
56
+ p.description = DESCRIPTION
57
+ p.summary = DESCRIPTION
58
+ p.url = HOMEPATH
59
+ p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
60
+ p.test_globs = ["test/**/test_*.rb"]
61
+ p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
62
+
63
+ # == Optional
64
+ p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
65
+ #p.extra_deps = EXTRA_DEPENDENCIES
66
+
67
+ #p.spec_extras = {} # A hash of extra values to set in the gemspec.
68
+ end
69
+
70
+ CHANGES = $hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
71
+ PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
72
+ $hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
73
+ $hoe.rsync_args = '-av --delete --ignore-errors'
74
+ $hoe.spec.post_install_message = File.open(File.dirname(__FILE__) + "/../PostInstall.txt").read rescue ""
@@ -0,0 +1,15 @@
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/lib/ycn/header.rb ADDED
@@ -0,0 +1,10 @@
1
+ module Header
2
+ def self.configure_from hash
3
+ configatron do |c|
4
+ c.program_name = hash[:name]
5
+ c.author_name = hash[:author]
6
+ c.description = hash[:desc]
7
+ c.package = hash[:pack]
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,169 @@
1
+ module JavaKlass
2
+ def java_header
3
+ text = <<HEAD
4
+ Programme : #{configatron.program_name}
5
+ Auteur(s) : #{configatron.author_name}
6
+ Date : #{Time.now.day}/#{Time.now.month}/#{Time.now.year}
7
+ Description : #{configatron.description}
8
+ HEAD
9
+
10
+ '/*' + text.split("\n").map{ |l|
11
+ "\n * #{l}"
12
+ }.join + "\n */\n"
13
+ end
14
+
15
+ def to_java
16
+ java_header+
17
+ java_package+
18
+ java_imports+
19
+ java_class_declaration+
20
+ java_properties+
21
+ java_constructors+
22
+ java_methods+
23
+ java_g_s_etters+
24
+ java_bottom
25
+ end
26
+
27
+ def java_package
28
+ @package ? "\npackage pcg#{camelize @package};\n" : ''
29
+ end
30
+
31
+ def java_imports
32
+ text = ''
33
+ if properties
34
+ text += properties.keys.map{ |type|
35
+ type == 'Date' ? "\nimport java.util.Date;\n" : nil
36
+ }.join
37
+ end
38
+ text
39
+ end
40
+
41
+ def java_class_declaration
42
+ <<TEXT
43
+
44
+ public class #{name}#{" extends #{parent.name}" if parent}
45
+ {
46
+ TEXT
47
+ end
48
+
49
+ def java_properties
50
+ text = ''
51
+
52
+ if properties
53
+ properties.each_pair do |type, prop_names|
54
+ if prop_names.class == Array
55
+ empty_set = true
56
+
57
+ text += prop_names.map { |name|
58
+ if prop_default_overrides[name]
59
+ ''
60
+ else
61
+ empty_set = false
62
+ name_displayed = styled_var :riki, name, :g, type
63
+ value_assignment = prop_defaults[name] ? " = #{prop_defaults[name]}" : nil
64
+
65
+ " private #{type} #{name_displayed}#{value_assignment};\n"
66
+ end
67
+ }.join# + (empty_set ? '' : "\n")
68
+
69
+ end
70
+ end
71
+ end
72
+
73
+ text = (text == '') ? '' : "\n#{text}"
74
+ end
75
+
76
+ def java_constructors
77
+ text = <<TEXT
78
+
79
+ // Constructeur par défaut
80
+ public #{name}()
81
+ {#{_java_prop_default_overrides}
82
+ TEXT
83
+ #~ text +=
84
+ text += "#{"\n" unless prop_default_overrides.keys.size > 0} }\n"
85
+ if construct_params
86
+ #~ pp construct_params
87
+ text += construct_params.map{ |constructor|
88
+ "\n public #{name}(" +
89
+ constructor.map { |param|
90
+ type = find_type(param)
91
+ "#{type} #{styled_var :riki, param, :p, type}"
92
+ }.join(', ') + ")\n {\n" +
93
+ constructor.map { |param|
94
+ type = find_type(param)
95
+ " set#{camelize param}(#{styled_var :riki, param, :p, type});"
96
+ }.join("\n") +
97
+ _java_prop_default_overrides + "\n }\n"
98
+ }.join
99
+ end
100
+ text
101
+ end
102
+
103
+ def _java_prop_default_overrides
104
+ p = prop_default_overrides.keys.map { |property|
105
+ "\n super.set#{camelize property}(#{prop_default_overrides[property]});"
106
+ }.join("\n")
107
+ end
108
+
109
+ def java_methods
110
+ text = ""
111
+ #~ puts "#{pp(methods)}"
112
+ if methods.class == Hash
113
+ methods.each_pair do |type, meth|
114
+ #~ puts 't' + type
115
+ if meth.class == Hash
116
+ meth.each_pair { |m, contents|
117
+
118
+ if method_params[m]
119
+ parameters = method_params[m].map{ |item|
120
+ "#{camelize item} #{styled_var :riki, item, :p, item}"
121
+ }.join(', ')
122
+ end
123
+
124
+ text += "\n public #{type} #{low_camelize m}(" +
125
+ "#{parameters if parameters})\n" +
126
+ " {\n#{contents.split("\n").map{ |l| " #{l}#{';' if !(l =~ /(\+|\{|\}|\()\z/)}"}.join("\n") if contents}\n }\n"
127
+ }
128
+ else
129
+ puts "Warning! No method type for #{type}"
130
+ end
131
+ end
132
+
133
+ else
134
+
135
+ end
136
+ text
137
+ end
138
+
139
+ def java_g_s_etters
140
+ text = ''
141
+ if properties
142
+ properties.each_pair do |type, prop_names|
143
+ text += prop_names.map { |name|
144
+ unless prop_default_overrides[name]
145
+ <<TEXT
146
+
147
+ public #{type} get#{camelize name}()
148
+ {
149
+ return #{styled_var :riki, name, :g, type };
150
+ }
151
+
152
+ public void set#{camelize name}(#{type} #{styled_var :riki, name, :p, type})
153
+ {
154
+ #{styled_var :riki, name, :g, type } = #{styled_var :riki, name, :p, type};
155
+ }
156
+ TEXT
157
+ else
158
+ ''
159
+ end
160
+ }.join
161
+ end
162
+ end
163
+ text
164
+ end
165
+
166
+ def java_bottom
167
+ '}'
168
+ end
169
+ end
data/lib/ycn/klass.rb ADDED
@@ -0,0 +1,95 @@
1
+ require "ycn/java_klass"
2
+ require "ycn/string_manip"
3
+
4
+ class Klass
5
+ attr_accessor :name, :parent, :properties, :methods,
6
+ :method_params, :construct_params, :prop_defaults,
7
+ :prop_default_overrides
8
+
9
+ include JavaKlass
10
+ include StringManip
11
+
12
+ def initialize name, parent, properties, methods,
13
+ construct_params=nil, package=nil
14
+
15
+ @name = camelize(name)
16
+ @parent = parent ? camelize(parent) : nil
17
+ @properties = properties
18
+ @methods = methods
19
+ _extract_method_params
20
+ @construct_params = _organize_constructor_params(construct_params)
21
+ @package = package
22
+ end
23
+
24
+ def _extract_method_params
25
+ return nil unless @methods
26
+ @method_params = {}
27
+
28
+ @methods.each_pair do |type, meths|
29
+ meths.each_key do |m|
30
+ if m =~ /\(.+\)/
31
+ m_parameters =
32
+ /\(.*\)/.match(m).
33
+ to_s[1..-2].split(/ |, /)
34
+
35
+ m_name_only = m.dup.sub!(/\(.*\)/, '')
36
+
37
+ meths.store(m_name_only, meths[m])
38
+ meths.delete(m)
39
+ @method_params.store(m_name_only, m_parameters)
40
+ end
41
+ end
42
+ end
43
+ end
44
+
45
+ def _organize_constructor_params params_array
46
+ return nil unless params_array
47
+ params_array.map{ |params| params.split(/ |, /) }
48
+ end
49
+
50
+ def extract_default_values
51
+ @prop_defaults = {}
52
+ return nil unless @properties
53
+
54
+ @properties.each_pair do |type, props|
55
+ props.map! do |p|
56
+ if /[^(\s*=\s*)]+\s*=\s*/.match(p)
57
+ default_value = p.sub(/[^(\s*=\s*)]+\s*=\s*/, '')
58
+ p.sub!(/\s*=\s*.*/, '')
59
+ @prop_defaults.store(p, default_value)
60
+ end
61
+ p
62
+ end
63
+ end
64
+ end
65
+
66
+ def fix_default_overrides
67
+ @prop_default_overrides = {}
68
+ return nil unless @parent && @prop_defaults
69
+
70
+ @prop_defaults.each_pair do |property, value|
71
+ type = find_type(property)
72
+
73
+ if @parent.properties && @parent.properties[type]
74
+ if @parent.properties[type].include? property
75
+ @prop_default_overrides[property] =
76
+ @prop_defaults.delete property
77
+ end
78
+ end
79
+ end
80
+ end
81
+
82
+ def find_type property_name
83
+ prop_hash = {}
84
+ return nil unless @properties
85
+
86
+ @properties.each_pair do |type, props|
87
+ props.each { |p| prop_hash.store(p, type) }
88
+ end
89
+
90
+ type = prop_hash[property_name]
91
+
92
+ (!type && parent) ?
93
+ parent.find_type(property_name) : type
94
+ end
95
+ end
@@ -0,0 +1,31 @@
1
+ module StringManip
2
+ def styled_var style, variable_name, scope=nil, type=nil
3
+ {
4
+ :riki => Proc.new do
5
+ s = scope.to_s.slice(0..0)
6
+ t = type.to_s.slice(0..0)
7
+ "#{s}#{t}".downcase + camelize(variable_name)
8
+ end
9
+ }[style].call
10
+ end
11
+
12
+ def camelize string
13
+ string.gsub('_', ' ').split(' ').map { |word|
14
+ word.capitalize
15
+ }.join
16
+ end
17
+
18
+ def low_camelize string
19
+ w = 0
20
+ string.gsub('_', ' ').split(' ').map { |word|
21
+ w += 1
22
+ w == 1 ? word.downcase : word.capitalize
23
+ }.join
24
+ end
25
+
26
+ def self.camelize string
27
+ string.gsub('_', ' ').split(' ').map { |word|
28
+ word.capitalize
29
+ }.join
30
+ end
31
+ end
@@ -0,0 +1,9 @@
1
+ module Ycn
2
+ module VERSION #:nodoc:
3
+ MAJOR = 0
4
+ MINOR = 0
5
+ TINY = 1
6
+
7
+ STRING = [MAJOR, MINOR, TINY].join('.')
8
+ end
9
+ end
data/lib/ycn/ycn.rb ADDED
@@ -0,0 +1,47 @@
1
+ module Ycn
2
+ def self.generate project_hash, language
3
+ puts 'moo'
4
+ $base_dir = Dir.pwd
5
+
6
+ require 'yaml'
7
+ require 'configatron'
8
+ require 'ycn/klass'
9
+ require 'ycn/ycn_functions'
10
+ require 'ycn/header'
11
+ require 'ycn/string_manip'
12
+
13
+ Header.configure_from project_hash
14
+ project_hash[:package] =
15
+ project_hash[:package].to_s.gsub(' ', '_')
16
+ configatron { |c| c.package = project_hash[:package] }
17
+
18
+ classes_yaml = YAML::load(
19
+ correct_for_blank_last_method( open(
20
+ "#{$base_dir}/pcg/#{project_hash[:package]}.yml", 'r')))
21
+
22
+ classes = []
23
+
24
+ classes_yaml.each_pair do |class_name, attr_hash|
25
+ classes << attribute_hash_to_class( class_name, attr_hash )
26
+ end
27
+
28
+ fix_inheritance_and_overrides classes
29
+
30
+ generation_dir = "#{$base_dir}/generated_code"
31
+ package_name = "pcg#{StringManip::camelize configatron.package}"
32
+ output_dir = "#{generation_dir}/#{package_name}"
33
+
34
+ Dir.mkdir generation_dir unless File.exists? generation_dir
35
+ Dir.mkdir output_dir unless File.exists? output_dir
36
+
37
+ classes.each do |klass|
38
+ file_name = "#{klass.name}.#{extension[language]}"
39
+
40
+ File.open( "#{output_dir}/#{file_name}", 'w' ) { |f|
41
+ output = eval("klass.to_#{language.to_s.downcase}")
42
+ puts output + "\n"
43
+ f.print output
44
+ }
45
+ end
46
+ end
47
+ end