<commit_before>GENERATOR_PATH = File.dirname(File.expand_path(__FILE__)) +  '/../'

create_file 'Gemfile', "# created by inline_forms #{ENV['inline_forms_version']} on #{Date.today}\n"

add_source 'https://rubygems.org'

# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
#gem 'bootsnap', require: false
#gem 'compass-rails'
# gem 'modernizr-rails'

gem 'cancancan'
gem 'carrierwave'
gem 'ckeditor', github: 'galetahub/ckeditor'
gem 'coffee-rails'
gem 'devise-i18n', :git => 'https://github.com/acesuares/devise-i18n.git'
gem 'devise'
gem 'foundation-icons-sass-rails'
gem 'foundation-rails', '~> 5.5'
gem 'i18n-active_record', :git => 'https://github.com/acesuares/i18n-active_record.git'
gem 'inline_forms', '~> 6.2'
gem 'jquery-rails'
gem 'jquery-timepicker-rails'
gem 'jquery-ui-sass-rails'
gem 'mini_magick'
gem 'mysql2'
gem 'paper_trail'
gem 'rails-i18n', :git => 'https://github.com/svenfuchs/rails-i18n.git'  # since https://github.com/svenfuchs/rails-i18n/pull/794 we don't have to maintain 'https://github.com/acesuares/rails-i18n.git' anymore!
gem 'rails-jquery-autocomplete'
gem 'rails', '6.1.3.1'
gem 'rake'
gem 'remotipart', '~> 1.0'
gem 'rvm'
gem 'sass-rails'
gem 'tabs_on_rails', :git => 'https://github.com/acesuares/tabs_on_rails.git', :branch => 'update_remote_before_action'
gem 'unicorn'
gem 'validation_hints'
gem 'will_paginate' #, git: 'https://github.com/acesuares/will_paginate.git'

gem_group :development do
  gem 'capistrano-bundler', require: false
  gem 'capistrano-rails', require: false
  gem 'capistrano', require: false
  gem 'capistrano3-unicorn'
  gem 'listen'
  gem 'rvm-capistrano', :require => false
  gem 'rvm1-capistrano3', require: false
  gem 'seed_dump', '~> 0.5.3'
  gem 'sqlite3'
  gem 'switch_user'
  gem 'thin'
  gem 'yaml_db'
end

gem_group :production do
  gem 'mini_racer'
  gem 'uglifier'
end

say "- Running bundle..."
run "gem install bundler"
run "bundle install"

say "- Database setup: creating config/database.yml with development database #{ENV['database']}"
remove_file "config/database.yml" # the one that 'rails new' created
if ENV['using_sqlite'] == 'true'
  create_file "config/database.yml", <<-END_DATABASEYML.strip_heredoc
  development:
    adapter: sqlite3
    database: db/development.sqlite3
    pool: 5
    timeout: 5000

  END_DATABASEYML
else
  create_file "config/database.yml", <<-END_DATABASEYML.strip_heredoc
  development:
    adapter: mysql2
    database: <%= ENV["DATABASE_NAME"] %>
    username: <%= ENV["DATABASE_USER"] %>
    password: <%= ENV["<PASSWORD>"] %>
  END_DATABASEYML
end
append_file "config/database.yml", <<-END_DATABASEYML.strip_heredoc
  production:
    adapter: mysql2
    database: <%= ENV["DATABASE_NAME"] %>
    username: <%= ENV["DATABASE_USER"] %>
    password: <%= ENV["DATABASE_PASSWORD"] %>
END_DATABASEYML

say "- Devise install..."
run "bundle exec rails g devise:install"

say "- Create Devise route and add path_prefix..."

route <<-ROUTE.strip_heredoc
devise_for :users, :path_prefix => 'auth'
  resources :users do
    post 'revert', :on => :member
    get 'list_versions', :on => :member
end
ROUTE

say "- Create devise migration file"

sleep 1 # to get unique migration number
create_file "db/migrate/" +
  Time.now.utc.strftime("%Y%m%d%H%M%S") +
  "_" +
  "devise_create_users.rb", <<-DEVISE_MIGRATION.strip_heredoc
class DeviseCreateUsers < ActiveRecord::Migration[5.0]

  def change
    create_table(:users) do |t|
      ## Database authenticatable
      t.string :email,              null: false, default: ""
      t.string :encrypted_password, null: false, default: ""

      ## Recoverable
      t.string   :reset_password_token<commit_msg>upgrade Gemfile, gemspec and delete some files<commit_after>GENERATOR_PATH = File.dirname(File.expand_path(__FILE__)) +  '/../'

create_file 'Gemfile', "# created by inline_forms #{ENV['inline_forms_version']} on #{Date.today}\n"

