module Onotole::BeforeBundlePatch

Public Instance Methods

add_active_admin_import_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 212
def add_active_admin_import_gem
  inject_into_file('Gemfile', "\ngem 'active_admin_import'", after: '# user_choice')
end
add_active_admin_simple_life_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 307
def add_active_admin_simple_life_gem
  inject_into_file('Gemfile', "\ngem 'active_admin_simple_life'", after: '# user_choice')
end
add_active_admin_theme_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 216
def add_active_admin_theme_gem
  inject_into_file('Gemfile', "\ngem 'active_admin_theme'", after: '# user_choice')
end
add_active_record_doctor_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 350
def add_active_record_doctor_gem
  inject_into_file('Gemfile', "\n  gem 'active_record_doctor'", after: 'group :development do')
end
add_active_skin_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 228
def add_active_skin_gem
  inject_into_file('Gemfile', "\ngem 'active_skin'", after: '# user_choice')
end
add_activeadmin_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 164
def add_activeadmin_gem
  inject_into_file('Gemfile', "\ngem 'activeadmin', github: 'activeadmin'", after: '# user_choice')
  inject_into_file('Gemfile', "\ngem 'kaminari-i18n'", after: '# user_choice')
  copy_file 'activeadmin.en.yml', 'config/locales/activeadmin.en.yml'
  copy_file 'activeadmin.ru.yml', 'config/locales/activeadmin.ru.yml'
  # it still live https://github.com/Prelang/feedback/issues/14 and this patch helps
  run 'mkdir app/inputs'
  copy_file 'inet_input.rb', 'app/inputs/inet_input.rb'
end
add_activerecord_import_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 160
def add_activerecord_import_gem
  inject_into_file('Gemfile', "\ngem 'activerecord-import'", after: '# user_choice')
end
add_airbrake_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 84
def add_airbrake_gem
  inject_into_file('Gemfile', "\ngem 'airbrake'",
                   after: '# user_choice')
end
add_annotate_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 136
def add_annotate_gem
  inject_into_file('Gemfile', "\n  gem 'annotate'", after: 'group :development do')
end
add_axlsx_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 256
def add_axlsx_gem
  inject_into_file('Gemfile', "\ngem 'axlsx'", after: '# user_choice')
end
add_axlsx_rails_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 252
def add_axlsx_rails_gem
  inject_into_file('Gemfile', "\ngem 'axlsx_rails'", after: '# user_choice')
end
add_bootstrap3_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 89
def add_bootstrap3_gem
  inject_into_file('Gemfile', "\ngem 'twitter-bootstrap-rails'",
                   after: '# user_choice')
  inject_into_file('Gemfile', "\ngem 'devise-bootstrap-views'",
                   after: '# user_choice') if user_choose?(:devise)
end
add_bootstrap3_sass_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 79
def add_bootstrap3_sass_gem
  inject_into_file('Gemfile', "\ngem 'bootstrap-sass', '~> 3.3.6'",
                   after: '# user_choice')
end
add_bundler_audit_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 74
def add_bundler_audit_gem
  copy_file 'bundler_audit.rake', 'lib/tasks/bundler_audit.rake'
  append_file 'Rakefile', %(\ntask default: "bundler:audit"\n)
end
add_carrierwave_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 331
def add_carrierwave_gem
  inject_into_file('Gemfile', "\ngem 'carrierwave', '~> 0.10.0'", after: '# user_choice')
  inject_into_file('Gemfile',
                   "\ngem 'mini_magick', '~> 4.5.0'",
                   after: '# user_choice') if AppBuilder.file_storage_name
end
add_ckeditor_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 244
def add_ckeditor_gem
  inject_into_file('Gemfile', "\ngem 'ckeditor'", after: '# user_choice')
end
add_cyrillizer_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 240
def add_cyrillizer_gem
  inject_into_file('Gemfile', "\ngem 'cyrillizer'", after: '# user_choice')
end
add_devise_bootstrap_views_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 248
def add_devise_bootstrap_views_gem
  inject_into_file('Gemfile', "\ngem 'devise-bootstrap-views'", after: '# user_choice')
