Sha256: a9f1fa96983874fc3071891351cc5f601188180560d92d69e8b5dcbfc41a1dc7

Contents?: true

Size: 1.16 KB

Versions: 9

Compression:

Stored size: 1.16 KB

Contents

require 'templater'

module Cucumber
  module Sinatra
    module Generators
      extend Templater::Manifold

      class InitGenerator < Templater::Generator
        def self.source_root
          File.join(File.dirname(__FILE__), 'templates')
        end

        desc <<-DESC
          Initialize a cucumber environment for a sinatra application.
            cucumber-sinatra MyApp lib/myapp.rb
        DESC

        first_argument :app_class, :required => true, :desc => 'Application class'
        second_argument :app_file, :required => true, :desc => 'Application file'

        option :app, :as => :boolean, :default => false, :desc => 'Create the application files as well.'

        template :env, 'features/support/env.rb'
        template :paths, 'features/support/paths.rb'
        template :steps, 'features/step_definitions/web_steps.rb'
        template :app_file, 'app.rbt', '%app_file_path%', :app => true
        template :rackup_file, 'config.ru', 'config.ru', :app => true

        def app_file_path
          app_file
        end
      end

      desc "Generators to simplify the usage of cucumber with sinatra."
      add :init, InitGenerator
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
cucumber-sinatra-0.5.0 lib/cucumber/sinatra/generators.rb
cucumber-sinatra-0.4.0 lib/cucumber/sinatra/generators.rb
cucumber-sinatra-0.3.1 lib/cucumber/sinatra/generators.rb
cucumber-sinatra-0.3.0 lib/cucumber/sinatra/generators.rb
cucumber-sinatra-0.2.4 lib/cucumber/sinatra/generators.rb
cucumber-sinatra-0.2.3 lib/cucumber/sinatra/generators.rb
cucumber-sinatra-0.2.2 lib/cucumber/sinatra/generators.rb
cucumber-sinatra-0.2.1 lib/cucumber/sinatra/generators.rb
cucumber-sinatra-0.2.0 lib/cucumber/sinatra/generators.rb