Class: Homesteading::Update

Inherits:
Object
  • Object
show all
Defined in:
lib/homesteading/commands/update.rb

Class Method Summary collapse

Class Method Details

.client(options = nil) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/homesteading/commands/update.rb', line 9

def client(options=nil)
  puts

  # Parse command line options
  options = {}
  optparse = OptionParser.new do |opts|
    opts.on("-b", "--beta", "Update to the latest beta Homesteading CLI") do |beta|
      options[:beta] = beta
    end
  end
  optparse.parse!

  if options[:beta]
    puts "* Cloning Homesteading from GitHub into /tmp"
    system "cd /tmp && git clone [email protected]:homesteading/homesteading.git"

    puts "* Building homesteading gem from .gemspec"
    system "cd /tmp/homesteading && gem build homesteading.gemspec"

    dot_gem = Dir.glob("/tmp/homesteading/*.gem").last
    version = dot_gem.split("/").last.sub("homesteading-", "").sub(".gem", "")

    puts "* Installing homesteading version #{version}"
    system "gem install #{dot_gem}"

    puts "* Cleaning up"
    system "rm -rf /tmp/homesteading"

    puts "* Homesteading CLI version #{version} successfully installed from GitHub"
  else
    system "gem install homesteading"
  end

  puts
end

.default(options = nil) ⇒ Object



5
6
7
# File 'lib/homesteading/commands/update.rb', line 5

def default(options=nil)
  # update hs apps from github
end