end
add_devise_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 96
    def add_devise_gem
      devise_conf = <<-TEXT

  # v.3.5 syntax. will be deprecated in 4.0
  def configure_permitted_parameters
    devise_parameter_sanitizer.permit(:sign_in) do |user_params|
      user_params.permit(:email, :password, :remember_me)
    end

    devise_parameter_sanitizer.permit(:sign_up) do |user_params|
      user_params.permit(:email, :password, :password_confirmation)
    end
  end
  protected :configure_permitted_parameters
    TEXT
      inject_into_file('Gemfile', "\ngem 'devise'", after: '# user_choice')
      inject_into_file('app/controllers/application_controller.rb',
                       "\nbefore_action :configure_permitted_parameters, if: :devise_controller?",
                       after: 'class ApplicationController < ActionController::Base')

      inject_into_file('app/controllers/application_controller.rb', devise_conf,
                       after: 'protect_from_forgery with: :exception')
      copy_file 'devise_rspec.rb', 'spec/support/devise.rb'
      copy_file 'devise.ru.yml', 'config/locales/devise.ru.yml'
    end
add_dotenv_heroku_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 19
def add_dotenv_heroku_gem
  inject_into_file('Gemfile', "\n  gem 'dotenv-heroku'",
                   after: 'group :development do')
  append_file 'Rakefile', %(\nrequire 'dotenv-heroku/tasks' if ENV['RACK_ENV'] == 'test' || ENV['RACK_ENV'] == 'development'\n)
end
add_face_of_active_admin_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 260
def add_face_of_active_admin_gem
  inject_into_file('Gemfile', "\ngem 'face_of_active_admin'", after: '# user_choice')
end
add_faker_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 70
def add_faker_gem
  inject_into_file('Gemfile', "\n  gem 'faker'", after: 'group :development, :test do')
end
add_flamegraph_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 311
def add_flamegraph_gem
  inject_into_file('Gemfile', "\n  gem 'flamegraph'", after: 'group :development do')
end
add_flattened_active_admin_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 232
def add_flattened_active_admin_gem
  inject_into_file('Gemfile', "\ngem 'flattened_active_admin'", after: '# user_choice')
end
add_font_awesome_sass_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 236
def add_font_awesome_sass_gem
  inject_into_file('Gemfile', "\ngem 'font-awesome-sass', '~> 4.5.0'", after: '# user_choice')
end
add_fotoramajs_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 269
def add_fotoramajs_gem
  inject_into_file('Gemfile', "\ngem 'fotoramajs'", after: '# user_choice')
end
add_geocoder_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 273
def add_geocoder_gem
  inject_into_file('Gemfile', "\ngem 'geocoder'", after: '# user_choice')
end
add_git_up_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 362
def add_git_up_gem
  inject_into_file('Gemfile', "\n  gem 'git-up'", after: 'group :development do')
end
add_gmaps4rails_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 277
def add_gmaps4rails_gem
  inject_into_file('Gemfile', "\ngem 'gmaps4rails'", after: '# user_choice')
end
add_guard_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 40
    def add_guard_gem
      t = <<-TEXT.chomp

  gem 'guard'
  gem 'guard-livereload', '~> 2.4', require: false
  gem 'guard-puma', require: false
  gem 'guard-migrate', require: false
  gem 'guard-rspec', require: false
  gem 'guard-bundler', require: false
      TEXT
      inject_into_file('Gemfile', t, after: 'group :development do')
    end
add_guard_rubocop_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 53
def add_guard_rubocop_gem
  if user_choose?(:guard) && user_choose?(:rubocop)
    inject_into_file('Gemfile', "\n  gem 'guard-rubocop'",
                     after: 'group :development do')
  else
    say_color RED, 'You need Guard & Rubocop gems for this add-on'
  end
end
add_haml_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 15
def add_haml_gem
  inject_into_file('Gemfile', "\ngem 'haml-rails'", after: '# user_choice')
