Class: Ajimi::Client
- Inherits:
-
Thor
- Object
- Thor
- Ajimi::Client
- Defined in:
- lib/ajimi/client.rb
Instance Attribute Summary collapse
-
#checker ⇒ Object
Returns the value of attribute checker.
-
#reporter ⇒ Object
Returns the value of attribute reporter.
Instance Method Summary collapse
- #check ⇒ Object
- #dir(path) ⇒ Object
- #exec(server, command) ⇒ Object
- #file(path) ⇒ Object
-
#initialize(*args) ⇒ Client
constructor
A new instance of Client.
Constructor Details
Instance Attribute Details
#checker ⇒ Object
Returns the value of attribute checker.
5 6 7 |
# File 'lib/ajimi/client.rb', line 5 def checker @checker end |
#reporter ⇒ Object
Returns the value of attribute reporter.
5 6 7 |
# File 'lib/ajimi/client.rb', line 5 def reporter @reporter end |
Instance Method Details
#check ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/ajimi/client.rb', line 22 def check @config.merge!( { find_max_depth: [:find_max_depth], enable_check_contents: [:enable_check_contents], limit_check_contents: [:limit_check_contents] } ) @config[:check_root_path] = [:check_root_path] if [:check_root_path] _check end |
#dir(path) ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/ajimi/client.rb', line 35 def dir(path) @config.merge!( { check_root_path: path, find_max_depth: [:find_max_depth], enable_check_contents: false } ) @config[:ignored_paths] << Regexp.new([:ignored_pattern]) if [:ignored_pattern] _check end |
#exec(server, command) ⇒ Object
59 60 61 62 63 64 65 66 67 |
# File 'lib/ajimi/client.rb', line 59 def exec(server, command) raise ArgumentError, "server option must be source or target" unless %w(source target).include? server @server = @config[server.to_sym] puts "Execute command at #{server}_host: #{@server.host}\n" stdout = @server.command_exec(command) puts "#{stdout}" puts "\n" end |
#file(path) ⇒ Object
48 49 50 51 52 53 54 55 56 |
# File 'lib/ajimi/client.rb', line 48 def file(path) @config.merge!( { check_root_path: path, enable_check_contents: true } ) @config[:ignored_contents].merge!( { path => Regexp.new([:ignored_pattern]) } ) if [:ignored_pattern] _check end |