class Miyano::Push

Public Instance Methods

build_everytime() click to toggle source
# File lib/miyano/cli/push.rb, line 33
def build_everytime
  CLI.new.build
end
check_if_first() click to toggle source
# File lib/miyano/cli/push.rb, line 13
def check_if_first
  unless Dir.exist? File.join @dir, ".git"
    FileUtils.mkdir_p @dir
    FileUtils.cd @dir do
      p "Enter the url of your Github Pages repo"
      p "(eg: https://github.com/username/username.github.io)"
      p "WARN: It will delete all files already in the repo"
      print "repo url:";repo = STDIN.gets.chomp
      `git init`
      `git remote add origin #{repo}`
      `git pull origin master`
      files = Dir["*"]
      files.delete "CNAME"
      files.each do |f|
        FileUtils.rm_rf f
      end
    end
  end
end
check_root() click to toggle source
# File lib/miyano/cli/push.rb, line 7
def check_root
  unless Dir.exist?("post") and Dir.exist?("layout")
     fail "!!wrong dirctory"
  end
end
configs() click to toggle source
# File lib/miyano/cli/push.rb, line 3
def configs
  @dir = "_site".freeze
end
push() click to toggle source
# File lib/miyano/cli/push.rb, line 37
def push
  FileUtils.cd @dir do
    `git add .`
    `git commit -m "site updated at #{Time.now}"`
    `git push -u origin master`
  end
end