Module: Onotole::EditMenuQuestions

Included in:
AppBuilder
Defined in:
lib/onotole/add_user_gems/edit_menu_questions.rb

Instance Method Summary collapse

Instance Method Details

#add_github_repo_creation_choiceObject



155
156
157
158
159
# File 'lib/onotole/add_user_gems/edit_menu_questions.rb', line 155

def add_github_repo_creation_choice
  variants = { none: 'No', create_github_repo: 'Yes' }
  sel = choice "Create github repo #{app_name}?", variants
  add_to_user_choise(sel) unless sel == :none
end

#ask_cleanup_commensObject



147
148
149
150
151
152
153
# File 'lib/onotole/add_user_gems/edit_menu_questions.rb', line 147

def ask_cleanup_commens
  return if options[:clean_comments]
  variants = { none: 'No', clean_comments: 'Yes' }
  sel = choice 'Delete comments in Gemfile, routes.rb & config files? ',
               variants
  add_to_user_choise(sel) unless sel == :none
end

#choose_authenticate_engineObject



20
21
22
23
24
25
26
27
28
# File 'lib/onotole/add_user_gems/edit_menu_questions.rb', line 20

def choose_authenticate_engine
  variants = { none: 'None', devise: 'devise', devise_with_model: 'devise vs pre-installed model' }
  gem = choice 'Select authenticate engine: ', variants
  if gem == :devise_with_model
    AppBuilder.devise_model = ask_stylish 'Enter devise model name:'
    gem = :devise
  end
  add_to_user_choise(gem) if gem
end

#choose_cms_engineObject



30
31
32
33
34
35
36
37
38
39
# File 'lib/onotole/add_user_gems/edit_menu_questions.rb', line 30

def choose_cms_engine
  variants = { none:        'None',
               activeadmin: 'Activeadmin CMS (if devise selected Admin model will create automatic)',
               rails_admin: 'Rails admin CMS',
               rails_db:    'Rails DB. Simple pretty view in browser & xls export for models',
               typus:       'Typus control panel to allow trusted users edit structured content.' }
  gem = choice 'Select control panel or CMS: ', variants
  add_to_user_choise(gem) if gem
  show_active_admin_plugins_submenu
end

#choose_develoder_toolsObject



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/onotole/add_user_gems/edit_menu_questions.rb', line 74

def choose_develoder_tools
  variants = { none:               'None',
               faker:              'Gem for generate fake data in testing',
               rubocop:            'Code inspector and code formatting tool',
               rubycritic:         'A Ruby code quality reporter',
               guard:              'Guard (with RSpec, livereload, rails, migrate, bundler)',
               guard_rubocop:      'Auto-declare code miss in guard',
               bundler_audit:      'Extra possibilities for gems version control',
               airbrake:           'Airbrake error logging',
               annotate:           'Annotate Rails classes with schema and routes info',
               overcommit:         'A fully configurable and extendable Git hook manager',
               railroady:          'Model and controller UML class diagram generator',
               hirbunicode:        'Hirb unicode support',
               dotenv_heroku:      'dotenv-heroku support',
               image_optim:        'Optimize images (jpeg, png, gif, svg) using external utilities',
               mailcatcher:        'Catches mail and serves it through a dream. http://mailcatcher.me',
               rack_mini_profiler: 'Middleware that displays speed badge for every html page.',
               flamegraph:         'Rack_mini_profiler awesome graphics generator. Need stackprof gem',
               stackprof:          'A sampling call-stack profiler for ruby 2.1+',
               meta_request:       'Rails meta panel in chrome console.'\
               " Very usefull in\n#{' ' * 24}AJAX debugging. Link for chrome"\
               " add-on in Gemfile.\n#{' ' * 24}Do not delete comments if you need this link"
                }
  multiple_choice('Write numbers of all preferred gems.', variants).each do |gem|
    add_to_user_choise gem
  end
end

#choose_frontendObject



4
5
6
7
8
9
10
11
12
# File 'lib/onotole/add_user_gems/edit_menu_questions.rb', line 4

def choose_frontend
  # do not forget add in def configure_simple_form new frameworks
  variants = { none:            'No front-end framework',
               bootstrap3_sass: 'Twitter bootstrap v.3 sass',
               bootstrap3:      'Twitter bootstrap v.3 asset pipeline'
                }
  gem = choice 'Select front-end framework: ', variants
  add_to_user_choise(gem) if gem
end

#choose_pagimationObject



