mack 0.4.5 → 0.4.6

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,14 @@
1
+ ===0.4.6
2
+ * Mack now uses Erubis, http://www.kuwata-lab.com/erubis/, for it's rendering engine instead of ERB. This makes Mack even faster now! Yippie!
3
+ * Added rake generate:model name=<model_name> (optional: cols=<col_1>:<col_1_type>,<col_2>:<col_2_type>) This will also create a migration for you.
4
+ * Updated rake generate:migration name=<model_name> (optional: cols=<col_1>:<col_1_type>,<col_2>:<col_2_type>) This will create the proper table migration for you.
5
+ * Updated rake generate:scaffold to use the ModelGenerator now.
6
+ * ScaffoldGenerator now create input fields based on the type of columns, if any, passed in.
7
+ * Overall general refactoring of the generator classes.
8
+ * Fixed a bug with request logging not, well, logging.
9
+ * gem: erubis 2.5.0
10
+ * gem: thin 0.8.0
11
+
1
12
  ===0.4.5
2
13
  * Removed boot.rb file. It was unnecessary.
3
14
  * When a new Mack application is generated the Rakefile that gets generated is stamped with the Mack gem version used to create it. This ties the project to that gem. This can, of course, be upgraded as new Mack gems come out, but it's a good way of tying your app to a specific revision of Mack.
@@ -6,6 +17,7 @@
6
17
  * Added: mack_ring_server binary to start a Rinda ring server for use with distributed routing.
7
18
  * Sqlite3 is now the default database for Mack applications configured with ORM support.
8
19
  * Added a test helper method, rake_task, to aid in the testing of Rake tasks.
20
+ * Added: rake generate:migration name=<migration_name>
9
21
  * Added: rake db:migrate
10
22
  * Added: rake db:abort_if_pending_migrations
11
23
  * Added: rake db:rollback
data/bin/mack CHANGED
@@ -25,7 +25,7 @@ opts.parse!(ARGV)
25
25
  include FileUtils
26
26
 
27
27
  def mack_version
28
- "0.4.5"
28
+ "0.4.6"
29
29
  end
30
30
 
31
31
  def create_dir(dir)
