leonardo 1.3.1 → 1.4.0

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.
Files changed (38) hide show
  1. data/CHANGELOG +15 -0
  2. data/README.rdoc +40 -23
  3. data/lib/generators/erb/leosca/leosca_generator.rb +5 -2
  4. data/lib/generators/erb/leosca/templates/_form.html.erb +1 -1
  5. data/lib/generators/erb/leosca/templates/_list.erb +4 -1
  6. data/lib/generators/erb/leosca/templates/formtastic/_form.html.erb +8 -3
  7. data/lib/generators/erb/leosca/templates/index.html.erb +3 -1
  8. data/lib/generators/erb/leosca/templates/show.html.erb +17 -5
  9. data/lib/generators/leolay/leolay_generator.rb +131 -26
  10. data/lib/generators/leolay/templates/app/assets/javascripts/custom.js +2 -0
  11. data/lib/generators/leolay/templates/config/locales/en.yml +179 -2
  12. data/lib/generators/leolay/templates/config/locales/it.yml +125 -20
  13. data/lib/generators/leolay/templates/styles/cloudy/images/jquery-ui/Thumbs.db +0 -0
  14. data/lib/generators/leolay/templates/styles/cloudy/images/jquery-ui/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
  15. data/lib/generators/leolay/templates/styles/cloudy/images/jquery-ui/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
  16. data/lib/generators/leolay/templates/styles/cloudy/images/jquery-ui/ui-bg_flat_10_000000_40x100.png +0 -0
  17. data/lib/generators/leolay/templates/styles/cloudy/images/jquery-ui/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
  18. data/lib/generators/leolay/templates/styles/cloudy/images/jquery-ui/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
  19. data/lib/generators/leolay/templates/styles/cloudy/images/jquery-ui/ui-bg_glass_65_ffffff_1x400.png +0 -0
  20. data/lib/generators/leolay/templates/styles/cloudy/images/jquery-ui/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
  21. data/lib/generators/leolay/templates/styles/cloudy/images/jquery-ui/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
  22. data/lib/generators/leolay/templates/styles/cloudy/images/jquery-ui/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
  23. data/lib/generators/leolay/templates/styles/cloudy/images/jquery-ui/ui-icons_222222_256x240.png +0 -0
  24. data/lib/generators/leolay/templates/styles/cloudy/images/jquery-ui/ui-icons_228ef1_256x240.png +0 -0
  25. data/lib/generators/leolay/templates/styles/cloudy/images/jquery-ui/ui-icons_ef8c08_256x240.png +0 -0
  26. data/lib/generators/leolay/templates/styles/cloudy/images/jquery-ui/ui-icons_ffd27a_256x240.png +0 -0
  27. data/lib/generators/leolay/templates/styles/cloudy/images/jquery-ui/ui-icons_ffffff_256x240.png +0 -0
  28. data/lib/generators/leolay/templates/vendor/assets/javascripts/jquery-ui/jquery.ui.datepicker-de.js +23 -0
  29. data/lib/generators/leolay/templates/vendor/assets/javascripts/jquery-ui/jquery.ui.datepicker-en.js +23 -0
  30. data/lib/generators/leolay/templates/vendor/assets/javascripts/jquery-ui/jquery.ui.datepicker-it.js +23 -0
  31. data/lib/generators/leolay/templates/vendor/assets/javascripts/vendor.js +2 -0
  32. data/lib/generators/leolay/templates/{app/assets/stylesheets → vendor/assets/stylesheets/formtastic}/formtastic.css +0 -0
  33. data/lib/generators/leolay/templates/{app/assets/stylesheets → vendor/assets/stylesheets/formtastic}/formtastic_changes.css +0 -0
  34. data/lib/generators/leolay/templates/vendor/assets/stylesheets/jquery-ui/jquery-ui-1.8.16.redcarpet.css +568 -0
  35. data/lib/generators/leolay/templates/vendor/assets/stylesheets/vendor.css +4 -0
  36. data/lib/generators/rails/leosca_controller/leosca_controller_generator.rb +17 -11
  37. data/template.rb +4 -2
  38. metadata +29 -7
@@ -0,0 +1,4 @@
1
+ /*
2
+ * Leonardo
3
+ * Group files into a folder and require it
4
+ */
@@ -14,8 +14,7 @@ module Rails
14
14
  class_option :seeds, :type => :boolean, :default => true, :description => "Create seeds to run with rake db:seed"
15
15
  class_option :seeds_elements, :type => :string, :default => "30", :description => "Choose seeds elements", :banner => "NUMBER OF ARRAY ELEMENTS"
16
16
  class_option :remote, :type => :boolean, :default => true, :description => "Enable ajax. You can also do later set remote to true into index view."
17
- #class_option :authentication, :type => :boolean, :default => true, :description => "Add code to manage authentication with devise"
18
- #class_option :authorization, :type => :boolean, :default => true, :description => "Add code to manage authorization with cancan"
17
+
19
18
 
