Sha256: a08b2aa0cce592eb8cb644d67b596b4987f646278790cbf3a225a4748d6c5c14

Contents?: true

Size: 996 Bytes

Versions: 1

Compression:

Stored size: 996 Bytes

Contents

require 'rails/generators/migration'

module WepayRails
  module Generators
    class InstallGenerator < ::Rails::Generators::Base
      include Rails::Generators::Migration
      source_root File.expand_path('../templates', __FILE__)
      desc "add a migration for the Wepay Rails - WepayCheckoutRecord Model - Used to capture your transactions from Wepay"
      def self.next_migration_number(path)
        unless @prev_migration_nr
          @prev_migration_nr = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i
        else
          @prev_migration_nr += 1
        end
        @prev_migration_nr.to_s
      end
      
      def setup_routes
        route "WepayRails.routes(self)"
      end

      def copy_migrations
        migration_template "create_wepay_checkout_records.rb", "db/migrate/create_wepay_checkout_records.rb"
        copy_file "wepay_checkout_record.rb", "app/models/wepay_checkout_record.rb"
        copy_file "wepay.yml", "config/wepay.yml.example"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wepay-rails-2.6.0 lib/generators/wepay_rails/install/install_generator.rb