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



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/richcss/cli.rb', line 24

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, extension = "css") ⇒ Object

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



15
16
17
18
19
20
21
# File 'lib/richcss/cli.rb', line 15

def init(part, extension="css")
  if (extension.eql?("css") || extension.eql?("scss"))
    Richcss::Generators::PartTemplate.start([part, extension])
  else
    puts "Only support css or scss extension, default is css"
  end
end

#push(part_dir_name = nil) ⇒ Object



41
42
43
44
45
46
# File 'lib/richcss/cli.rb', line 41

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