end
add_hirbunicode_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 126
def add_hirbunicode_gem
  inject_into_file('Gemfile', "\ngem 'hirb-unicode'", after: '# user_choice')
end
add_image_optim_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 285
def add_image_optim_gem
  inject_into_file('Gemfile', "\n  gem 'image_optim_pack'", after: 'group :development do')
  inject_into_file('Gemfile', "\n  gem 'image_optim'", after: 'group :development do')
end
add_invisible_captcha_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 338
def add_invisible_captcha_gem
  inject_into_file('Gemfile', "\ngem 'invisible_captcha'", after: '# user_choice')
end
add_kaminari_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 203
def add_kaminari_gem
  inject_into_file('Gemfile', "\ngem 'kaminari'", after: '# user_choice')
  inject_into_file('Gemfile', "\ngem 'kaminari-i18n'", after: '# user_choice')
  copy_file 'kaminari.rb', 'config/initializers/kaminari.rb'
  inject_into_file('Gemfile', "\ngem 'bootstrap-kaminari-views'",
                   after: '# user_choice') if user_choose?(:bootstrap3) ||
                                              user_choose?(:bootstrap3_sass)
end
add_mailcatcher_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 290
def add_mailcatcher_gem
  inject_into_file('Gemfile', "\n  gem 'mailcatcher'", after: 'group :development do')
end
add_materialize_sass_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 346
def add_materialize_sass_gem
  inject_into_file('Gemfile', "\ngem 'materialize-sass'", after: '# user_choice')
end
add_meta_request_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 62
def add_meta_request_gem
  inject_into_file('Gemfile',
                   "\n  gem 'meta_request' # link for chrome add-on. "\
                   'https://chrome.google.com/webstore/detail/'\
                   'railspanel/gjpfobpafnhjhbajcjgccbbdofdckggg',
                   after: 'group :development do')
end
add_newrelic_rpm_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 303
def add_newrelic_rpm_gem
  inject_into_file('Gemfile', "\ngem 'newrelic_rpm'", after: '# user_choice')
end
add_overcommit_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 140
    def add_overcommit_gem
      inject_into_file('Gemfile', "\n  gem 'overcommit'", after: 'group :development do')
      copy_file 'onotole_overcommit.yml', '.overcommit.yml'
      rubocop_overcommit = <<-OVER
  RuboCop:
    enabled: true
    description: 'Analyzing with RuboCop'
    required_executable: 'rubocop'
    flags: ['--format=emacs', '--force-exclusion', '--display-cop-names']
    install_command: 'gem install rubocop'
    include:
      - '**/*.gemspec'
      - '**/*.rake'
      - '**/*.rb'
      - '**/Gemfile'
      - '**/Rakefile'
      OVER
      append_file '.overcommit.yml', rubocop_overcommit if user_choose?(:rubocop)
    end
add_paper_trail_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 220
def add_paper_trail_gem
  inject_into_file('Gemfile', "\ngem 'paper_trail'", after: '# user_choice')
end
add_prawn_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 264
def add_prawn_gem
  inject_into_file('Gemfile', "\ngem 'prawn'", after: '# user_choice')
  inject_into_file('Gemfile', "\ngem 'prawn-table'", after: '# user_choice')
end
add_pundit_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 358
def add_pundit_gem
  inject_into_file('Gemfile', "\n  gem 'pundit'", after: '# user_choice')
end
add_rack_cors_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 294
def add_rack_cors_gem
  inject_into_file('Gemfile', "\ngem 'rack-cors', :require => 'rack/cors'", after: '# user_choice')
end
add_rack_mini_profiler_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 298
def add_rack_mini_profiler_gem
  inject_into_file('Gemfile', "\n  gem 'rack-mini-profiler', require: false", after: '# user_choice')
  copy_file 'rack_mini_profiler.rb', 'config/initializers/rack_mini_profiler.rb'
end
add_railroady_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 187
def add_railroady_gem
  inject_into_file('Gemfile', "\n  gem 'railroady'", after: 'group :development do')
end
add_rails_admin_gem() click to toggle source

