Sha256: 439dfd27e2781c30b0868a7a6d3d8794075768319a12579bc053099d4dd2150f

Contents?: true

Size: 1.52 KB

Versions: 14

Compression:

Stored size: 1.52 KB

Contents

module RailsConnector
  module Generators
    class InstallGenerator < Rails::Generators::Base
      desc "Copy Infopark Rails Connector files to your application."

      # Normally, you'd just call 'source_root' as a class method from here,
      # but we need to glob the dir ourselves. Hence our own method.
      def self.source_root
        @source_root ||= File.expand_path('../templates', __FILE__)
      end

      def install_configuration
        copy_file "initializers/rails_connector.rb", "config/initializers/rails_connector.rb"
        copy_file 'initializers/crm_connector.rb', 'config/initializers/crm_connector.rb'
        copy_file "obj_extensions.rb", "lib/obj_extensions.rb"
        copy_file "local/configuration.rb", "config/local/configuration.rb"
      end

      def append_asset_manifests
        append_file("app/assets/javascripts/application.js", "//= require infopark_rails_connector")
        gsub_file("app/assets/stylesheets/application.css", "*= require_tree .",
            "*= require_tree .\n *= require infopark_rails_connector")
      end

      def remove_public_index_html
        remove_file "public/index.html"
        remove_file "app/assets/images/rails.png"
      end

      def patch_default_application_layout
        gsub_file("app/views/layouts/application.html.erb", %r{</head>},
            "<%= rails_connector_header_tags %>\n</head>")
        gsub_file("app/views/layouts/application.html.erb", %r{</body>},
            "<%= rails_connector_after_content_tags %>\n</body>")
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
infopark_rails_connector-6.8.1.26.236500544 lib/generators/rails_connector/install/install_generator.rb
infopark_rails_connector-6.8.1 lib/generators/rails_connector/install/install_generator.rb
infopark_rails_connector-6.8.0.539.93842523 lib/generators/rails_connector/install/install_generator.rb
infopark_rails_connector-6.8.0.529.114081979 lib/generators/rails_connector/install/install_generator.rb
infopark_rails_connector-6.8.0.518.30999728 lib/generators/rails_connector/install/install_generator.rb
infopark_rails_connector-6.8.0.515.34928522 lib/generators/rails_connector/install/install_generator.rb
infopark_rails_connector-6.8.0.498.46559598 lib/generators/rails_connector/install/install_generator.rb
infopark_rails_connector-6.8.0.480.261594408 lib/generators/rails_connector/install/install_generator.rb
infopark_rails_connector-6.8.0.444.171626367 lib/generators/rails_connector/install/install_generator.rb
infopark_rails_connector-6.8.0.406.131718077 lib/generators/rails_connector/install/install_generator.rb
infopark_rails_connector-6.8.0.356.19698103 lib/generators/rails_connector/install/install_generator.rb
infopark_rails_connector-6.8.0.348.160665197 lib/generators/rails_connector/install/install_generator.rb
infopark_rails_connector-6.8.0.328.4a753fc lib/generators/rails_connector/install/install_generator.rb
infopark_rails_connector-6.8.0.322.c003f11 lib/generators/rails_connector/install/install_generator.rb