62
63
64
65
66
67
68
69
70
71
72
# File 'lib/onotole/add_user_gems/edit_menu_questions.rb', line 62

def choose_pagimation
  if user_choose? :activeadmin
    add_to_user_choise(:kaminari)
    return
  end
  variants = { none:          'None',
               will_paginate: 'Will paginate',
               kaminari:      'Kaminari' }
  gem = choice 'Select paginator: ', variants
  add_to_user_choise(gem) if gem
end

#choose_template_engineObject



14
15
16
17
18
# File 'lib/onotole/add_user_gems/edit_menu_questions.rb', line 14

def choose_template_engine
  variants = { none: 'Erb', slim: 'Slim', haml: 'Haml' }
  gem = choice 'Select markup language: ', variants
  add_to_user_choise(gem) if gem
end

#choose_undroup_gemsObject



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/onotole/add_user_gems/edit_menu_questions.rb', line 110

def choose_undroup_gems
  variants = { none:                 'None',
               responders:           'A set of responders modules to dry up your Rails 4.2+ app.',
               activerecord_import:  'A library for bulk inserting data using ActiveRecord',
               paper_trail:          'Track changes to your models data. For auditing or versioning',
               cyrillizer:           'Character conversion from latin to cyrillic and vice versa',
               validates_timeliness: 'Date and time validation plugin for ActiveModel and Rails',
               font_awesome_sass:    'Font-Awesome Sass gem for use in Ruby/Rails projects',
               fotoramajs:           'Fotorama JS gallery for Rails http://fotorama.io/',
               prawn:                'Prawn gem for PDF support vs prawn-table for easy tables',
               axlsx_rails:          'XLS support, cyrillic support, good support at all',
               geocoder:             'Complete Ruby geocoding solution. http://www.rubygeocoder.com',
               gmaps4rails:          'Enables easy Google map + overlays creation. http://apneadiving.github.io/',
               rack_cors:            'Rack Middleware for handling Cross-Origin Resource Sharing (CORS).',
               newrelic_rpm:         'New Relic RPM Ruby Agent http://www.newrelic.com'
                }
  multiple_choice('Write numbers of all preferred gems.', variants).each do |gem|
    add_to_user_choise gem
  end
  add_to_user_choise :underscore_rails if user_choose?(:gmaps4rails)
end

#choose_wysiwygObject



102
103
104
105
106
107
108
# File 'lib/onotole/add_user_gems/edit_menu_questions.rb', line 102

def choose_wysiwyg
  variants = { none:     'None',
               ckeditor: 'CKEditor text editor designed for web content creation.',
               tinymce:  'TinyMCE with the Rails asset pipeline' }
  gem = choice 'Select wysiwyg: ', variants
  add_to_user_choise(gem) if gem
end

#show_active_admin_plugins_submenuObject



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/onotole/add_user_gems/edit_menu_questions.rb', line 41

def show_active_admin_plugins_submenu
  return unless user_choose? :activeadmin
  variants = {            none:                     'None',
                          active_admin_import:      'The most efficient way to import for ActiveAdmin',
                          active_admin_theme:       'Theme, flat skin',
                          active_skin:              'Theme, flat, nice, good maintenance',
                          flattened_active_admin:   'Theme, bring your Active Admin up-to-date with this customizable add on',
                          active_admin_bootstrap:   'Theme, simple bootstrap (sass) elements',
                          face_of_active_admin:     'Theme for ActiveAdmin with glyphicons and flattens',
                          active_admin_simple_life: 'Automatize routine with creation simple menus in ActiveAdmin with minimum code duplication.'
                           }
  themes = [:active_admin_theme, :active_skin, :flattened_active_admin]
  multiple_choice('Select activeadmin plug-ins (Themes are SASS or SCSS only).', variants).each do |gem|
    add_to_user_choise gem
    if themes.include? gem
      AppBuilder.use_asset_pipelline = false
      AppBuilder.active_admin_theme_selected = true
    end
  end
end

#users_init_commit_choiceObject

template for yes/no question

def supeawesome_gem

gem_name = __callee__.to_s.gsub(/_gem$/, '')
gem_description = 'Awesome gem description'
add_to_user_choise( yes_no_question( gem_name,
        gem_description)) unless options[gem_name]

end



141
142
143
144
145
# File 'lib/onotole/add_user_gems/edit_menu_questions.rb', line 141

def users_init_commit_choice
  variants = { none: 'No', gitcommit: 'Yes' }
  sel = choice 'Make init commit in the end? ', variants
  add_to_user_choise(sel) unless sel == :none
end