def add_administrate_gem

inject_into_file('Gemfile', "\ngem 'administrate'", after: '# user_choice')

end

# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 178
def add_rails_admin_gem
  inject_into_file('Gemfile', "\ngem 'rails_admin'", after: '# user_choice')
end
add_rails_db_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 30
def add_rails_db_gem
  inject_into_file('Gemfile', "\n  gem 'rails_db'\n  gem 'axlsx_rails'", after: '# user_choice')
end
add_redis_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 319
def add_redis_gem
  inject_into_file('Gemfile', "\ngem 'redis', '~>3.2'", after: '# user_choice')
end
add_redis_namespace_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 327
def add_redis_namespace_gem
  inject_into_file('Gemfile', "\ngem 'redis-namespace'", after: '# user_choice')
end
add_redis_rails_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 323
def add_redis_rails_gem
  inject_into_file('Gemfile', "\ngem 'redis-rails'", after: '# user_choice')
end
add_responders_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 122
def add_responders_gem
  inject_into_file('Gemfile', "\ngem 'responders'", after: '# user_choice')
end
add_rubocop_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 34
def add_rubocop_gem
  inject_into_file('Gemfile', "\n  gem 'rubocop', require: false",
                   after: 'group :development do')
  copy_file 'rubocop.yml', '.rubocop.yml'
end
add_rubycritic_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 182
def add_rubycritic_gem
  inject_into_file('Gemfile', "\n  gem 'rubycritic', :require => false",
                   after: 'group :development do')
end
add_sitemap_generator_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 342
def add_sitemap_generator_gem
  inject_into_file('Gemfile', "\n  gem 'sitemap_generator', :require => false", after: 'group :development do')
end
add_slim_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 25
def add_slim_gem
  inject_into_file('Gemfile', "\ngem 'slim-rails'", after: '# user_choice')
  inject_into_file('Gemfile', "\n  gem 'html2slim'", after: 'group :development do')
end
add_stackprof_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 315
def add_stackprof_gem
  inject_into_file('Gemfile', "\n  gem 'stackprof'", after: 'group :development do')
end
add_therubyracer_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 354
def add_therubyracer_gem
  inject_into_file('Gemfile', "\n  gem 'therubyracer'", after: '# user_choice')
end
add_tinymce_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 130
def add_tinymce_gem
  inject_into_file('Gemfile', "\ngem 'tinymce-rails'", after: '# user_choice')
  inject_into_file('Gemfile', "\ngem 'tinymce-rails-langs'", after: '# user_choice')
  copy_file 'tinymce.yml', 'config/tinymce.yml'
end
add_typus_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 191
def add_typus_gem
  inject_into_file('Gemfile', "\n  gem 'typus', github: 'typus/typus'", after: '# user_choice')
end
add_underscore_rails_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 281
def add_underscore_rails_gem
  inject_into_file('Gemfile', "\ngem 'underscore-rails'", after: '# user_choice')
end
add_user_gems() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 4
def add_user_gems
  add_to_user_choise(:devise_bootstrap_views) if user_choose?(:bootstrap3_sass) && user_choose?(:devise)
  GEMPROCLIST.each do |g|
    send "add_#{g}_gem" if user_choose? g.to_sym
  end
end
add_validates_timeliness_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 224
def add_validates_timeliness_gem
  inject_into_file('Gemfile', "\ngem 'validates_timeliness'", after: '# user_choice')
end
add_will_paginate_gem() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 195
def add_will_paginate_gem
  inject_into_file('Gemfile', "\ngem 'will_paginate', '~> 3.0.6'",
                   after: '# user_choice')
  inject_into_file('Gemfile', "\ngem 'will_paginate-bootstrap'",
                   after: '# user_choice') if user_choose?(:bootstrap3) ||
                                              user_choose?(:bootstrap3_sass)
end
setup_default_gems() click to toggle source
# File lib/onotole/add_user_gems/before_bundle_patch.rb, line 11
def setup_default_gems
  add_to_user_choise(:normalize)
end