Module: Ecic::LibraryCreationHelper

Included in:
FileAdder, Generate
Defined in:
lib/ecic/helpers/library_creation_helper.rb

Instance Method Summary collapse

Instance Method Details

#create_library_if_missing(library) ⇒ Object



3
4
5
6
7
8
# File 'lib/ecic/helpers/library_creation_helper.rb', line 3

def create_library_if_missing(library)
  unless library.already_exists?
    return ok_to_create_library? library
  end
  return true
end

#generate_library(library) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/ecic/helpers/library_creation_helper.rb', line 19

def generate_library(library)
  if library.is_valid?
    generator = Ecic::LibraryGenerator.new
    generator.destination_root = library.project.root
    generator.library = library
    generator.invoke_all
    library.create
  else
    return false
  end
end

#ok_to_create_library?(library) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
13
14
15
16
17
# File 'lib/ecic/helpers/library_creation_helper.rb', line 10

def ok_to_create_library?(library)
  if must_create_new_library? library
    return generate_library library
  end
#    shell.error set_color("Operation aborted!",Thor::Shell::Color::RED)
#    exit(2)
  return false
end