Drop YAML completely
[amazing.git] / lib / amazing / cli.rb
blob00e60dff22f60b85a377a1cf132eb3b39ecb23b8
1 # Copyright 2008 Dag Odenhall <dag.odenhall@gmail.com>
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 #    http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
15 require 'amazing'
16 require 'amazing/cli/commands'
17 require 'amazing/cli/helpers'
18 require 'amazing/cli/initializers'
19 require 'fileutils'
20 require 'logger'
21 require 'thread'
22 require 'timeout'
24 module Amazing
26   # Command line interface runner
27   #
28   #   CLI.new(ARGV).run
29   class CLI
30     include Initializers
31     include Helpers
32     include Commands
34     def initialize(args=ARGV)
35       @args = args
36       initialize_threads
37       initialize_encoding
38       initialize_logger
39       initialize_options
40       initialize_display
41       initialize_awesome
42       initialize_exit
43     end
45     def run
46       parse_options
47       cmd_show_help
48       cmd_scaffold
49       set_loglevel
50       cmd_stop_process
51       load_scripts
52       cmd_list_widgets
53       cmd_test_widget
54       parse_config
55       wait_for_sockets
56       cmd_explicit_updates
57       stop_process
58       save_pid
59       set_traps
60       update_non_interval
61       cmd_main
62       join_threads
63     end
64   end
65 end