lib/calabash/application.rb in calabash-2.0.0.pre6 vs lib/calabash/application.rb in calabash-2.0.0.pre9
- old
+ new
@@ -19,10 +19,25 @@
@@default = value
end
attr_reader :path
+ # Get the application from the default environment.
+ def self.default_from_environment
+ application_path = Environment::APP_PATH
+
+ if application_path.nil?
+ raise 'No application path is set. Specify application with environment variable CAL_APP'
+ end
+
+ unless File.exist?(application_path)
+ raise "Application '#{application_path}' does not exist"
+ end
+
+ Application.from_path(application_path)
+ end
+
# Create an application from a path
#
# @return [Calabash::Android::Application, Calabash::IOS::Application] An
# application for `path`.
def self.from_path(path)
@@ -47,9 +62,23 @@
@path = File.expand_path(application_path)
@logger = options[:logger] || Calabash::Logger.new
@identifier = options[:identifier]
ensure_application_path
+ end
+
+ # Is this application an android application
+ #
+ # @return [Boolean] true if this application is an android application
+ def android_application?
+ false
+ end
+
+ # Is this application an iOS application
+ #
+ # @return [Boolean] true if this application is an iOS application
+ def ios_application?
+ false
end
# @!visibility private
def to_s
"#<Application #{path}>"