Sha256: 661faad8b1edfcae965b618989e99ba7be76790b66d712c2d5c87bc8e21c1587

Contents?: true

Size: 1.11 KB

Versions: 5

Compression:

Stored size: 1.11 KB

Contents

module EmberCli
  class HerokuGenerator < Rails::Generators::Base
    source_root File.expand_path("../templates", __FILE__)

    namespace "ember:heroku"

    def copy_package_json_file
      template "package.json.erb", "package.json"
    end

    def identify_as_yarn_project
      if EmberCli.any?(&:yarn_enabled?)
        template "yarn.lock.erb", "yarn.lock"
      end
    end

    def inject_12factor_gem
      gem "rails_12factor", group: [:staging, :production]
    end

    private

    def cache_directories
      all_cached_directories.map do |cached_directory|
        cached_directory.relative_path_from(Rails.root).to_s
      end
    end

    def all_cached_directories
      app_specific_cached_directories + project_root_cached_directories
    end

    def app_specific_cached_directories
      apps.flat_map(&:cached_directories)
    end

    def project_root_cached_directories
      [Rails.root.join("node_modules")]
    end

    def app_paths
      EmberCli.apps.values.map do |app|
        app.root_path.relative_path_from(Rails.root)
      end
    end

    def apps
      EmberCli.apps.values
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ember-cli-rails-0.12.2 lib/generators/ember/heroku/heroku_generator.rb
ember-cli-rails-0.12.1 lib/generators/ember/heroku/heroku_generator.rb
ember-cli-rails-0.12.0 lib/generators/ember/heroku/heroku_generator.rb
ember-cli-rails-0.11.0 lib/generators/ember/heroku/heroku_generator.rb
ember-cli-rails-0.10.0 lib/generators/ember/heroku/heroku_generator.rb