makena 0.0.5 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. metadata +10 -88
  3. data/.gitignore +0 -37
  4. data/Gemfile +0 -139
  5. data/Gemfile.lock +0 -469
  6. data/README.rdoc +0 -28
  7. data/Rakefile +0 -6
  8. data/app/assets/images/.keep +0 -0
  9. data/app/assets/javascripts/application.js +0 -16
  10. data/app/assets/stylesheets/application.css +0 -13
  11. data/app/controllers/application_controller.rb +0 -5
  12. data/app/controllers/concerns/.keep +0 -0
  13. data/app/helpers/application_helper.rb +0 -2
  14. data/app/mailers/.keep +0 -0
  15. data/app/models/.keep +0 -0
  16. data/app/models/concerns/.keep +0 -0
  17. data/app/views/layouts/application.html.erb +0 -14
  18. data/bin/bundle +0 -3
  19. data/bin/rails +0 -4
  20. data/bin/rake +0 -4
  21. data/config.ru +0 -4
  22. data/config/application.rb +0 -23
  23. data/config/boot.rb +0 -4
  24. data/config/database.yml +0 -39
  25. data/config/environment.rb +0 -5
  26. data/config/environments/development.rb +0 -29
  27. data/config/environments/production.rb +0 -80
  28. data/config/environments/test.rb +0 -36
  29. data/config/initializers/backtrace_silencers.rb +0 -7
  30. data/config/initializers/filter_parameter_logging.rb +0 -4
  31. data/config/initializers/inflections.rb +0 -16
  32. data/config/initializers/mime_types.rb +0 -5
  33. data/config/initializers/secret_token.rb +0 -12
  34. data/config/initializers/session_store.rb +0 -3
  35. data/config/initializers/wrap_parameters.rb +0 -14
  36. data/config/locales/en.yml +0 -23
  37. data/config/routes.rb +0 -56
  38. data/db/seeds.rb +0 -7
  39. data/lib/assets/.keep +0 -0
  40. data/lib/generators/connection/USAGE +0 -26
  41. data/lib/generators/connection/connection_generator.rb +0 -195
  42. data/lib/generators/connection/templates/extensions/alpha_alphas.rb +0 -17
  43. data/lib/generators/connection/templates/extensions/alpha_betas.rb +0 -17
  44. data/lib/generators/connection/templates/extensions/geocoder.rb +0 -23
  45. data/lib/generators/connection/templates/extensions/image.rb +0 -12
  46. data/lib/generators/copy/USAGE +0 -7
  47. data/lib/generators/copy/copy_generator.rb +0 -41
  48. data/lib/generators/git/USAGE +0 -8
  49. data/lib/generators/git/git_generator.rb +0 -59
  50. data/lib/generators/setup/USAGE +0 -8
  51. data/lib/generators/setup/setup_generator.rb +0 -151
  52. data/lib/generators/success/USAGE +0 -44
  53. data/lib/generators/success/success_generator.rb +0 -18
  54. data/lib/tasks/.keep +0 -0
  55. data/makena/.gitignore +0 -17
  56. data/makena/Gemfile +0 -4
  57. data/makena/LICENSE.txt +0 -22
  58. data/makena/README.md +0 -32
  59. data/makena/Rakefile +0 -1
  60. data/makena/lib/makena.rb +0 -21
  61. data/makena/lib/makena/controllers.rb +0 -218
  62. data/makena/lib/makena/gps.rb +0 -2
  63. data/makena/lib/makena/image.rb +0 -2
  64. data/makena/lib/makena/layouts.rb +0 -41
  65. data/makena/lib/makena/models.rb +0 -2
  66. data/makena/lib/makena/tree.rb +0 -181
  67. data/makena/lib/makena/version.rb +0 -3
  68. data/makena/lib/makena/views.rb +0 -225
  69. data/makena/makena.gemspec +0 -23
  70. data/public/404.html +0 -58
  71. data/public/422.html +0 -58
  72. data/public/500.html +0 -57
  73. data/public/favicon.ico +0 -0
  74. data/public/robots.txt +0 -5
  75. data/vendor/assets/javascripts/.keep +0 -0
  76. data/vendor/assets/stylesheets/.keep +0 -0
