Sha256: 63e72ccab38ef543e154ae383e7b5eb2330c9306ff2c94f3ba77d75c359c882b

Contents?: true

Size: 1019 Bytes

Versions: 3

Compression:

Stored size: 1019 Bytes

Contents

module Tay
  module CLI
    class Generate < ::Thor
      desc "content_script", "Generate a content script"
      method_option 'script-name', :type => :string, :default => 'content_script',
        :aliases => '-n', :banner => 'The name of the content script'
      method_option 'no-javascript', :type => :boolean, :default => false,
        :banner => "Don\'t create a javascript file"
      method_option 'no-stylesheet', :type => :boolean, :default => false,
        :banner => "Don\'t create a stylesheet"
      def content_script
        fs_name = Utils.filesystem_name(options['script-name'])

        unless options['no-javascript']
          copy_file('content_script/content_script.js', javascript_dir.join(fs_name + '.js'))
        end
        unless options['no-stylesheet']
          copy_file('content_script/content_script.css', stylesheet_dir.join(fs_name + '.css'))
        end
        inject_tayfile_content(render_template('content_script/tayfile', :fs_name => fs_name))
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tay-0.1.0 lib/tay/cli/generators/content_script.rb
tay-0.0.5 lib/tay/cli/generators/content_script.rb
tay-0.0.4 lib/tay/cli/generators/content_script.rb