Sha256: 6d6393c7825f6673120259cf289ba5201d7e7019cedd3b6b5d1a20e052186066
Contents?: true
Size: 1.45 KB
Versions: 4
Compression:
Stored size: 1.45 KB
Contents
# frozen_string_literal: true require 'active_support/core_ext/string/inflections' module GoNative module Plugins module IOS class Create extend DSL::Serviceable TEMPLATE_DIRECTORY_PATH = File.expand_path(File.join(__dir__, '../../../..', 'templates', 'plugins', 'ios')) COMMON_TEMPLATES_PATH = File.join(TEMPLATE_DIRECTORY_PATH, 'common') LANGUAGES = %w[objc swift].freeze attr_reader :plugin_name, :language def initialize(plugin_name, language) @plugin_name = plugin_name @language = language end def call assert_not_exists! set_working_dir! cp_template_files! Utils::TemplateInflator.new(plugin_name: plugin_name).call chmod_frameworks_script! end def assert_not_exists! return unless File.directory?(plugin_name) raise Error, "Directory #{plugin_name} already exists" end def set_working_dir! FileUtils.mkdir(plugin_name) FileUtils.cd(plugin_name) end def cp_template_files! FileUtils.cp_r("#{COMMON_TEMPLATES_PATH}/.", '.') system('ditto', File.join(TEMPLATE_DIRECTORY_PATH, 'language-specific', language), '.') end def repo_name plugin_name.underscore.dasherize.prepend 'ios-' end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems