Class: RichcssCLI::Part

Inherits:
Thor
  • Object
show all
Defined in:
lib/richcss/cli.rb

Instance Method Summary collapse

Instance Method Details

#check(part_dir_name = nil) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/richcss/cli.rb', line 20

def check(part_dir_name=nil)
  part_path = "#{Dir.pwd}" + "/" + "#{part_dir_name}" || Dir.pwd
  result = Richcss::Manager.check(part_path)
  Dir.chdir(part_path)
  if !result.nil?
    puts result
    return false
  end

  partPathSplit = part_path.split("/")
  partName = partPathSplit[partPathSplit.length - 1]

  puts "Passed all validation checks, part: #{partName} is ready for upload!"
  return true
end

#init(part) ⇒ Object

part_name |— lib | |— elements | | |— … | |— box | | |— … |— part_name.spec |— README.md



15
16
17
# File 'lib/richcss/cli.rb', line 15

def init(part)
  Richcss::Generators::PartTemplate.start([part])
end

#push(part_dir_name = nil) ⇒ Object



37
38
39
40
41
42
# File 'lib/richcss/cli.rb', line 37

def push(part_dir_name=nil)
  part_path = "#{Dir.pwd}" + "/" + "#{part_dir_name}" || Dir.pwd
  if check(part_dir_name)
    Richcss::Manager.upload(part_path)
  end
end