@@ -56,7 +56,7 @@ erb_files = Dir.glob(File.join(File.dirname(__FILE__), "templates", "**/*.templa
56
56
  erb_files.each do |fl|
57
57
  if fl.match("database.yml") && !options.orm
58
58
  else
59
- res = ERB.new(File.open(fl).read).result(binding)
59
+ res = ERB.new(File.open(fl).read, nil, "->").result(binding)
60
60
  n = fl.gsub(File.join(File.dirname(__FILE__), "templates"), app).gsub(".template", "")
61
61
  File.open(n, "w") {|f| f.puts res}
62
62
  puts "Created: #{n}"
@@ -32,7 +32,7 @@ module Mack
32
32
  # Raise Mack::Errors::RequiredGeneratorParameterMissing if a required parameter
33
33
  # is missing.
34
34
  def initialize(env = {})
35
- @env = env
35
+ @env = env.to_hash
36
36
  self.class.required_params.each do |p|
37
37
  raise Mack::Errors::RequiredGeneratorParameterMissing.new(p) unless param(p)
38
38
  end
@@ -51,7 +51,7 @@ module Mack
51
51
  # Needs to be implemented by the subclass.
52
52
  needs_method :generate
53
53
 
54
- # Takes an input_file runs it through ERB and
54
+ # Takes an input_file runs it through Erubis::Eruby and
55
55
  # saves it to the specified output_file. If the output_file exists it will
56
56
  # be skipped. If you would like to force the writing of the file, use the
57
57
  # :force => true option.
@@ -62,7 +62,7 @@ module Mack
62
62
  return
63
63
  end
64
64
  end
65
- File.open(output_file, "w") {|f| f.puts ERB.new(File.open(input_file).read).result(binding)}
65
+ File.open(output_file, "w") {|f| f.puts ERB.new(File.open(input_file).read, nil, "->").result(binding)}
66
66
  puts "Wrote: #{output_file}"
67
67
  end
68
68
 
@@ -76,6 +76,19 @@ module Mack
76
76
  puts "Created: #{output_dir}"
77
77
  end
78
78
 
79
+ def columns(name = param(:name))
80
+ ivar_cache("form_columns") do
81
+ cs = []
82
+ cols = (param(:cols) || param(:columns))
83
+ if cols
84
+ cols.split(",").each do |x|
85
+ cs << Mack::Generator::ModelColumn.new(name, x)
86
+ end
87
+ end
88
+ cs
89
+ end
90
+ end
91
+
79
92
  end # Base
80
93
  end # Generator
81
94
  end # Mack
@@ -1,3 +1,60 @@
1
+ # This will generate a migration for your application.
2
+ #
3
+ # Example without columns:
4
+ # rake generate:migration name=create_users
5
+ # If using ActiveRecord generates:
6
+ # db/migrations/<number>_create_users.rb:
7
+ # class CreateUsers < ActiveRecord::Migration
8
+ # self.up
9
+ # end
10
+ #
11
+ # self.down
12
+ # end
13
+ # end
14
+ #
15
+ # If using DataMapper generates:
16
+ # db/migrations/<number>_create_users.rb:
17
+ # class CreateUsers < DataMapper::Migration
18
+ # self.up
19
+ # end
20
+ #
21
+ # self.down
22
+ # end
23
+ # end
24
+ #
25
+ # Example with columns:
26
+ # rake generate:migration name=create_users cols=username:string,email_address:string,created_at:datetime,updated_at:datetime
27
+ # If using ActiveRecord generates:
28
+ # db/migrations/<number>_create_users.rb:
29
+ # class CreateUsers < ActiveRecord::Migration
30
+ # self.up
31
+ # create_table :users do |t|
32
+ # t.column :username, :string
33
+ # t.column :email_address, :string
34
+ # t.column :created_at, :datetime
35
+ # t.column :updated_at, :datetime
36
+ # end
37
+ #
38
+ # self.down
39
+ # drop_table :users
40
+ # end
41
+ # end
42
+ #
43
+ # If using DataMapper generates:
44
+ # db/migrations/<number>_create_users.rb:
45
+ # class CreateUsers < DataMapper::Migration
46
+ # self.up
47
+ # create_table :users do |t|
48
+ # t.column :username, :string
49
+ # t.column :email_address, :string
50
+ # t.column :created_at, :datetime
51
+ # t.column :updated_at, :datetime
52
+ # end
53
+ #
54
+ # self.down
55
+ # drop_table :users
56
+ # end
57
+ # end
1
58
  class MigrationGenerator < Mack::Generator::Migration::Base
2
59
 
3
60
  require_param :name
@@ -7,7 +64,9 @@ class MigrationGenerator < Mack::Generator::Migration::Base
7
64
 
8
65
  template_dir = File.join(File.dirname(__FILE__), "templates")
9
66
 
10
- template(File.join(template_dir, "migration.rb.template"), File.join(migrations_directory, "#{next_migration_number}_#{param(:name)}.rb"))
67
+ @table_name = param(:name).underscore.plural.gsub("create_", "")
68
+
69
+ template(File.join(template_dir, "migration.rb.template"), File.join(migrations_directory, "#{next_migration_number}_#{param(:name)}.rb"), :force => param(:force))
11
70
 
12
71
  end
13
72
 
@@ -1,9 +1,31 @@
1
1
  class <%= param(:name).camelcase %> < <%= app_config.orm.camelcase %>::Migration
2
2
 
3
3
  def self.up
4
+ <%
5
+ unless columns.empty?
6
+ -%>
7
+ create_table :<%= @table_name %> do |t|
8
+ <%
9
+ for column in columns
10
+ -%>
11
+ t.column :<%= column.column_name %>, :<%= column.column_type %>
12
+ <%
13
+ end
14
+ -%>
15
+ end
16
+ <%
17
+ end
18
+ -%>
4
19
  end
5
20
 
6
21
  def self.down
22
+ <%
23
+ unless columns.empty?
24
+ -%>
25
+ drop_table :<%= @table_name %>
26
+ <%
27
+ end
28
+ -%>
7
29
  end
8
30
 
9
31
  end
@@ -0,0 +1,55 @@
1
+ module Mack
2
+ module Generator
3
+
4
+ # Used to represent a 'column' from the param cols or columns for generators.
5
+ class ModelColumn
6
+
7
+ # The name of the column.
8
+ attr_accessor :column_name
9
+ # The type of the column. Ie. string, integer, datetime, etc...
10
+ attr_accessor :column_type
11
+ # The name of the model associated with the column. Ie. user, post, etc...
12
+ attr_accessor :model_name
13
+
14
+ # Takes in the model_name (user, post, etc...) and the column (username:string, body:text, etc...)
15
+ def initialize(model_name, column_unsplit)
16
+ self.model_name = model_name.singular.underscore
17
+ cols = column_unsplit.split(":")
18
+ self.column_name = cols.first.singular.underscore
19
+ self.column_type = cols.last.singular.underscore
20
+ end
21
+
22
+ # Examples:
23
+ # Mack::Generator::ColumnObject.new("user", "username:string").form_element_name # => "user[username]"
24
+ # Mack::Generator::ColumnObject.new("Post", "body:text").form_element_name # => "post[body]"
25
+ def form_element_name
26
+ "#{self.model_name}[#{self.column_name}]"
27
+ end
28
+
29
+ # Examples:
30
+ # Mack::Generator::ColumnObject.new("user", "username:string").form_element_id # => "user_username"
31
+ # Mack::Generator::ColumnObject.new("Post", "body:text").form_element_id # => "post_body"
32
+ def form_element_id
33
+ "#{self.model_name}_#{self.column_name}"
34
+ end
35
+
36
+ # Generates the appropriate HTML form field for the type of column represented.
37
+ #
38
+ # Examples:
39
+ # Mack::Generator::ColumnObject.new("user", "username:string").form_field
40
+ # => "<input type="text" name="user[username]" id="user_username" size="30" value="<%= user.username %>" />"
41
+ # Mack::Generator::ColumnObject.new("Post", "body:text").form_field
42
+ # => "<textarea name="post[body]" id="post_id"><%= post.body %></textarea>"
43
+ def form_field
44
+ case self.column_type
45
+ when "text"
46
+ %{<textarea name="#{self.form_element_name}" id="#{self.form_element_id}"><%= @#{self.model_name}.#{self.column_name} %></textarea>}
47
+ else
48
+ %{<input type="text" name="#{self.form_element_name}" id="#{self.form_element_id}" size="30" value="<%= @#{self.model_name}.#{self.column_name} %>" />}
49
+ end
50
+ end
51
+
52
+ end # ModelColumn
53
+
54
+ end # Generator
55
+ end # Mack
@@ -0,0 +1,96 @@
1
+ # This will generate an ORM 'model' for your application based on the specified ORM you're using.
2
+ #
3
+ # Example without columns:
4
+ # rake generate:model name=user
5
+ # If using ActiveRecord generates:
6
+ # app/models/user.rb:
7
+ # class User < ActiveRecord::Base
8
+ # end
9
+ # db/migrations/<number>_create_users.rb:
10
+ # class CreateUsers < ActiveRecord::Migration
11
+ # self.up
12
+ # end
13
+ #
14
+ # self.down
15
+ # end
16
+ # end
17
+ #
18
+ # If using DataMapper generates:
19
+ # app/models/user.rb:
20
+ # class User < DataMapper::Base
21
+ # end
22
+ # db/migrations/<number>_create_users.rb:
23
+ # class CreateUsers < DataMapper::Migration
24
+ # self.up
25
+ # end
26
+ #
27
+ # self.down
28
+ # end
29
+ # end
30
+ #
31
+ # Example with columns:
32
+ # rake generate:model name=user cols=username:string,email_address:string,created_at:datetime,updated_at:datetime
33
+ # If using ActiveRecord generates:
34
+ # app/models/user.rb:
35
+ # class User < ActiveRecord::Base
36
+ # end
37
+ # db/migrations/<number>_create_users.rb:
38
+ # class CreateUsers < ActiveRecord::Migration
39
+ # self.up
40
+ # create_table :users do |t|
41
+ # t.column :username, :string
42
+ # t.column :email_address, :string
43
+ # t.column :created_at, :datetime
44
+ # t.column :updated_at, :datetime
45
+ # end
46
+ #
47
+ # self.down
48
+ # drop_table :users
49
+ # end
50
+ # end
51
+ #
52
+ # If using DataMapper generates:
53
+ # app/models/user.rb:
54
+ # class User < DataMapper::Base
55
+ # property :username, :string
56
+ # property :email_address, :string
57
+ # property :created_at, :datetime
58
+ # property :updated_at, :datetime
59
+ # end
60
+ # db/migrations/<number>_create_users.rb:
61
+ # class CreateUsers < DataMapper::Migration
62
+ # self.up
63
+ # create_table :users do |t|
64
+ # t.column :username, :string
65
+ # t.column :email_address, :string
66
+ # t.column :created_at, :datetime
67
+ # t.column :updated_at, :datetime
68
+ # end
69
+ #
70
+ # self.down
71
+ # drop_table :users
72
+ # end
73
+ # end
74
+ class ModelGenerator < Mack::Generator::Base
75
+
76
+ require_param :name
77
+
78
+ def generate
79
+ directory(File.join(MACK_APP, "models"))
80
+
81
+ @columns = ""
82
+ cols = (param(:cols) || param(:columns))
83
+ if cols
84
+ cols = cols.split("|")
85
+ cols.each_with_index do |v, i|
86
+ x = v.split(":")
87
+ @columns << "property :#{x.first}, :#{x.last}\n "
88
+ end
89
+ @columns.strip!
90
+ end
91
+
92
+ template(File.join(File.dirname(__FILE__), "templates", "app", "models", "#{app_config.orm}.rb.template"), File.join(MACK_APP, "models", "#{param(:name).singular.underscore}.rb"), :force => param(:force))
93
+ MigrationGenerator.new(@env.merge({"name" => "create_#{param(:name).plural}"})).generate
94
+ end
95
+
96
+ end
@@ -0,0 +1,2 @@
1
+ class <%= param(:name).singular.camelcase %> < ActiveRecord::Base
2
+ end
@@ -0,0 +1,9 @@
1
+ class <%= param(:name).singular.camelcase %> < DataMapper::Base
2
+ <%
3
+ for column in columns
4
+ -%>
5
+ property :<%= column.column_name %>, :<%= column.column_type %>
6
+ <%
7
+ end
8
+ -%>
9
+ end
@@ -23,9 +23,9 @@ class PluginGenerator < Mack::Generator::Base
23
23
  directory(File.join(plugin_dir, "lib", "tasks"))
24
24
 
25
25
  # create vendor/plugins/<name>/init.rb
26
- template(File.join(template_dir, "init.rb.template"), File.join(plugin_dir, "init.rb"))
26
+ template(File.join(template_dir, "init.rb.template"), File.join(plugin_dir, "init.rb"), :force => param(:force))
27
27
  # create vendor/plugins/<name>/lib/<name>.rb
28
- template(File.join(template_dir, "lib", "plugin.rb.template"), File.join(plugin_dir, "lib", "#{param(:name).downcase}.rb"))
28
+ template(File.join(template_dir, "lib", "plugin.rb.template"), File.join(plugin_dir, "lib", "#{param(:name).downcase}.rb"), :force => param(:force))
29
29
 
30
30
  end
31
31
 
@@ -7,8 +7,8 @@ class ScaffoldGenerator < Mack::Generator::Base
7
7
  require_param :name
8
8
 
9
9
  def generate # :nodoc:
10
- @name_singular = param(:name).singular
11
- @name_plural = param(:name).plural
10
+ @name_singular = param(:name).singular.underscore
11
+ @name_plural = param(:name).plural.underscore
12
12
  @name_singular_camel = @name_singular.camelcase
13
13
  @name_plural_camel = @name_plural.camelcase
14
14
 
@@ -43,12 +43,11 @@ class ScaffoldGenerator < Mack::Generator::Base
43
43
  directory(app_views_dir)
44
44
 
45
45
  template(File.join(temp_dir, "generic", "app", "controllers", "controller.rb.template"), File.join(app_cont_dir, "#{@name_plural}_controller.rb"), :force => param(:force))
46
- template(File.join(temp_dir, "generic", "app", "models", "model.rb.template"), File.join(app_model_dir, "#{@name_singular}.rb"), :force => param(:force))
47
46
  template(File.join(temp_dir, "generic", "app", "views", "index.html.erb.template"), File.join(app_views_dir, "index.html.erb"), :force => param(:force))
48
47
  template(File.join(temp_dir, "generic", "app", "views", "edit.html.erb.template"), File.join(app_views_dir, "edit.html.erb"), :force => param(:force))
49
48
  template(File.join(temp_dir, "generic", "app", "views", "new.html.erb.template"), File.join(app_views_dir, "new.html.erb"), :force => param(:force))
50
49
  template(File.join(temp_dir, "generic", "app", "views", "show.html.erb.template"), File.join(app_views_dir, "show.html.erb"), :force => param(:force))
51
- MigrationGenerator.new("NAME" => "create_#{@name_plural}").run
50
+ ModelGenerator.new(@env).run
52
51
  else
53
52
  template(File.join(temp_dir, "no_orm", "app", "controllers", "controller.rb.template"), File.join(app_cont_dir, "#{@name_plural}_controller.rb"), :force => param(:force))
54
53
  end
@@ -1,10 +1,17 @@
1
- <h1>Edit <%= @name_singular %></h1>
1
+ <h1>Edit <%= @name_singular_camel %></h1>
2
2
 
3
3
  <%%= error_messages_for :<%= @name_singular %> %>
4
4
 
5
5
  <form action="<%%= <%= @name_singular %>s_update_url(:id => @<%= @name_singular %>.id) %>" class="edit_<%= @name_singular %>" id="edit_<%= @name_singular %>" method="<%= @name_singular %>">
6
6
  <input type="hidden" name="_method" value="put">
7
-
7
+ <% for column in columns -%>
8
+ <% unless column.column_name == "created_at" || column.column_name == "updated_at" -%>
9
+ <p>
10
+ <b><%= column.column_name.singular.camelcase %></b><br />
11
+ <%= column.form_field %>
12
+ </p>
13
+ <% end -%>
14
+ <% end -%>
8
15
  <p>
9
16
  <input id="<%= @name_singular %>_submit" name="commit" type="submit" value="Create" />
10
17
  </p>
@@ -1,13 +1,34 @@
1
- <h1>Listing <%= @name_plural %></h1>
1
+ <h1>Listing <%= @name_plural_camel %></h1>
2
2
 
3
3
  <table>
4
4
  <tr>
5
+ <%
6
+ unless columns.empty?
7
+ columns.each do |col|
8
+ -%>
9
+ <th><%= col.column_name.camelcase %></th>
10
+ <%
11
+ end
12
+ else
13
+ -%>
5
14
  <th>&nbsp;</th>
15
+ <%
16
+ end
17
+ -%>
6
18
  </tr>
7
19
 
8
20
  <%% for <%= @name_singular %> in @<%= @name_plural %> %>
9
21
  <tr>
22
+ <%
23
+ unless columns.empty?
24
+ columns.each do |col| -%>
25
+ <td><%%= <%= @name_singular %>.<%= col.column_name %> %></td>
26
+ <%
27
+ end
28
+ else
29
+ -%>
10
30
  <td>&nbsp;</td>
31
+ <% end -%>
11
32
  <td><%%= link_to("Show", <%= @name_plural %>_show_url(:id => <%= @name_singular %>.id)) %></td>
12
33
  <td><%%= link_to("Edit", <%= @name_plural %>_edit_url(:id => <%= @name_singular %>.id)) %></td>
13
34
  <td><%%= link_to("Delete", <%= @name_plural %>_delete_url(:id => <%= @name_singular %>.id), :method => :delete, :confirm => "Are you sure?") %></td>
@@ -1,9 +1,16 @@
1
- <h1>New <%= @name_singular %></h1>
1
+ <h1>New <%= @name_singular_camel %></h1>
2
2
 
3
3
  <%%= error_messages_for :<%= @name_singular %> %>
4
4
 
5
5
  <form action="<%%= <%= @name_singular %>s_create_url %>" class="new_<%= @name_singular %>" id="new_<%= @name_singular %>" method="<%= @name_singular %>">
6
-
6
+ <% for column in columns -%>
7
+ <% unless column.column_name == "created_at" || column.column_name == "updated_at" -%>
8
+ <p>
9
+ <b><%= column.column_name.singular.camelcase %></b><br />
10
+ <%= column.form_field %>
11
+ </p>
12
+ <% end -%>
13
+ <% end -%>
7
14
  <p>
8
15
  <input id="<%= @name_singular %>_submit" name="commit" type="submit" value="Create" />
9
16
  </p>
@@ -1,7 +1,12 @@
1
1
  <p>
2
- <%%= @<%= @name_singular %>.inspect %>
2
+ <h1><%= @name_singular_camel %></h1>
3
3
  </p>
4
-
4
+ <% for column in columns -%>
5
+ <p>
6
+ <b><%= column.column_name.singular.camelcase %></b><br />
7
+ <%%= @<%= @name_singular %>.<%= column.column_name %> %>
8
+ </p>
9
+ <% end -%>
5
10
 
6
11
  <%%= link_to("Edit", <%= @name_plural %>_edit_url(:id => @<%= @name_singular %>.id)) %> |
7
12
  <%%= link_to("Back", <%= @name_plural %>_index_url) %>
@@ -37,6 +37,7 @@ module Mack
37
37
  DEFAULTS_TEST = {
38
38
  "log::level" => "error",
39
39
  "run_remote_tests" => true,
40
+ "mack::drb_timeout" => 0
40
41
  } unless self.const_defined?("DEFAULTS_TEST")
41
42
 
42
43
  unless self.const_defined?("DEFAULTS")
@@ -12,6 +12,9 @@ require 'uri'
12
12
  require 'drb'
13
13
  require 'rinda/ring'
14
14
  require 'rinda/tuplespace'
15
+ require 'builder'
16
+ require 'erubis'
17
+ require 'erb'
15
18
 
16
19
  # Set up Mack constants, if they haven't already been set up.
17
20
  unless Object.const_defined?("MACK_ENV")
@@ -29,6 +32,7 @@ Object::MACK_PLUGINS = File.join(MACK_ROOT, "vendor", "plugins") unless Object.c
29
32
 
30
33
  unless Object.const_defined?("MACK_INITIALIZED")
31
34
  puts "Starting application in #{MACK_ENV} mode."
35
+ puts "Mack root: #{MACK_ROOT}"
32
36
 
33
37
  Object::MACK_INITIALIZED = true
34
38
 
@@ -21,7 +21,7 @@ module DataMapper # :nodoc:
21
21
  end
22
22
 
23
23
  unless app_config.orm.nil?
24
- dbs = YAML::load(ERB.new(IO.read(File.join(MACK_CONFIG, "database.yml"))).result)
24
+ dbs = YAML::load(Erubis::Eruby.new(IO.read(File.join(MACK_CONFIG, "database.yml"))).result)
25
25
  case app_config.orm
26
26
  when 'active_record'
27
27
  require 'activerecord'
data/lib/mack.rb CHANGED
@@ -69,9 +69,9 @@ module Mack
69
69
  exception = e
70
70
  end
71
71
  end
72
- return self.response.finish unless exception
73
72
  end
74
73
  raise exception if exception
74
+ self.response.finish
75
75
  end
76
76
 
77
77
  def session
@@ -53,6 +53,7 @@ module Mack
53
53
  parts[parts.size - 1] = "_" << parts.last if options[:is_partial]
54
54
  partial = File.join(options[:dir], parts.join("/") + options[:ext])
55
55
  end
56
+ raise Errno::ENOENT.new(partial) unless File.exists?(partial)
56
57
  return Mack::ViewBinder.render(File.open(partial).read, self.view_binder.controller, options)
57
58
  end
58
59
 
@@ -1,4 +1,4 @@
1
- require 'erb'
1
+ require 'erubis'
2
2
  module Mack
3
3
  module Controller # :nodoc:
4
4
  # All controllers in a Mack application have to extend this class. I'll be honest, if they don't extend this class
@@ -291,8 +291,9 @@ module Mack
291
291
  if @result_of_action_called.is_a?(String)
292
292
  @render_options[:text] = @result_of_action_called
293
293
  return Mack::ViewBinder.new(self).render(@render_options)
294
+ else
295
+ raise e
294
296
  end
295
-
296
297
  end
297
298
  end
298
299
  end # complete_action_render
@@ -26,7 +26,7 @@ module Mack
26
26
  #
27
27
  # <tt>after_render</tt> filters get run after the rendering of the action has happened. At this point
28
28
  # there is an instance variable, <tt>@final_rendered_action</tt>, that is available on which work can be done.
29
- # This variable will have any layouts rendered to, any ERB will have been processed, etc... It should be the final
29
+ # This variable will have any layouts rendered to, any Erubis::Eruby will have been processed, etc... It should be the final
30
30
  # String that will get rendered to the screen. This is a great place to do things like write a log, gzip, etc...
31
31
  class Filter
32
32
 
@@ -1,5 +1,3 @@
1
- require 'builder'
2
- # require 'erubis'
3
1
  # This class is used to do all the view level bindings.
4
2
  # It allows for seperation between the controller and the view levels.
5
3
  class Mack::ViewBinder
@@ -70,7 +68,7 @@ class Mack::ViewBinder
70
68
 
71
69
  class << self
72
70
 
73
- # Creates a Mack::ViewBinder and then passes the io through ERB
71
+ # Creates a Mack::ViewBinder and then passes the io through Erubis::Eruby
74
72
  # and returns a String. The io can be either an IO object or a String.
75
73
  def render(io, controller, options = {})
76
74
  vb = Mack::ViewBinder.new(controller, options)
@@ -78,9 +76,8 @@ class Mack::ViewBinder
78
76
  if ((controller.params(:format).to_sym == :xml) || options[:format] == :xml) && (options[:action] || options[:xml])
79
77
  return eval(io, vb.view_binding)
80
78
  else
81
- return ERB.new(io).result(vb.view_binding)
79
+ return Erubis::Eruby.new(io).result(vb.view_binding)
82
80
  end
83
- # return Erubis::Eruby.new(io).result(vb.view_binding)
84
81
  end
85
82
 
86
83
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.5
4
+ version: 0.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - markbates
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-04-14 00:00:00 -04:00
12
+ date: 2008-04-18 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -64,7 +64,7 @@ dependencies:
64
64
  requirements:
65
65
  - - "="
66
66
  - !ruby/object:Gem::Version
67
- version: 0.7.1
67
+ version: 0.8.0
68
68
  version:
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: builder
@@ -93,6 +93,15 @@ dependencies:
93
93
  - !ruby/object:Gem::Version
94
94
  version: 1.0.10
95
95
  version:
96
+ - !ruby/object:Gem::Dependency
97
+ name: erubis
98
+ version_requirement:
99
+ version_requirements: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "="
102
+ - !ruby/object:Gem::Version
103
+ version: 2.5.0
104
+ version:
96
105
  description: Mack is a powerful, yet simple, web application framework. It takes some cues from the likes of Rails and Merb, so it's not entirely unfamiliar. Mack hopes to provide developers a great framework for building, and deploying, portal and distributed applications.
97
106
  email: mark@mackframework.com
98
107
  executables:
@@ -115,12 +124,15 @@ files:
115
124
  - lib/generators/migration/base.rb
116
125
  - lib/generators/migration_generator/migration_generator.rb
117
126
  - lib/generators/migration_generator/templates/migration.rb.template
127
+ - lib/generators/model_column.rb
128
+ - lib/generators/model_generator/model_generator.rb
129
+ - lib/generators/model_generator/templates/app/models/active_record.rb.template
130
+ - lib/generators/model_generator/templates/app/models/data_mapper.rb.template
118
131
  - lib/generators/plugin_generator/plugin_generator.rb
119
132
  - lib/generators/plugin_generator/templates/init.rb.template
120
133
  - lib/generators/plugin_generator/templates/lib/plugin.rb.template
121
134
  - lib/generators/scaffold_generator/scaffold_generator.rb
122
135
  - lib/generators/scaffold_generator/templates/generic/app/controllers/controller.rb.template
123
- - lib/generators/scaffold_generator/templates/generic/app/models/model.rb.template
124
136
  - lib/generators/scaffold_generator/templates/generic/app/views/edit.html.erb.template
125
137
  - lib/generators/scaffold_generator/templates/generic/app/views/index.html.erb.template
126
138
  - lib/generators/scaffold_generator/templates/generic/app/views/new.html.erb.template
@@ -1,2 +0,0 @@
1
- class <%= @name_singular_camel %> < <%= app_config.orm.camelcase %>::Base
2
- end