data/config/routes.rb DELETED
@@ -1,56 +0,0 @@
1
- Makena::Application.routes.draw do
2
- # The priority is based upon order of creation: first created -> highest priority.
3
- # See how all your routes lay out with "rake routes".
4
-
5
- # You can have the root of your site routed with "root"
6
- # root 'welcome#index'
7
-
8
- # Example of regular route:
9
- # get 'products/:id' => 'catalog#view'
10
-
11
- # Example of named route that can be invoked with purchase_url(id: product.id)
12
- # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
13
-
14
- # Example resource route (maps HTTP verbs to controller actions automatically):
15
- # resources :products
16
-
17
- # Example resource route with options:
18
- # resources :products do
19
- # member do
20
- # get 'short'
21
- # post 'toggle'
22
- # end
23
- #
24
- # collection do
25
- # get 'sold'
26
- # end
27
- # end
28
-
29
- # Example resource route with sub-resources:
30
- # resources :products do
31
- # resources :comments, :sales
32
- # resource :seller
33
- # end
34
-
35
- # Example resource route with more complex sub-resources:
36
- # resources :products do
37
- # resources :comments
38
- # resources :sales do
39
- # get 'recent', on: :collection
40
- # end
41
- # end
42
-
43
- # Example resource route with concerns:
44
- # concern :toggleable do
45
- # post 'toggle'
46
- # end
47
- # resources :posts, concerns: :toggleable
48
- # resources :photos, concerns: :toggleable
49
-
50
- # Example resource route within a namespace:
51
- # namespace :admin do
52
- # # Directs /admin/products/* to Admin::ProductsController
53
- # # (app/controllers/admin/products_controller.rb)
54
- # resources :products
55
- # end
56
- end
data/db/seeds.rb DELETED
@@ -1,7 +0,0 @@
1
- # This file should contain all the record creation needed to seed the database with its default values.
2
- # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
3
- #
4
- # Examples:
5
- #
6
- # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
7
- # Mayor.create(name: 'Emanuel', city: cities.first)
data/lib/assets/.keep DELETED
File without changes
@@ -1,26 +0,0 @@
1
- Description:
2
-
3
- To change this USAGE document : $ vim lib/generators/connection/USAGE
4
- To get here: $ rails g connection -h(elp)
5
-
6
- Examples:
7
-
8
- $ rails g(generator) connection alpha beta feature1|feature2|feature3...
9
- where alpha = The name of object connecting from
10
- where beta = The name of the non-existant object connecting to
11
-
12
- if alpha = beta,
13
- then beta is not created
14
- then alpha is parent to beta
15
- then beta is child to alpha
16
-
17
- if beta = none,
18
- then beta is not created
19
-
20
- Example:
21
-
22
- $ rails g connection user location name|content|location|image
23
- $ rails g connection spot note name|content|image
24
-
25
- This will create:
26
- what/will/it/create
@@ -1,195 +0,0 @@
1
- class ConnectionGenerator < Rails::Generators::NamedBase
2
-
3
- # Look from root
4
- source_root File.expand_path('../../../../', __FILE__)
5
-
6
- # Example:
7
- # rails g connectionion spot note name|content|image
8
- def establish_variables
9
- @alpha = name.underscore.singularize
10
- @beta = args.shift.underscore.singularize
11
- @connection = @alpha+"_"+@beta
12
- @atts = args.shift.to_s.split("|")
13
- @root = "lib/generators/connection/templates"
14
- end
15
-
16
- # Create standard scaffold
17
- def generate_scaffold_and_models
18
- if @alpha!=@beta
19
- generate_scaffold_beta
20
- generate_model_alpha_beta
21
- elsif @alpha==@beta
22
- generate_model_parents_children
23
- end
24
- end
25
-
26
- # Modify standard views
27
- def modify_views
28
- if @alpha!=@beta
29
- modify_views_assocs
30
- end
31
- end
32
-
33
- def generate_extensions
34
- if @alpha!=@beta
35
- empty_directory "app/models/extensions"
36
- add_has_many_to_alpha_beta_models
37
- template_extensions_geocoder if @atts.include?("location")
38
- template_extensions_image if @atts.include?("image")
39
- elsif @alpha==@beta
40
- template_extensions_parents_children
41
- end
42
- end
43
-
44
- # Add feature testing
45
- def add_testing_notes
46
- a = "features/user.feature"
47
- b = "#T\O\D\O Add testing for #{@alpha}, #{@beta}, #{@connection}"
48
- prepend_to_file a, b
49
- end
50
-
51
- # Run migration
52
- def run_migration
53
- run "rake db:drop"
54
- run "rake db:create"
55
- run "rake db:migrate"
56
- run "rake db:test:clone" # unless Rails 4.1+
57
- end
58
-
59
- private
60
-
61
- # Generate parents and children model
62
- def generate_model_parents_children
63
- generate "model", "#{@connection} user:references parent:references child:references"
64
- from_file = "app/models/#{@connection}.rb"
65
- from = " belongs_to :parent"
66
- to = " belongs_to :parent_#{@beta}, class_name: '#{@beta.camelcase}', foreign_key: 'parent_id'"
67
- gsub_file from_file, from, to
68
- from_file = "app/models/#{@connection}.rb"
69
- from = " belongs_to :child"
70
- to = " belongs_to :child_#{@beta}, class_name: '#{@beta.camelcase}', foreign_key: 'child_id'"
71
- gsub_file from_file, from, to
72
- end
73
-
74
- # Modify assocs views
75
- def modify_views_assocs
76
- modify_view @beta, :name if @atts.include?("name")
77
- modify_view @beta, :image if @atts.include?("image")
78
- modify_view @beta, :text, :content if @atts.include?("content")
79
- modify_view @beta, :address, :location if @atts.include?("address")
80
- end
81
-
82
- # Generate scaffold assocs
83
- def generate_scaffold_beta
84
- pass_order = "#{@beta.pluralize} user:references"
85
- pass_order << " is_public:boolean:index"
86
- pass_order << " name:string:index" if @atts.include?("name")
87
- pass_order << " content:text" if @atts.include?("content")
88
- if @atts.include?("location")
89
- pass_order << " address:string:index"
90
- pass_order << " latitude:float:index"
91
- pass_order << " longitude:float:index"
92
- end
93
- pass_order << " image:string:index" if @atts.include?("image")
94
- generate "scaffold", pass_order
95
- end
96
-
97
- # Generate model for associates
98
- def generate_model_alpha_beta
99
- generate "model", "#{@connection} user:references #{@alpha}:references #{@beta}:references"
100
- from_file = "app/models/#{@connection}.rb"
101
- from = " belongs_to :parent"
102
- to = " belongs_to :parent_#{@beta}, class_name: '#{@beta.camelcase}', foreign_key: 'parent_id'"
103
- gsub_file from_file, from, to
104
- from_file = "app/models/#{@connection}.rb"
105
- from = " belongs_to :child"
106
- to = " belongs_to :child_#{@beta}, class_name: '#{@beta.camelcase}', foreign_key: 'child_id'"
107
- gsub_file from_file, from, to
108
- end
109
-
110
- # Transfer assocs extensions
111
- def add_has_many_to_alpha_beta_models
112
- passtarget = "< ActiveRecord::Base\n"
113
-
114
- passpath = "app/models/#{@alpha}.rb"
115
- passinsert = " has_many :#{@alpha}_#{@beta.pluralize}\n"
116
- passinsert << " has_many :#{@beta.pluralize}, :through => :#{@alpha}_#{@beta.pluralize}\n"
117
- insert_into_file passpath, passinsert, :after => passtarget
118
-
119
- passpath = "app/models/#{@beta}.rb"
120
- passinsert = " has_many :#{@alpha}_#{@beta.pluralize}\n"
121
- passinsert << " has_many :#{@alpha.pluralize}, :through => :#{@alpha}_#{@beta.pluralize}\n"
122
- insert_into_file passpath, passinsert, :after => passtarget
123
- end
124
-
125
- # Transfer parents children extensions
126
- def template_extensions_parents_children
127
- generate_model_extension "AlphaAlphas"
128
- modify_model_extension_include @alpha, "AlphaAlphas"
129
- modify_model_extension_include @beta, "AlphaAlphas"
130
- end
131
-
132
- # Transfer image extensions
133
- def template_extensions_image
134
- generate_model_extension "Image"
135
- modify_model_extension_include @beta, "Image"
136
- end
137
-
138
- # Transfer image extensions
139
- def template_extensions_geocoder
140
- generate_model_extension "Geocoder"
141
- modify_model_extension_include @beta, "Geocoder"
142
- end
143
-
144
- # Generate model extension
145
- def generate_model_extension(extname)
146
- passfrom = "#{@root}/extensions/#{extname.underscore}.rb"
147
- passto = "app/models/extensions/#{extname.underscore}.rb"
148
- template passfrom, passto
149
- end
150
-
151
- # Modify object model
152
- # after: class Spot < ActiveRecord::Base
153
- # include Extensions::Geocoder
154
- def modify_model_extension_include(objname, extname)
155
- passtarget = "< ActiveRecord::Base\n"
156
- passinsert = " include Extensions::#{extname}\n"
157
- passpath = "app/models/#{objname}.rb"
158
- insert_into_file passpath, passinsert, :after => passtarget
159
- end
160
-
161
- # Modify object views
162
- def modify_view(objname, objtype, objatt=nil)
163
- objatt||=objtype.to_sym
164
- modify_view_form(objname, objtype, objatt)
165
- build_view_partial(objname, objtype, objatt)
166
- modify_view_partial(objname, objtype, objatt)
167
- end
168
-
169
- # Modify object form
170
- def modify_view_form(objname, objtype, objatt)
171
- passformtarget = "<%= form_for @#{objname}, data:{ajax:false}, html:{multipart:true} do |f| %>\n"
172
- passforminsert = " <%= layouts_form f, @#{objname}, \"#{objtype}\", #{objatt} %>\n"
173
- passfilepath = "app/views/#{objname.pluralize}/_form.html.erb"
174
- insert_into_file passfilepath, passforminsert, :after => passformtarget
175
- end
176
-
177
- # Build object partial
178
- def build_view_partial(objname, objtype, objatt)
179
- passfilepath = "app/views/#{objname.pluralize}/_#{objname}.html.erb"
180
- pass = []
181
- pass << "<!-- #{passfilepath} -->"
182
- pass << "<%= form_for @#{objname}, data:{ajax:false}, html:{multipart:true} do |f| %>"
183
- pass << "<% end %>"
184
- create_file passfilepath, pass.join("\n")
185
- end
186
-
187
- # Modify object partial
188
- def modify_view_partial(objname, objtype, objatt)
189
- passformtarget = "<%= form_for @#{objname}, data:{ajax:false}, html:{multipart:true} do |f| %>\n"
190
- passforminsert = " <%= layouts_show #{objname}, \"#{objtype}\", #{objatt} %>\n"
191
- passfilepath = "app/views/#{objname.pluralize}/_#{objname}.html.erb"
192
- insert_into_file passfilepath, passforminsert, :after => passformtarget
193
- end
194
-
195
- end
@@ -1,17 +0,0 @@
1
- module Extensions
2
- module <%= (@alpha.camelize+@alpha.camelize).pluralize %>
3
- extend ActiveSupport::Concern
4
- included do
5
-
6
- attr_accessor :<%= @alpha %>_parent_id
7
- attr_accessor :<%= @alpha %>_child_id
8
-
9
- has_many :<%= @alpha+"_"+@alpha.pluralize %>, :foreign_key => 'parent_id'
10
- has_many :parent_<%= @alpha+"_"+@alpha.pluralize %>, :class_name => 'SpotSpot', :foreign_key => 'child_id'
11
- has_many :parents, :through => :parent_<%= @alpha+"_"+@alpha.pluralize %>, :source => :parent_<%= @alpha %>, :foreign_key => 'parent_id'
12
- has_many :child_<%= @alpha+"_"+@alpha.pluralize %>, :class_name => '<%= (@alpha.camelize+@alpha.camelize) %>', :foreign_key => 'parent_id'
13
- has_many :children, :through => :child_<%= @alpha+"_"+@alpha.pluralize %>, :source => :child_<%= @alpha %>, :foreign_key => 'child_id'
14
-
15
- end
16
- end
17
- end
@@ -1,17 +0,0 @@
1
- module Extensions
2
- module <%= (@alpha.camelize+@alpha.camelize).pluralize %>
3
- extend ActiveSupport::Concern
4
- included do
5
-
6
- attr_accessor :<%= @alpha %>_parent_id
7
- attr_accessor :<%= @alpha %>_child_id
8
-
9
- has_many :<%= @alpha+"_"+@alpha.pluralize %>, :foreign_key => 'parent_id'
10
- has_many :parent_<%= @alpha+"_"+@alpha.pluralize %>, :class_name => 'SpotSpot', :foreign_key => 'child_id'
11
- has_many :parents, :through => :parent_<%= @alpha+"_"+@alpha.pluralize %>, :source => :parent_<%= @alpha %>, :foreign_key => 'parent_id'
12
- has_many :child_<%= @alpha+"_"+@alpha.pluralize %>, :class_name => '<%= (@alpha.camelize+@alpha.camelize) %>', :foreign_key => 'parent_id'
13
- has_many :children, :through => :child_<%= @alpha+"_"+@alpha.pluralize %>, :source => :child_<%= @alpha %>, :foreign_key => 'child_id'
14
-
15
- end
16
- end
17
- end
@@ -1,23 +0,0 @@
1
- module Extensions
2
- module Geocoder
3
- extend ActiveSupport::Concern
4
- included do
5
-
6
- # Testing? Then timeout now
7
- Geocoder.configure(:timeout => 0) unless Rails.env.test?
8
-
9
- # Geocoder: street address or IP address
10
- geocoded_by :address, :if => :address_changed?
11
-
12
- # Geocoder: auto-fetch coordinates
13
- after_validation :geocode, :if => :address_changed?
14
-
15
- # reverse geocode by latitude and longitude attributes
16
- reverse_geocoded_by :latitude, :longitude, :if => :longitude_changed?
17
-
18
- # Geocoder: auto-fetch address
19
- after_validation :reverse_geocode, :if => :longitude_changed?
20
-
21
- end
22
- end
23
- end
@@ -1,12 +0,0 @@
1
- module Extensions
2
- module Image
3
- extend ActiveSupport::Concern
4
- included do
5
-
6
- mount_uploader :image, ImageUploader
7
- attr_accessor :remove_image
8
- attr_accessor :remote_image_url
9
-
10
- end
11
- end
12
- end
@@ -1,7 +0,0 @@
1
- Description:
2
- Change all words to new words
3
-
4
- Example:
5
- rails g copy app/ apple JackFruit
6
-
7
- This will change all words of "apple", "Apple", "APPLE" to, "jackfruit", "Jack fruit", "JACKFRUIT" (and more...)
@@ -1,41 +0,0 @@
1
- class CopyGenerator < Rails::Generators::NamedBase
2
- source_root File.expand_path('../../../../', __FILE__)
3
- # name = file or folder
4
-
5
- # rails g oldword newword oldname [newname]
6
- def process_names
7
- @oldword = name.to_s.humanize.downcase.gsub(" ","_")
8
- @newword = args.shift.to_s.humanize.downcase.gsub(" ","_")
9
- @oldname = args.shift.to_s
10
- @newname = (newname=args.shift).present? ? newname.to_s : @oldname.to_s
11
- @newname = @newname.
12
- gsub((o=@oldword).pluralize, (n=@newword).pluralize).
13
- gsub(o.singularize, n.singularize)
14
- end
15
-
16
- def move_files_or_directories
17
- if @oldname.gsub("..","").scan(".").present?
18
- copy_file @oldname, @newname
19
- else
20
- directory @oldname, @newname
21
- end
22
- end
23
-
24
- def apply_names
25
- adapt_words @newname, @oldword.pluralize, @newword.pluralize
26
- adapt_words @newname, @oldword.singularize, @newword.singularize
27
- end
28
-
29
- private
30
-
31
- # grep -rl 'pass_old_word' pass_path | xargs sed -i 's/'pass_old_word'/pass_new_word/g'
32
- def adapt_words(pass_path, pass_oldword, pass_newword)
33
- run "grep -rl '#{pass_oldword}' #{pass_path} | xargs sed -i 's/#{pass_oldword}/#{pass_newword}/g'"
34
- run "grep -rl '#{pass_oldword.camelcase}' #{pass_path} | xargs sed -i 's/#{pass_oldword.camelcase}/#{pass_newword.camelcase}/g'"
35
- run "grep -rl '#{pass_oldword.upcase}' #{pass_path} | xargs sed -i 's/#{pass_oldword.upcase}/#{pass_newword.upcase}/g'"
36
- run "grep -rl '#{pass_oldword.downcase}' #{pass_path} | xargs sed -i 's/#{pass_oldword.downcase}/#{pass_newword.downcase}/g'"
37
- run "grep -rl '#{pass_oldword.humanize}' #{pass_path} | xargs sed -i 's/#{pass_oldword.humanize}/#{pass_newword.humanize}/g'"
38
- run "grep -rl '#{pass_oldword.titleize}' #{pass_path} | xargs sed -i 's/#{pass_oldword.titleize}/#{pass_newword.titleize}/g'"
39
- end
40
-
41
- end
@@ -1,8 +0,0 @@
1
- Description:
2
- Explain the generator
3
-
4
- Example:
5
- rails generate git Thing
6
-
7
- This will create:
8
- what/will/it/create
@@ -1,59 +0,0 @@
1
- class GitGenerator < Rails::Generators::NamedBase
2
-
3
- source_root File.expand_path('../../../../', __FILE__)
4
- argument :content, :type => :string, :default => ""
5
-
6
- def do_railroad
7
- if content.present?
8
- run "railroady -M -b | dot -Tsvg > app/assets/images/models.svg"
9
- run "railroady -C -b | dot -Tsvg > app/assets/images/controllers.svg"
10
- end
11
- end
12
-
13
- def do_yard
14
- if content.present?
15
- run "yard"
16
- end
17
- end
18
-
19
- def do_assets_precompile
20
- if content.present?
21
- run "rake assets:precompile"
22
- end
23
- end
24
-
25
- def git_gc_and_prune
26
- if content.present?
27
- run "git gc --prune"
28
- end
29
- end
30
-
31
- def git_comment
32
- if content.present?
33
- run "git add --all .; git commit -m '#{name.to_s.humanize.upcase} << #{content.to_s.gsub("_"," ")}'"
34
- run "heroku maintenance:on" if content.present?
35
- run "git push heroku master"
36
- else
37
- run "git add --all .; git commit -m '#{name.to_s}'"
38
- end
39
- end
40
-
41
- def run_heroku_migration
42
- if content.present?
43
- run "heroku run rake db:migrate" if content.present?
44
- end
45
- end
46
-
47
- def run_heroku_restart
48
- if content.present?
49
- run "heroku restart" if content.present?
50
- run "heroku maintenance:off" if content.present?
51
- end
52
- end
53
-
54
- def git_add
55
- run "rake notes"
56
- end
57
-
58
-
59
- end