Sha256: 0b1538b363237a35cd8c7c48fc8c71733dffe5b75c7ac1202d4f4f3737ad89e8

Contents?: true

Size: 971 Bytes

Versions: 47

Compression:

Stored size: 971 Bytes

Contents

# frozen_string_literal: true
require 'rails/generators/base'

module ShopifyApp
  module Generators
    class AddMarketingActivityExtensionGenerator < Rails::Generators::Base
      source_root File.expand_path('../templates', __FILE__)

      def generate_app_extension
        template("marketing_activities_controller.rb", "app/controllers/marketing_activities_controller.rb")
        generate_routes
      end

      private

      def generate_routes
        inject_into_file(
          'config/routes.rb',
          optimize_indentation(routes, 2),
          after: "root :to => 'home#index'\n"
        )
      end

      def routes
        <<~EOS

          resource :marketing_activities, only: [:create, :update] do
            patch :resume
            patch :pause
            patch :delete
            post :republish
            post :preload_form_data
            post :preview
            post :errors
          end
        EOS
      end
    end
  end
end

Version data entries

47 entries across 47 versions & 2 rubygems

Version Path
ruby_shopify_app-1.3.3 lib/generators/shopify_app/add_marketing_activity_extension/add_marketing_activity_extension_generator.rb
ruby_shopify_app-1.3.2 lib/generators/shopify_app/add_marketing_activity_extension/add_marketing_activity_extension_generator.rb
ruby_shopify_app-1.3.1 lib/generators/shopify_app/add_marketing_activity_extension/add_marketing_activity_extension_generator.rb
ruby_shopify_app-1.3.0 lib/generators/shopify_app/add_marketing_activity_extension/add_marketing_activity_extension_generator.rb
ruby_shopify_app-1.2.0 lib/generators/shopify_app/add_marketing_activity_extension/add_marketing_activity_extension_generator.rb
ruby_shopify_app-1.1.0 lib/generators/shopify_app/add_marketing_activity_extension/add_marketing_activity_extension_generator.rb
ruby_shopify_app-1.0.0 lib/generators/shopify_app/add_marketing_activity_extension/add_marketing_activity_extension_generator.rb
shopify_app-18.1.3 lib/generators/shopify_app/add_marketing_activity_extension/add_marketing_activity_extension_generator.rb
shopify_app-18.1.2 lib/generators/shopify_app/add_marketing_activity_extension/add_marketing_activity_extension_generator.rb
shopify_app-18.1.1 lib/generators/shopify_app/add_marketing_activity_extension/add_marketing_activity_extension_generator.rb
shopify_app-18.1.0 lib/generators/shopify_app/add_marketing_activity_extension/add_marketing_activity_extension_generator.rb
shopify_app-18.0.4 lib/generators/shopify_app/add_marketing_activity_extension/add_marketing_activity_extension_generator.rb
shopify_app-18.0.3 lib/generators/shopify_app/add_marketing_activity_extension/add_marketing_activity_extension_generator.rb
shopify_app-18.0.2 lib/generators/shopify_app/add_marketing_activity_extension/add_marketing_activity_extension_generator.rb
shopify_app-18.0.1 lib/generators/shopify_app/add_marketing_activity_extension/add_marketing_activity_extension_generator.rb
shopify_app-18.0.0 lib/generators/shopify_app/add_marketing_activity_extension/add_marketing_activity_extension_generator.rb
shopify_app-17.2.1 lib/generators/shopify_app/add_marketing_activity_extension/add_marketing_activity_extension_generator.rb
shopify_app-17.2.0 lib/generators/shopify_app/add_marketing_activity_extension/add_marketing_activity_extension_generator.rb
shopify_app-17.1.1 lib/generators/shopify_app/add_marketing_activity_extension/add_marketing_activity_extension_generator.rb
shopify_app-17.1.0 lib/generators/shopify_app/add_marketing_activity_extension/add_marketing_activity_extension_generator.rb