somatics3-generators 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. data/Rakefile +9 -1
  2. data/VERSION +1 -1
  3. data/bin/somatics +0 -0
  4. data/bin/somatify +0 -0
  5. data/lib/generators/somatics/associated/associated_generator.rb +184 -0
  6. data/lib/generators/somatics/associated/templates/migration.rb +11 -0
  7. data/lib/generators/somatics/attributes/attributes_generator.rb +8 -5
  8. data/lib/generators/somatics/authenticated/authenticated_generator.rb +27 -195
  9. data/lib/generators/somatics/authenticated/templates/partial_form.html.erb +23 -0
  10. data/lib/generators/somatics/authenticated_controller/authenticated_controller_generator.rb +14 -299
  11. data/lib/generators/somatics/authenticated_controller/templates/locales_en.yml +6 -0
  12. data/lib/generators/somatics/authenticated_controller/templates/locales_zh-TW.yml +6 -0
  13. data/lib/generators/somatics/authenticated_controller/templates/login.html.erb +10 -8
  14. data/lib/generators/somatics/authenticated_controller/templates/sessions_controller.rb +11 -43
  15. data/lib/generators/somatics/install/install_generator.rb +26 -3
  16. data/lib/generators/somatics/install/templates/config/locales/devise_zh-TW.yml +39 -0
  17. data/lib/generators/somatics/install/templates/controller_admin.rb +8 -4
  18. data/lib/generators/somatics/install/templates/helper_admin.rb +39 -3
  19. data/lib/generators/somatics/install/templates/initializer_paper_trail.rb +2 -0
  20. data/lib/generators/somatics/install/templates/layout_admin.html.erb +4 -4
  21. data/lib/generators/somatics/install/templates/lib/active_record/diff.rb +61 -0
  22. data/lib/generators/somatics/install/templates/lib/tasks/heroku.rake +30 -0
  23. data/lib/generators/somatics/install/templates/lib/tasks/svn.rake +47 -0
  24. data/lib/generators/somatics/install/templates/partial_versions.html.erb +56 -0
  25. data/lib/generators/somatics/install/templates/public/stylesheets/application.css +863 -0
  26. data/lib/generators/somatics/install/templates/public/stylesheets/somatics/base.css +3 -0
  27. data/lib/generators/somatics/install/templates/public/themes/default/stylesheets/application.css +951 -0
  28. data/lib/generators/somatics/install/templates/view_index.html.erb +46 -1
  29. data/lib/generators/somatics/scaffold/scaffold_generator.rb +0 -1
  30. data/lib/generators/somatics/scaffold_controller/scaffold_controller_generator.rb +31 -60
  31. data/lib/generators/somatics/scaffold_controller/templates/controller.rb +4 -21
  32. data/lib/generators/somatics/scaffold_controller/templates/view_index.html.erb +3 -4
  33. data/lib/generators/somatics/scaffold_controller/templates/view_show.html.erb +2 -0
  34. data/lib/generators/somatics/settings/settings_generator.rb +7 -3
  35. data/lib/generators/somatics/settings_controller/templates/controller.rb +4 -20
  36. data/lib/generators/somatics/settings_controller/templates/partial_form.html.erb +1 -1
  37. data/lib/generators/somatics/settings_controller/templates/view_index.html.erb +2 -2
  38. data/somatics3-generators.gemspec +28 -37
  39. data/templates/somatics.rb +76 -121
  40. metadata +70 -64
  41. data/lib/generators/somatics/authenticated/templates/mailer.rb +0 -25
  42. data/lib/generators/somatics/authenticated/templates/migration.rb +0 -26
  43. data/lib/generators/somatics/authenticated/templates/model.rb +0 -83
  44. data/lib/generators/somatics/authenticated/templates/observer.rb +0 -11
  45. data/lib/generators/somatics/authenticated/templates/test/mailer_test.rb +0 -31
  46. data/lib/generators/somatics/authenticated/templates/test/model_functional_test.rb +0 -93
  47. data/lib/generators/somatics/authenticated/templates/test/sessions_functional_test.rb +0 -82
  48. data/lib/generators/somatics/authenticated/templates/test/unit_test.rb +0 -164
  49. data/lib/generators/somatics/authenticated/templates/test/users.yml +0 -60
  50. data/lib/generators/somatics/authenticated_controller/templates/_model_partial.html.erb +0 -8
  51. data/lib/generators/somatics/authenticated_controller/templates/activation.erb +0 -3
  52. data/lib/generators/somatics/authenticated_controller/templates/authenticated_system.rb +0 -189
  53. data/lib/generators/somatics/authenticated_controller/templates/authenticated_test_helper.rb +0 -10
  54. data/lib/generators/somatics/authenticated_controller/templates/config/initializers/site_keys.rb +0 -38
  55. data/lib/generators/somatics/authenticated_controller/templates/controller.rb +0 -55
  56. data/lib/generators/somatics/authenticated_controller/templates/helper.rb +0 -91
  57. data/lib/generators/somatics/authenticated_controller/templates/mailer.rb +0 -25
  58. data/lib/generators/somatics/authenticated_controller/templates/migration.rb +0 -26
  59. data/lib/generators/somatics/authenticated_controller/templates/model.rb +0 -83
  60. data/lib/generators/somatics/authenticated_controller/templates/observer.rb +0 -11
  61. data/lib/generators/somatics/authenticated_controller/templates/session_helper.rb +0 -2
  62. data/lib/generators/somatics/authenticated_controller/templates/signup.html.erb +0 -19
  63. data/lib/generators/somatics/authenticated_controller/templates/signup_notification.erb +0 -8
  64. data/lib/generators/somatics/authenticated_controller/templates/test/mailer_test.rb +0 -31
  65. data/lib/generators/somatics/authenticated_controller/templates/test/model_functional_test.rb +0 -93
  66. data/lib/generators/somatics/authenticated_controller/templates/test/sessions_functional_test.rb +0 -82
  67. data/lib/generators/somatics/authenticated_controller/templates/test/unit_test.rb +0 -164
  68. data/lib/generators/somatics/authenticated_controller/templates/test/users.yml +0 -60
  69. data/lib/generators/somatics/scaffold_controller/templates/builder_index.pdf.prawn +0 -25
  70. data/lib/generators/somatics/settings_controller/templates/builder_index.pdf.prawn +0 -25
  71. data/lib/generators/somatics/settings_controller/templates/model.rb +0 -54
