module Teaspoon
Need to have BrowserStackLocal binary (www.browserstack.com/local-testing#command-line) running in the background to use this driver.
Constants
- DEV_PATH
- FIXTURE_PATH
- RAKEFILE
- RESULT_ATTRS
- SPEC_HELPER
- VERSION
Public Class Methods
abort(message = nil, code = 1)
click to toggle source
# File lib/teaspoon/utility.rb, line 8 def self.abort(message = nil, code = 1) STDOUT.print("#{message}\n") if message exit(code) end
configure() { |configuration| ... }
click to toggle source
# File lib/teaspoon/configuration.rb, line 167 def self.configure yield @@configuration @@configured = true @@configuration.override_from_env(ENV) end
dep(message, category = nil)
click to toggle source
# File lib/teaspoon/deprecated.rb, line 11 def self.dep(message, category = nil) return if Teaspoon.configured if category return if @dep_notified[category] @dep_notified[category] = true if category end puts "WARNING: Deprecated - #{message}" end
load_teaspoon_tasks()
click to toggle source
# File lib/teaspoon-devkit.rb, line 18 def self.load_teaspoon_tasks if !loaded_from_teaspoon_root? load File.join(RAKEFILE) end end
loaded_from_teaspoon_root?()
click to toggle source
# File lib/teaspoon-devkit.rb, line 14 def self.loaded_from_teaspoon_root? Dir.pwd == DEV_PATH end
require_dummy!()
click to toggle source
# File lib/teaspoon-devkit.rb, line 7 def self.require_dummy! unless defined?(Rails) ENV["RAILS_ROOT"] = File.join(DEV_PATH, "spec", "dummy") require File.join(ENV["RAILS_ROOT"], "config", "environment") end end
root()
click to toggle source
# File lib/teaspoon/utility.rb, line 4 def self.root defined?(Rails) ? Rails.root : Pathname.new(Dir.pwd) end
setup(&block)
click to toggle source
# File lib/teaspoon/deprecated.rb, line 2 def self.setup(&block) Teaspoon.dep( "Teaspoon.setup is deprecated, use Teaspoon.configure instead. The /initializer/teaspoon.rb file should be " + "removed, and a new teaspoon_env.rb file should be created by running the install generator." ) configure(&block) end
setup_framework_tasks(options)
click to toggle source
# File lib/teaspoon-devkit.rb, line 24 def self.setup_framework_tasks(options) extend Rake::DSL framework = options[:framework] framework_name = options[:framework_name] framework_const = options[:framework_const] framework_root = options[:framework_root] framework_env = options[:framework_env] compile_assets = options[:compile_assets] namespace :teaspoon do namespace framework do desc "Run the #{framework_name} code examples" RSpec::Core::RakeTask.new(:spec) do |t| t.pattern = File.expand_path("spec/**/*_spec.rb", framework_root) end desc "Run the #{framework_name} javascript tests" task :jsspec do rails_env = File.expand_path("spec/dummy/config/environment.rb", DEV_PATH) cmd = "rake teaspoon TEASPOON_DEVELOPMENT=true TEASPOON_RAILS_ENV=#{rails_env} TEASPOON_ENV=#{framework_env}" # we shell out to another command so that it creates a pristine runtime environment IO.popen(cmd).each do |line| STDOUT.print(line) end.close exit(1) unless $?.success? end desc "Builds Teaspoon #{framework_name} into the distribution ready bundle" task build: "#{framework}:build:javascripts" namespace :build do desc "Compile Teaspoon #{framework_name} coffeescripts into javacripts" task javascripts: :environment do env = Rails.application.assets Array(compile_assets).each do |filename| asset = env.find_asset("teaspoon/#{filename}") base_destination = framework_const.asset_paths.first asset.write_to(File.expand_path("teaspoon-#{filename}", base_destination)) end end end end end if !loaded_from_teaspoon_root? Rake::Task["release"].clear end desc "Build and push teaspoon-#{framework} to Rubygems\n" task "release" => ["build", "release:guard_clean", "release:rubygem_push"] do end if !loaded_from_teaspoon_root? Rake::Task["default"].prerequisites.clear Rake::Task["default"].clear task default: ["teaspoon:#{framework}:spec", "teaspoon:#{framework}:jsspec"] end end