Sha256: 3828cc302f2a8d7c6c28d40db0b6a31a0208f91be09f12ce80619c36636558d5

Contents?: true

Size: 1.19 KB

Versions: 11

Compression:

Stored size: 1.19 KB

Contents

require 'thor'

class Alchemy::Custom::Model::InstallTask < Thor
  include Thor::Actions

  no_tasks do
    def inject_assets
      sentinel = /\*\//
      inject_into_file "./vendor/assets/stylesheets/alchemy/admin/all.css", "\n*= require alchemy-custom-model/manifest.css\n",
                       { before: sentinel, verbose: true }
      append_to_file "./vendor/assets/javascripts/alchemy/admin/all.js", "\n//= require alchemy-custom-model/manifest.js\n",
                       {verbose: true }
    end

    def inject_routes
      sentinel = /mount Alchemy::Engine \=\>/
      inject_into_file "./config/routes.rb", "\n mount Alchemy::Custom::Model::Engine => '/alchemy-custom-model'\n", { before: sentinel, verbose: true }
    end


  end
end

namespace :alchemy_custom_model do

  desc "installazione gemma"
  task :install do
    # Task goes here
    install_helper = Alchemy::Custom::Model::InstallTask.new

    #installa friendly_id
    system("rails generate friendly_id")
    system("bin/rails alchemy_custom_model:install:migrations")
    system("bin/rails db:migrate")

    system("yarn add alchemy-custom-model") || exit!(1)



    install_helper.inject_assets
    install_helper.inject_routes
  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
alchemy-custom-model-3.2 lib/tasks/alchemy_custom_model_tasks.rake
alchemy-custom-model-3.1.5 lib/tasks/alchemy_custom_model_tasks.rake
alchemy-custom-model-3.1.4 lib/tasks/alchemy_custom_model_tasks.rake
alchemy-custom-model-3.1.3 lib/tasks/alchemy_custom_model_tasks.rake
alchemy-custom-model-3.1.2 lib/tasks/alchemy_custom_model_tasks.rake
alchemy-custom-model-3.1.1 lib/tasks/alchemy_custom_model_tasks.rake
alchemy-custom-model-3.1.0 lib/tasks/alchemy_custom_model_tasks.rake
alchemy-custom-model-2.2.2 lib/tasks/alchemy_custom_model_tasks.rake
alchemy-custom-model-3.0.0 lib/tasks/alchemy_custom_model_tasks.rake
alchemy-custom-model-2.2.1 lib/tasks/alchemy_custom_model_tasks.rake
alchemy-custom-model-2.2.0 lib/tasks/alchemy_custom_model_tasks.rake