Class: Ale::CLI

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/ale/cli.rb

Instance Method Summary collapse

Instance Method Details

#buildObject



12
13
14
15
16
17
18
# File 'lib/ale/cli.rb', line 12

def build
  opts = options.dup

  say("Building site in #{Ale.root}")
rescue AlefileNotFound
  say('Count not locale Alefile', :red)
end

#cleanObject



21
22
23
# File 'lib/ale/cli.rb', line 21

def clean
  say('Cleaning up')
end

#initObject



26
27
28
29
30
31
32
33
# File 'lib/ale/cli.rb', line 26

def init
  if File.exist?('Alefile')
    say("Alefile already exists at #{Dir.pwd}/Alefile", :red)
  else
    say("Writing new Alefile to #{Dir.pwd}/Alefile")
    FileUtils.cp(File.expand_path('../../templates/Alefile', __FILE__), 'Alefile')
  end
end

#setupObject



36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/ale/cli.rb', line 36

def setup
  opts = options.dup
  
  Ale.alefile = opts[:alefile]    
  Ale::Config.load(Ale.alefile)
  
  say("Setting up website for bucket: #{Ale::Config.bucket}")
  uploader.setup!
rescue AlefileNotFound
  say('Count not locale Alefile', :red)
rescue BucketNotSpecified
  say('No bucket specificed in Alefile', :red)
end

#uploadObject



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/ale/cli.rb', line 53

def upload
  opts = options.dup
  
  Ale.alefile = opts[:alefile]    
  Ale::Config.load(Ale.alefile)
  
  say("Uploading site in #{uploader.site.directory}")
  uploader.upload!
rescue AlefileNotFound
  say('Count not locale Alefile', :red)
rescue BucketNotFound
  say('Bucket not found on S3', :red)
rescue BucketNotSpecified
  say('No bucket specificed in Alefile', :red)
end