Sha256: 5fabcec6cda6a0515c499641f073727ed23c4bd099f270bbb03669982a4947a9

Contents?: true

Size: 966 Bytes

Versions: 5

Compression:

Stored size: 966 Bytes

Contents

module Tay
  module CLI
    class Generate < ::Thor
      desc "page_action", "Generate a page action"
      method_option 'action-name', :type => :string, :default => 'Page Action',
        :aliases => '-n', :banner => 'The name of the page action'
      def page_action
        raise Tay::InvalidSpecification.new("Page action already specified") if spec.page_action
        raise Tay::InvalidSpecification.new("You cannot have both page and browser actions") if spec.browser_action
        raise Tay::InvalidSpecification.new("You cannot have both page actions and packaged apps") if spec.packaged_app

        fs_name = Utils.filesystem_name(options['action-name'])
        copy_file('page_action/icon.png', asset_dir.join(fs_name + '_icon.png'))
        copy_file('page_action/controller.js', javascript_dir.join(fs_name + '_controller.js'))
        inject_tayfile_content(render_template('page_action/tayfile', :fs_name => fs_name))
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
tay-0.1.0 lib/tay/cli/generators/page_action.rb
tay-0.0.5 lib/tay/cli/generators/page_action.rb
tay-0.0.4 lib/tay/cli/generators/page_action.rb
tay-0.0.3 lib/tay/cli/generators/page_action.rb
tay-0.0.2 lib/tay/cli/generators/page_action.rb