Sha256: f9f64f150ee0085b2fe6add67683ff2e83d5961ef8bbbac23b5be81604813e23

Contents?: true

Size: 877 Bytes

Versions: 6

Compression:

Stored size: 877 Bytes

Contents

class SauceGenerator < Rails::Generators::Base
  source_root File.expand_path("../templates", __FILE__)

  argument :username, :type => nil
  argument :api_key, :type => nil

  def copy_rake_tasks
    copy_file "sauce.rake", "lib/tasks/sauce.rake"
  end

  def setup_spec
    if File.directory? 'spec'
      empty_directory "spec/selenium"
      append_file "spec/spec_helper.rb", generate_config
    end
  end

  def setup_test
    empty_directory "test/selenium"
    append_file "test/test_helper.rb", generate_config
  end

  private

  def generate_config
    @random_id ||= rand(100000)
    return <<-CONFIG
require 'sauce'

Sauce.config do |conf|
    conf.browser_url = "http://#{@random_id}.test/"
    conf.browsers = [
        ["Windows 2003", "firefox", "3."]
    ]
    conf.application_host = "127.0.0.1"
    conf.application_port = "3001"
end
      CONFIG
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sauce-0.12.6 lib/generators/sauce_generator.rb
sauce-0.12.5 lib/generators/sauce_generator.rb
sauce-0.12.3 lib/generators/sauce_generator.rb
sauce-0.12.2 lib/generators/sauce_generator.rb
sauce-0.12.1 lib/generators/sauce_generator.rb
sauce-0.12.0 lib/generators/sauce_generator.rb