20
19
  check_class_collision :suffix => "Controller"
21
20
 
@@ -47,7 +46,7 @@ module Rails
47
46
  inject_into_file file, :after => "#Attributes zone - do not remove#{CRLF}" do
48
47
  content = " #{file_name}:#{CRLF}"
49
48
  attributes.each do |attribute|
50
- content << " #{attribute.name}: \"#{attribute.name.capitalize}\"#{CRLF}"
49
+ content << " #{attribute.name}: \"#{camel_case attribute.name}\"#{CRLF}"
51
50
  end
52
51
  content << " op_new: \"New #{singular_table_name}\"#{CRLF}"
53
52
  content << " op_edit: \"Editing #{singular_table_name}\"#{CRLF}"
@@ -69,11 +68,15 @@ module Rails
69
68
  attributes.each do |attribute|
70
69
  case attribute.type
71
70
  when :integer, :decimal, :float
72
- content << " #{attribute.name}: \"Insert #{attribute.name} as #{attribute.type.to_s} number\"#{CRLF}"
71
+ content << " #{attribute.name}: \"Fill the #{attribute.name} with a#{"n" if attribute.type == :integer} #{attribute.type.to_s} number\"#{CRLF}"
73
72
  when :boolean
74
73
  content << " #{attribute.name}: \"Select if #{attribute.name} or not\"#{CRLF}"
75
- else
74
+ when :string, :text
76
75
  content << " #{attribute.name}: \"Choose a good #{attribute.name} for this #{file_name}\"#{CRLF}"
76
+ when :date, :datetime, :time
77
+ content << " #{attribute.name}: \"Choose a #{attribute.type.to_s} for #{attribute.name}\"#{CRLF}"
78
+ else
79
+ content << " #{attribute.name}: \"Choose a #{attribute.name}\"#{CRLF}"
77
80
  end
78
81
  end
79
82
  content
@@ -127,6 +130,9 @@ module Rails
127
130
  when :integer then "#"
128
131
  when :float, :decimal then "#.46"
129
132
  when :references, :belongs_to then "#"
133
+ when :date then "'#{Time.now.strftime("%Y-%m-%d 00:00:00.000")}'"
134
+ when :datetime then "'#{Time.now.strftime("%Y-%m-%d %H:%M:%S.000")}'"
135
+ when :time then "'#{Time.now.strftime("%H:%M:%S.000")}'"
130
136
  else "'#{attribute.name.capitalize}\#'"
131
137
  end
132
138
  name = case attribute.type
@@ -152,13 +158,13 @@ module Rails
152
158
  File.exists? "app/models/ability.rb"
153
159
  end
154
160
  def authentication?
155
- file = "app/models/user.rb"
156
- File.exists?(file)
157
- #get file do |content|
158
- # content.include? "devise"
159
- #end
161
+ return true if File.exists? "app/models/user.rb"
162
+ File.exists? "config/initializers/devise.rb"
163
+ end
164
+ def camel_case(str)
165
+ return str if str !~ /_/ && str =~ /[A-Z]+.*/
166
+ str.split('_').map { |i| i.capitalize }.join
160
167
  end
161
-
162
168
  end
163
169
  end
164
170
  end
data/template.rb CHANGED
@@ -27,6 +27,8 @@ gem 'paperclip' if yes?("Attachment ?")
27
27
 
28
28
  gem 'fastercsv' if yes?("FasterCSV ?")
29
29
 
30
+ gem 'state_machine' if yes?("Do you have to handle states ?")
31
+
30
32
  formtastic = yes?("Formtastic ?")
31
33
  if formtastic
32
34
  #gem 'justinfrench-formtastic', :lib => 'formtastic', :source => 'http://gems.github.com'
@@ -46,13 +48,13 @@ end
46
48
  model_name = nil
47
49
  devise = yes?("Would you like to install Devise?")
48
50
  if devise
49
- gem("devise")
51
+ gem 'devise'
50
52
  model_name = ask(" What would you like the user model to be called? [user]")
51
53
  model_name = "user" if model_name.blank?
52
54
  end
53
55
 
54
56
  cancan = yes?("Authorization ?")
55
- gem "cancan" if cancan
57
+ gem 'cancan' if cancan
56
58
 
57
59
  #home = yes?("Generate controller home ? (raccomanded)")
58
60
  home = true
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: leonardo
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 7
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 3
9
- - 1
10
- version: 1.3.1
8
+ - 4
9
+ - 0
10
+ version: 1.4.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Marco Mastrodonato
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-08-22 00:00:00 Z
18
+ date: 2011-08-24 00:00:00 Z
19
19
  dependencies: []
20
20
 
21
21
  description: A generator for creating Rails 3.1 applications ready to go. It generates the layout, the style, the internationalization and manage external gems for authentication, authorization and other. It also provides a customized scaffold to generates cool sites ajax ready in few minutes. If you find a bug please report to m.mastrodonato@gmail.com
