Sha256: 1747be2b1dbca06dde930a6e2f4a2e34f40b07f3867105319a8b38159d8cfb96

Contents?: true

Size: 996 Bytes

Versions: 3

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", "lib/models/wepay_checkout_record.rb"
        copy_file "wepay.yml", "config/wepay.yml.example"
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
wepay-rails-2.5.2 lib/generators/wepay_rails/install/install_generator.rb
wepay-rails-2.5.1 lib/generators/wepay_rails/install/install_generator.rb
wepay-rails-2.5.0 lib/generators/wepay_rails/install/install_generator.rb