Class: Deano::NameCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/deano/commands/name_command.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

#app_path, #cmd, command, commands, #rm, #rm_r, #template_path

Constructor Details

#initialize(args) ⇒ NameCommand

Returns a new instance of NameCommand.



18
19
20
21
22
# File 'lib/deano/commands/name_command.rb', line 18

def initialize(args)
  self.args = args
  self.name = ARGV[1]
  @app_dir = File.expand_path(FileUtils.pwd)
end

Instance Attribute Details

#argsObject

Returns the value of attribute args.



4
5
6
# File 'lib/deano/commands/name_command.rb', line 4

def args
  @args
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/deano/commands/name_command.rb', line 4

def name
  @name
end

Class Method Details

.inherited(klass) ⇒ Object



6
7
8
# File 'lib/deano/commands/name_command.rb', line 6

def self.inherited(klass)
  Command.inherited(klass)
end

Instance Method Details

#classifiedObject



14
15
16
# File 'lib/deano/commands/name_command.rb', line 14

def classified
  self.name.classify
end

#clean_string(f) ⇒ Object



24
25
26
# File 'lib/deano/commands/name_command.rb', line 24

def clean_string(f)
  f.gsub(Deano.template_dir, @app_dir).gsub("template_app", self.underscored).gsub("TemplateApp", self.classified)
end

#underscoredObject



10
11
12
# File 'lib/deano/commands/name_command.rb', line 10

def underscored
  self.name.underscore
end