ixtlan-generators 0.1.4 → 0.1.5
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/lib/generators/ixtlan/configuration_base.rb +4 -0
- data/lib/generators/ixtlan/templates/seed.rb +15 -0
- data/lib/generators/rails/active_record/model/model.rb +6 -3
- data/lib/generators/rails/scaffold_controller/scaffold_controller/controller.rb +1 -1
- data/lib/generators/rails/scaffold_controller/scaffold_controller/singleton_controller.rb +1 -1
- metadata +3 -3
- data/lib/generators/ixtlan/setup/templates/initializer.rb +0 -64
@@ -0,0 +1,15 @@
|
|
1
|
+
|
2
|
+
c = Configuration.new
|
3
|
+
<% if options[:modified_by] -%>
|
4
|
+
c.modified_by_id = 0
|
5
|
+
<% end -%>
|
6
|
+
<% if defined? Ixtlan::Errors -%>
|
7
|
+
c.errors_keep_dumps = 30
|
8
|
+
<% end -%>
|
9
|
+
<% if defined? Ixtlan::Sessions -%>
|
10
|
+
c.idle_session_timeout = 15
|
11
|
+
<% end -%>
|
12
|
+
<% if defined? Ixtlan::Audit -%>
|
13
|
+
c.audits_keep_logs = 90
|
14
|
+
<% end -%>
|
15
|
+
c.save
|
@@ -3,7 +3,7 @@ class <%= class_name %> < <%= parent_class_name.classify %>
|
|
3
3
|
belongs_to :<%= attribute.name %>
|
4
4
|
<% end -%>
|
5
5
|
<% attributes.select {|attr| [:has_one, :has_many].include?(attr.type) }.each do |attribute| -%>
|
6
|
-
<%= attribute.type %> :<%= attribute.name %>
|
6
|
+
<%= attribute.type %> :<%= attribute.name.singularize %>
|
7
7
|
<% end -%>
|
8
8
|
<% if options[:modified_by] -%>
|
9
9
|
belongs_to :modified_by, :class_name => "User"
|
@@ -19,8 +19,11 @@ class <%= class_name %> < <%= parent_class_name.classify %>
|
|
19
19
|
def self.options
|
20
20
|
{
|
21
21
|
<% except = []
|
22
|
-
|
23
|
-
|
22
|
+
if options[:timestamps]
|
23
|
+
except = [:created_at]
|
24
|
+
except << :updated_at unless options[:optimistic]
|
25
|
+
end
|
26
|
+
except << :modified_by_id if options[:modified_by] -%>
|
24
27
|
:except => <%= except.inspect %>
|
25
28
|
}
|
26
29
|
end
|
@@ -10,7 +10,7 @@ class <%= controller_class_name %>Controller < ApplicationController
|
|
10
10
|
model.delete :id
|
11
11
|
<% if options[:timestamps] -%>
|
12
12
|
model.delete :created_at
|
13
|
-
<% if options[:optimistic] -%>params[:updated_at]
|
13
|
+
<% if options[:optimistic] -%>params[:updated_at] ||= <% end -%>model.delete :updated_at
|
14
14
|
<% if options[:optimistic] -%>
|
15
15
|
end
|
16
16
|
|
@@ -9,7 +9,7 @@ class <%= controller_class_name %>Controller < ApplicationController
|
|
9
9
|
model = params[:<%= singular_table_name %>] || []
|
10
10
|
<% if options[:timestamps] -%>
|
11
11
|
model.delete :created_at
|
12
|
-
<% if options[:optimistic] -%>params[:updated_at]
|
12
|
+
<% if options[:optimistic] -%>params[:updated_at] ||= <% end -%>model.delete :updated_at
|
13
13
|
<% if options[:optimistic] -%>
|
14
14
|
end
|
15
15
|
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: ixtlan-generators
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.5
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- mkristian
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date:
|
13
|
+
date: 2012-01-30 00:00:00 +05:30
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -151,7 +151,6 @@ files:
|
|
151
151
|
- lib/generators/ixtlan/setup/templates/error_with_session.html.erb~
|
152
152
|
- lib/generators/ixtlan/setup/templates/application_layout.html.erb
|
153
153
|
- lib/generators/ixtlan/setup/templates/preinitializer.rb
|
154
|
-
- lib/generators/ixtlan/setup/templates/initializer.rb
|
155
154
|
- lib/generators/ixtlan/setup/templates/gitignore
|
156
155
|
- lib/generators/ixtlan/setup/templates/initializer.rb~
|
157
156
|
- lib/generators/ixtlan/setup/templates/passwords.yml.example
|
@@ -165,6 +164,7 @@ files:
|
|
165
164
|
- lib/generators/ixtlan/error_dumps_scaffold/error_dumps_scaffold_generator.rb~
|
166
165
|
- lib/generators/ixtlan/templates/dynamic.rb~
|
167
166
|
- lib/generators/ixtlan/templates/dynamic.rb
|
167
|
+
- lib/generators/ixtlan/templates/seed.rb
|
168
168
|
- lib/ixtlan/railtie.rb~
|
169
169
|
- lib/ixtlan/railtie.rb
|
170
170
|
- features/step_definitions/simple_steps.rb
|
@@ -1,64 +0,0 @@
|
|
1
|
-
# dynamic configuration through a Configuration singleton model
|
2
|
-
|
3
|
-
# configuration model
|
4
|
-
# -------------------
|
5
|
-
# CONFIGURATION = Configuration
|
6
|
-
# config.configuration_model = CONFIGURATION
|
7
|
-
begin
|
8
|
-
config_instance = CONFIGURATION.instance
|
9
|
-
rescue
|
10
|
-
# allow rake tasks to work without configuration migrated
|
11
|
-
return
|
12
|
-
end
|
13
|
-
|
14
|
-
# notification email on errors and dump directory for the system dump
|
15
|
-
# the error dumps will be cleanup after the days to keeps dump expired
|
16
|
-
# --------------------------------------------------------------------
|
17
|
-
# config_instance.register("error_dumper") do |config|
|
18
|
-
# Rails.configuration.error_dumper.dump_dir = config.errors_dir
|
19
|
-
# Rails.configuration.error_dumper.email_from = config.errors_from
|
20
|
-
# Rails.configuration.error_dumper.email_to = config.errors_to
|
21
|
-
# Rails.configuration.error_dumper.keep_dumps = config.errors_keep_dump # days
|
22
|
-
# end
|
23
|
-
|
24
|
-
# idle session timeout configuration (in minutes)
|
25
|
-
# -----------------------------------------------
|
26
|
-
# config_instance.register("session_idle_timeout") do |config|
|
27
|
-
# Rails.configuration.session_idle_timeout = config.session_idle_timeout
|
28
|
-
# end
|
29
|
-
|
30
|
-
# audit log manager
|
31
|
-
# -----------------
|
32
|
-
|
33
|
-
# config.audit_manager.model = MyAudit # default: Audit
|
34
|
-
# config.audit_manager.username_method = :username # default: :login
|
35
|
-
|
36
|
-
# config_instance.register("audit_manager") do |config|
|
37
|
-
# Rails.configuration.audit_manager.keep_log = config.keep_log # days
|
38
|
-
# end
|
39
|
-
|
40
|
-
# --------------------
|
41
|
-
# static configuration
|
42
|
-
# --------------------
|
43
|
-
|
44
|
-
# error dumper
|
45
|
-
# ------------
|
46
|
-
# notification email on errors and dump directory for the system dump. per
|
47
|
-
# default there is no email notification and if email_from or email_to is
|
48
|
-
# missing then there is no email too
|
49
|
-
|
50
|
-
# config.error_dumper.dump_dir = Rails.root + "/log/errors" # default: log/errors
|
51
|
-
# config.error_dumper.email_from = "no-reply@example.com"
|
52
|
-
# config.error_dumper.email_to = "developer1@example.com,developer2@example.com"
|
53
|
-
# config.error_dumper.keep_dumps = 30 # days
|
54
|
-
# config.skip_rescue_module = true # do not include the predefined Rescue
|
55
|
-
|
56
|
-
# idle session timeout configuration
|
57
|
-
# ----------------------------------
|
58
|
-
# config.session_idle_timeout = 30 #minutes
|
59
|
-
|
60
|
-
# audit log manager
|
61
|
-
# -----------------
|
62
|
-
# config.audit_manager.model = MyAudit # default: Audit
|
63
|
-
# config.audit_manager.username_method = :username # default: :login
|
64
|
-
# config.audit_manager.keep_log = 30 # days
|