Class: CreateRubyApp::App

Inherits:
Object
  • Object
show all
Defined in:
lib/create_ruby_app/app.rb

Constant Summary collapse

RUBY_VERSION =
"ruby-2.6.2"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name: "app", gems: [], version: RUBY_VERSION, logger: Logger.new(STDOUT)) ⇒ App

Returns a new instance of App.



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/create_ruby_app/app.rb', line 7

def initialize(
  name: "app",
  gems: [],
  version: RUBY_VERSION,
  logger: Logger.new(STDOUT)
)
  @name = name
  @gems = gems
  @version = version
  @logger = logger
end

Instance Attribute Details

#gemsObject (readonly)

Returns the value of attribute gems.



31
32
33
# File 'lib/create_ruby_app/app.rb', line 31

def gems
  @gems
end

#loggerObject (readonly)

Returns the value of attribute logger.



31
32
33
# File 'lib/create_ruby_app/app.rb', line 31

def logger
  @logger
end

#nameObject (readonly)

Returns the value of attribute name.



31
32
33
# File 'lib/create_ruby_app/app.rb', line 31

def name
  @name
end

#versionObject (readonly)

Returns the value of attribute version.



31
32
33
# File 'lib/create_ruby_app/app.rb', line 31

def version
  @version
end

Instance Method Details

#classify_nameObject



27
28
29
# File 'lib/create_ruby_app/app.rb', line 27

def classify_name
  name.split("_").collect(&:capitalize).join
end

#run!Object



19
20
21
22
23
24
25
# File 'lib/create_ruby_app/app.rb', line 19

def run!
  with_logger("Creating directories...", Actions::CreateDirectories)
  with_logger("Generating files...", Actions::GenerateFiles)
  with_logger("Making script executable...", Actions::MakeScriptExecutable)
  with_logger("Installing gems...", Actions::InstallGems)
  with_logger("Happy hacking!", Actions::NullAction)
end