@@ -1,60 +0,0 @@
1
- <%
2
- ## this code must match that in templates/model.rb
3
- require 'digest/sha1'
4
- def make_fake_token
5
- @fake_token_counter ||= 0
6
- @fake_token_counter += 1
7
- Digest::SHA1.hexdigest(@fake_token_counter.to_s)
8
- end
9
- salts = (1..2).map{ make_fake_token }
10
- passwds = salts.map{ |salt| password_digest('monkey', salt) }
11
- -%>
12
-
13
- quentin:
14
- id: 1
15
- login: quentin
16
- email: quentin@example.com
17
- salt: <%= salts[0] %> # SHA1('0')
18
- crypted_password: <%= passwds[0] %> # 'monkey'
19
- created_at: <%%= 5.days.ago.to_s :db %>
20
- remember_token_expires_at: <%%= 1.days.from_now.to_s %>
21
- remember_token: <%= make_fake_token %>
22
- <% if options[:include_activation] -%>
23
- activation_code:
24
- activated_at: <%%= 5.days.ago.to_s :db %>
25
- <% end -%>
26
- <% if options[:stateful] -%>
27
- state: active
28
- <% end -%>
29
-
30
- aaron:
31
- id: 2
32
- login: aaron
33
- email: aaron@example.com
34
- salt: <%= salts[1] %> # SHA1('1')
35
- crypted_password: <%= passwds[1] %> # 'monkey'
36
- created_at: <%%= 1.days.ago.to_s :db %>
37
- remember_token_expires_at:
38
- remember_token:
39
- <% if options[:include_activation] -%>
40
- activation_code: <%= make_fake_token %>
41
- activated_at:
42
- <% end -%>
43
- <% if options[:stateful] %>
44
- state: pending
45
- <% end -%>
46
-
47
-
48
- old_password_holder:
49
- id: 3
50
- login: old_password_holder
51
- email: salty_dog@example.com
52
- salt: 7e3041ebc2fc05a40c60028e2c4901a81035d3cd
53
- crypted_password: 00742970dc9e6319f8019fd54864d3ea740f04b1 # test
54
- created_at: <%%= 1.days.ago.to_s :db %>
55
- <% if options[:include_activation] %>
56
- activation_code:
57
- activated_at: <%%= 5.days.ago.to_s :db %>
58
- <% end %>
59
- <% if options[:stateful] %>
60
- state: active<% end %>
@@ -1,25 +0,0 @@
1
- pdf.header pdf.margin_box.top_left do
2
- # pdf.image "#{RAILS_ROOT}/public/images/logo.png", :fit => [60,24]
3
- pdf.text "<%= plural_name.humanize %>", :size => 16, :align => :center
4
- end
5
-
6
- fields = params[:fields]# - [""]
7
-
8
- entries = @<%= plural_name %>.collect do |<%= singular_name %>|
9
- fields.collect do |f|
10
- <%= singular_name %>.send(f)
11
- end
12
- end
13
-
14
- x_pos = ((pdf.bounds.width / 2) - 150)
15
- y_pos = ((pdf.bounds.height / 2) + 300)
16
- pdf.bounding_box([x_pos, y_pos], :width => 300, :height => 450) do
17
- pdf.table entries, :border_style => :grid,
18
- :row_colors => ["FFFFFF","DDDDDD"],
19
- :headers => @headers,
20
- :position => :center,
21
- :font_size => 9
22
- end
23
-
24
- pdf.number_pages "<page>/<total>", [pdf.bounds.right - 50, 0]
25
-
@@ -1,25 +0,0 @@
1
- pdf.header pdf.margin_box.top_left do
2
- # pdf.image "#{RAILS_ROOT}/public/images/logo.png", :fit => [60,24]
3
- pdf.text "<%= plural_name.humanize %>", :size => 16, :align => :center
4
- end
5
-
6
- fields = params[:fields]# - [""]
7
-
8
- entries = @<%= plural_name %>.collect do |<%= singular_name %>|
9
- fields.collect do |f|
10
- <%= singular_name %>.send(f)
11
- end
12
- end
13
-
14
- x_pos = ((pdf.bounds.width / 2) - 150)
15
- y_pos = ((pdf.bounds.height / 2) + 300)
16
- pdf.bounding_box([x_pos, y_pos], :width => 300, :height => 450) do
17
- pdf.table entries, :border_style => :grid,
18
- :row_colors => ["FFFFFF","DDDDDD"],
19
- :headers => @headers,
20
- :position => :center,
21
- :font_size => 9
22
- end
23
-
24
- pdf.number_pages "<page>/<total>", [pdf.bounds.right - 50, 0]
25
-
@@ -1,54 +0,0 @@
1
- class <%= model_name %> < ActiveRecord::Base
2
- GENERAL = 'General'
3
- CATEGORIES = [GENERAL]
4
- FIELD_TYPES = ['integer', 'string', 'float', 'text', 'boolean']
5
-
6
- attr_protected :name, :field_type, :description, :category, :mce_editable
7
-
8
- validates_presence_of :name
9
- validates_uniqueness_of :name
10
- validates_presence_of :field_type
11
- validates_inclusion_of :field_type, :in => FIELD_TYPES
12
- validates_presence_of :category
13
- validates_inclusion_of :category, :in => CATEGORIES
14
- validates_presence_of :value, :allow_blank => true
15
- validates_numericality_of :value, :if => Proc.new {|setting| ['integer', 'float'].include?(setting.field_type) }
16
-
17
- def self.[](name)
18
- raise SettingNotFound unless <%= singular_name %> = <%= model_name %>.find_by_name(name)
19
- setting.parsed_value
20
- end
21
-
22
- def self.[]=(name, value)
23
- raise SettingNotFound unless <%= singular_name %> = <%= model_name %>.find_by_name(name)
24
- <%= singular_name %>.update_attribute(:value, value)
25
- end
26
-
27
- def parsed_value
28
- case self.field_type
29
- when 'integer'
30
- self.value.to_i
31
- when 'float'
32
- self.value.to_f
33
- when 'boolean'
34
- self.value == '1'
35
- else
36
- self.value
37
- end
38
- end
39
-
40
- def input_field_type
41
- case self.field_type
42
- when 'integer', 'string', 'float'
43
- 'text_field'
44
- when 'text'
45
- self.mce_editable ? 'tinymce' : 'text_area'
46
- when 'boolean'
47
- 'check_box'
48
- else
49
- 'text_field'
50
- end
51
- end
52
-
53
- class SettingNotFound < Exception; end
54
- end