Class: RocketApi::RocketCommands

Inherits:
Object
  • Object
show all
Extended by:
Commands::Dirs, Commands::Files, Commands::GemsDir, Library::GemRepoPlainText
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

init_gems_main_file!, init_gems_version!, init_gemspec!

Methods included from Library::GemRepoPlainText

gitignore_text, plain_gemspec_text, plain_version_text

Class Method Details

.init_bin!(name) ⇒ Object



37
38
39
40
41
42
43
44
# File 'lib/rocket_api/rocket_commands.rb', line 37

def self.init_bin!(name)
  dir_name = "bin/#{name}"
  create_single_file(
    dir_name,
    "",
    exe: true
  )
end

.init_gem_dirObject



14
15
16
17
18
19
# File 'lib/rocket_api/rocket_commands.rb', line 14

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

.init_gem_files(project_name) ⇒ Object

Parameters:

  • project_name (String)

Raises:



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/rocket_api/rocket_commands.rb', line 24

def self.init_gem_files(project_name)
  raise RocketApi::EMPTY_NAME if project_name.nil?

  init_bin!(project_name)
  init_gemspec!(project_name)
  init_gems_main_file!(project_name)
  init_gems_version!(project_name)
  init_gitignore!
rescue StandardError => e
  raise RocketApi::InitFilesError,
        "#{RocketApi::INIT_FAIL} #{e.message}"
end

.init_gitignore!Object



46
47
48
49
50
51
52
# File 'lib/rocket_api/rocket_commands.rb', line 46

def self.init_gitignore!
  file_name = ".gitignore"
  create_single_file(
    file_name,
    gitignore_text
  )
end