@@ -38,8 +38,7 @@ files:
38
38
  - lib/generators/erb/leosca/templates/_form.html.erb
39
39
  - lib/generators/erb/leosca/templates/_list.erb
40
40
  - lib/generators/leolay/leolay_generator.rb
41
- - lib/generators/leolay/templates/app/assets/stylesheets/formtastic.css
42
- - lib/generators/leolay/templates/app/assets/stylesheets/formtastic_changes.css
41
+ - lib/generators/leolay/templates/app/assets/javascripts/custom.js
43
42
  - lib/generators/leolay/templates/app/views/devise/confirmations/new.html.erb
44
43
  - lib/generators/leolay/templates/app/views/devise/mailer/confirmation_instructions.html.erb
45
44
  - lib/generators/leolay/templates/app/views/devise/mailer/reset_password_instructions.html.erb
@@ -60,6 +59,21 @@ files:
60
59
  - lib/generators/leolay/templates/config.rb
61
60
  - lib/generators/leolay/templates/layout_helper.rb
62
61
  - lib/generators/leolay/templates/lib/utility.rb
62
+ - lib/generators/leolay/templates/styles/cloudy/images/jquery-ui/Thumbs.db
63
+ - lib/generators/leolay/templates/styles/cloudy/images/jquery-ui/ui-bg_diagonals-thick_18_b81900_40x40.png
64
+ - lib/generators/leolay/templates/styles/cloudy/images/jquery-ui/ui-bg_diagonals-thick_20_666666_40x40.png
65
+ - lib/generators/leolay/templates/styles/cloudy/images/jquery-ui/ui-bg_flat_10_000000_40x100.png
66
+ - lib/generators/leolay/templates/styles/cloudy/images/jquery-ui/ui-bg_glass_100_f6f6f6_1x400.png
67
+ - lib/generators/leolay/templates/styles/cloudy/images/jquery-ui/ui-bg_glass_100_fdf5ce_1x400.png
68
+ - lib/generators/leolay/templates/styles/cloudy/images/jquery-ui/ui-bg_glass_65_ffffff_1x400.png
69
+ - lib/generators/leolay/templates/styles/cloudy/images/jquery-ui/ui-bg_gloss-wave_35_f6a828_500x100.png
70
+ - lib/generators/leolay/templates/styles/cloudy/images/jquery-ui/ui-bg_highlight-soft_100_eeeeee_1x100.png
71
+ - lib/generators/leolay/templates/styles/cloudy/images/jquery-ui/ui-bg_highlight-soft_75_ffe45c_1x100.png
72
+ - lib/generators/leolay/templates/styles/cloudy/images/jquery-ui/ui-icons_222222_256x240.png
73
+ - lib/generators/leolay/templates/styles/cloudy/images/jquery-ui/ui-icons_228ef1_256x240.png
74
+ - lib/generators/leolay/templates/styles/cloudy/images/jquery-ui/ui-icons_ef8c08_256x240.png
75
+ - lib/generators/leolay/templates/styles/cloudy/images/jquery-ui/ui-icons_ffd27a_256x240.png
76
+ - lib/generators/leolay/templates/styles/cloudy/images/jquery-ui/ui-icons_ffffff_256x240.png
63
77
  - lib/generators/leolay/templates/styles/cloudy/images/kaminari/nav.png
64
78
  - lib/generators/leolay/templates/styles/cloudy/images/style/bg_but_gray.png
65
79
  - lib/generators/leolay/templates/styles/cloudy/images/style/bg_top.png
@@ -82,6 +96,14 @@ files:
82
96
  - lib/generators/leolay/templates/styles/cloudy/views/layout/_layout.html.erb
83
97
  - lib/generators/leolay/templates/styles/cloudy/views/layout/_message.html.erb
84
98
  - lib/generators/leolay/templates/styles/cloudy/views/layout/_session.html.erb
99
+ - lib/generators/leolay/templates/vendor/assets/javascripts/jquery-ui/jquery.ui.datepicker-de.js
100
+ - lib/generators/leolay/templates/vendor/assets/javascripts/jquery-ui/jquery.ui.datepicker-en.js
101
+ - lib/generators/leolay/templates/vendor/assets/javascripts/jquery-ui/jquery.ui.datepicker-it.js
102
+ - lib/generators/leolay/templates/vendor/assets/javascripts/vendor.js
103
+ - lib/generators/leolay/templates/vendor/assets/stylesheets/formtastic/formtastic.css
104
+ - lib/generators/leolay/templates/vendor/assets/stylesheets/formtastic/formtastic_changes.css
105
+ - lib/generators/leolay/templates/vendor/assets/stylesheets/jquery-ui/jquery-ui-1.8.16.redcarpet.css
106
+ - lib/generators/leolay/templates/vendor/assets/stylesheets/vendor.css
85
107
  - lib/generators/leolay/USAGE
86
108
  - lib/generators/leosca/install_generator.rb
87
109
  - lib/generators/leosca/USAGE