class Sunomono::SunomonoRunner
Definition of the generators groups
Public Class Methods
new(*args)
click to toggle source
Overriding the initialize method to load all the translations supported by the gem gherkin
Calls superclass method
# File lib/sunomono.rb, line 288 def initialize(*args) super # Loading gherkin accepted translations translations_file_path = File.join( Gem.loaded_specs['gherkin'].full_gem_path, 'lib', 'gherkin', 'i18n.json' ) # Parsing the JSON file # Removing the sequence *| and all the alternative # options for the gherkin translations translations_json = JSON.parse( File.read(translations_file_path) .gsub(/\*\|/, '') .gsub(/\|.*\"/, '"') ) # Converting the translations to YAML and storing in a temp file translations_temp_file = Tempfile.new(['translations', '.yml']) File.write(translations_temp_file, translations_json.to_yaml) # Loading the translations from gherkin and from the # locales folder of this gem locales_folder_path = File.join( File.dirname(__FILE__), '..', 'lib', 'sunomono', 'locales' ) I18n.load_path = Dir[ translations_temp_file, File.join(locales_folder_path, '*.yml') ] I18n.backend.load_translations I18n.config.enforce_available_locales = true end
source_root()
click to toggle source
# File lib/sunomono.rb, line 282 def self.source_root File.join(File.dirname(__FILE__), '..', 'lib', 'templates') end
Public Instance Methods
new(platform, name)
click to toggle source
# File lib/sunomono.rb, line 239 def new(platform, name) framework_avaliable?(platform) I18n.config.default_locale = options[:lang] # Thor will be responsible to look for identical # files and possibles conflicts if platform.downcase == 'calabash' directory File.join(File.dirname(__FILE__), '..', 'lib', 'skeleton_'+ platform.to_s.downcase), name # Copying base steps file with localization template('base_steps', File.join(name, 'features', 'step_definitions', 'base_steps.rb')) # Copying android screen base file with localization template('android_screen_base', File.join(name, 'features', 'android', 'android_screen_base.rb')) # Copying ios screen base file with localization template('ios_screen_base', File.join(name, 'features', 'ios', 'ios_screen_base.rb')) else I18n.config.default_locale = options[:lang] # Thor will be responsible to look for identical # files and possibles conflicts directory File.join(File.dirname(__FILE__), '..', 'lib', 'skeleton_'+ platform.to_s.downcase), name # Copying base steps file with localization template('appium_base_steps', File.join(name, 'features', 'step_definitions', 'base_steps.rb')) # Copying screen base file with localization template('appium_base_screen', File.join(name, 'features', 'base_screen', 'base_screen.rb')) end end
version()
click to toggle source
# File lib/sunomono.rb, line 278 def version puts "Sunomono Version #{Sunomono::VERSION}" end