Class: RocketApi::RocketCommands

Inherits:
Object
  • Object
show all
Extended by:
Commands::Dirs, Commands::Files, Commands::GemsDir, Commands::Helper, Library::GemRepoPlainText, Library::HelperPlainText
Defined in:
lib/rocket_api/rocket_commands.rb

Class Method Summary collapse

Methods included from Commands::Files

class_name_camel, create_single_file, is_exist?

Methods included from Commands::Dirs

create_dir, create_repo

Methods included from Commands::GemsDir

gem_test!, gems_main_file!, gems_version!, gemspec!, rubocop_yml!

Methods included from Commands::Helper

bin!, gem_file!, gitignore!, rake_file!

Methods included from Library::GemRepoPlainText

gemfile_text, gitignore_text, plain_gem_test_version_text, plain_gemspec_text, plain_rubocop_yml_text, plain_version_text

Methods included from Library::HelperPlainText

rake_text

Class Method Details

.init_gem_dir(**_options) ⇒ Object

Parameters:

  • options (Hah)

Raises:



20
21
22
23
24
25
26
27
# File 'lib/rocket_api/rocket_commands.rb', line 20

def self.init_gem_dir(**_options)
  raise GEM_DETECTED unless Dir.glob("*.gemspec").empty?

  create_repo(RocketApi::GEM_PROJECTS_DIR)
rescue StandardError => e
  raise RocketApi::CreateDirError,
        "#{RocketApi::CREATE_FAILED} #{e.message}"
end

.init_gem_files(**options) ⇒ Object

Parameters:

  • options (Hash)

Raises:



32
33
34
35
36
37
38
39
40
# File 'lib/rocket_api/rocket_commands.rb', line 32

def self.init_gem_files(**options)
  raise RocketApi::EMPTY_NAME if options[:project_name].nil?

  project_name = options[:project_name]
  RocketApi::GEM_COMMANDS.each { |command| send(command, project_name) }
rescue StandardError => e
  raise RocketApi::InitFilesError,
        "#{RocketApi::INIT_FAIL} #{e.message}"
end