add_source 'https://rubygems.org'

# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
#gem 'bootsnap', require: false
#gem 'compass-rails'
# gem 'modernizr-rails'

gem 'cancancan'
gem 'carrierwave'
gem 'ckeditor', github: 'galetahub/ckeditor'
gem 'coffee-rails'
gem 'devise-i18n', :git => 'https://github.com/acesuares/devise-i18n.git'
gem 'devise'
gem 'foundation-icons-sass-rails'
gem 'foundation-rails', '~> 5.5'
gem 'i18n-active_record', :git => 'https://github.com/acesuares/i18n-active_record.git'
gem 'inline_forms', '~> 6.2'
gem 'jquery-rails'
gem 'jquery-timepicker-rails'
gem 'jquery-ui-sass-rails'
gem 'mini_magick'
gem 'mysql2'
gem 'paper_trail'
gem 'rails-i18n', :git => 'https://github.com/svenfuchs/rails-i18n.git'  # since https://github.com/svenfuchs/rails-i18n/pull/794 we don't have to maintain 'https://github.com/acesuares/rails-i18n.git' anymore!
gem 'rails-jquery-autocomplete'
gem 'rails', '6.1.3.1'
gem 'rake'
gem 'remotipart', '~> 1.0'
gem 'rvm'
gem 'sass-rails'
gem 'tabs_on_rails', :git => 'https://github.com/acesuares/tabs_on_rails.git', :branch => 'update_remote_before_action'
gem 'unicorn'
gem 'validation_hints'
gem 'will_paginate' #, git: 'https://github.com/acesuares/will_paginate.git'

gem_group :development do
  gem 'capistrano-bundler', require: false
  gem 'capistrano-rails', require: false
  gem 'capistrano', require: false
  gem 'capistrano3-unicorn'
  gem 'listen'
  gem 'rvm-capistrano', :require => false
  gem 'rvm1-capistrano3', require: false
  gem 'seed_dump', '~> 0.5.3'
  gem 'sqlite3'
  gem 'switch_user'
  gem 'thin'
  gem 'yaml_db'
end

gem_group :production do
  gem 'mini_racer'
  gem 'uglifier'
end

say "- Running bundle..."
run "gem install bundler"
run "bundle install"

say "- Database setup: creating config/database.yml with development database #{ENV['database']}"
remove_file "config/database.yml" # the one that 'rails new' created
if ENV['using_sqlite'] == 'true'
  create_file "config/database.yml", <<-END_DATABASEYML.strip_heredoc
  development:
    adapter: sqlite3
    database: db/development.sqlite3
    pool: 5
    timeout: 5000

  END_DATABASEYML
else
  create_file "config/database.yml", <<-END_DATABASEYML.strip_heredoc
  development:
    adapter: mysql2
    database: <%= ENV["DATABASE_NAME"] %>
    username: <%= ENV["DATABASE_USER"] %>
    password: <%= ENV["DATABASE_PASSWORD"] %>
  END_DATABASEYML
end
append_file "config/database.yml", <<-END_DATABASEYML.strip_heredoc
  production:
    adapter: mysql2
    database: <%= ENV["DATABASE_NAME"] %>
    username: <%= ENV["DATABASE_USER"] %>
    password: <%= ENV["DATABASE_PASSWORD"] %>
END_DATABASEYML

say "Setting development database in credentials"
development_database_credentials =
"development:
  database: test1
  username: test1
  password: <PASSWORD>'
  "
run "EDITOR='echo #{development_database_credentials} >> ' rails credentials:edit"

say "- Devise install..."
run "bundle exec rails g devise:install"

say "- Create Devise route and add path_prefix..."

route <<-ROUTE.strip_heredoc
devise_for :users, :path_prefix => 'auth'
  resources :users do
    post 'revert', :on => :member
    get 'list_versions', :on => :member
end
ROUTE

say "- Create devise migration file"

sleep 1 # to get unique migration number
create_file "db/migrate/" +
  Time.now.utc.strftime("%Y%m%d%H%M%S") +
  "_" +
  "devise_create_users.rb", <<-DEVISE_MIGRATION.strip_heredoc
class DeviseCreateUsers < ActiveRecord::Migration[5.0]

  def change
    create_table(:users) do |t|
      ## Database authenticatable
      t.string :email,              null: false, default: ""
      t.string :encrypted_password, null: false, default: ""

      ## Recoverable
      t.string   :reset_password_token
{'fraction_non_alphanumeric': 0.1471615155825682, 'fraction_numerical': 0.0129315918789603, 'mean_word_length': 4.592190889370933, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 45, 'https://': 18, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3498660', 'n_tokens_mistral': 2946, 'n_tokens_neox': 2768, 'n_words': 632}