Module: Shards::Meta
Defined Under Namespace
Classes: List
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #add(text) ⇒ Object
- #custom_yaml ⇒ Object
- #default_yaml ⇒ Object
- #get_config(class_name) ⇒ Object
- #method_list(class_name) ⇒ Object
- #output ⇒ Object
- #print_output ⇒ Object
- #proxy ⇒ Object
- #proxy_user ⇒ Object
- #reset_output ⇒ Object
- #run(var) ⇒ Object
- #ssh_conn ⇒ Object
- #test_env? ⇒ Boolean
- #write_extra_config_dirs(stage) ⇒ Object
- #yaml_file ⇒ Object
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
7 8 9 |
# File 'lib/shards/meta/meta.rb', line 7 def config @config end |
Instance Method Details
#add(text) ⇒ Object
29 30 31 |
# File 'lib/shards/meta/meta.rb', line 29 def add text @output << text end |
#custom_yaml ⇒ Object
25 26 27 |
# File 'lib/shards/meta/meta.rb', line 25 def custom_yaml YAML.load_file ENV['FORMAT_METHODS_FILE'] end |
#default_yaml ⇒ Object
21 22 23 |
# File 'lib/shards/meta/meta.rb', line 21 def default_yaml YAML.load_file File.join(Shards::LIB_PATH,'settings','format_methods.yaml') end |
#get_config(class_name) ⇒ Object
9 10 11 |
# File 'lib/shards/meta/meta.rb', line 9 def get_config class_name yaml_file[class_name] end |
#method_list(class_name) ⇒ Object
50 51 52 |
# File 'lib/shards/meta/meta.rb', line 50 def method_list class_name get_config(class_name).keys end |
#output ⇒ Object
33 34 35 |
# File 'lib/shards/meta/meta.rb', line 33 def output @output.join("\n") end |
#print_output ⇒ Object
37 38 39 40 |
# File 'lib/shards/meta/meta.rb', line 37 def print_output puts output unless test_env? reset_output end |
#proxy ⇒ Object
60 61 62 |
# File 'lib/shards/meta/meta.rb', line 60 def proxy stage.get 'proxy' end |
#proxy_user ⇒ Object
64 65 66 |
# File 'lib/shards/meta/meta.rb', line 64 def proxy_user ENV['PROXY_USER'] end |
#reset_output ⇒ Object
42 43 44 |
# File 'lib/shards/meta/meta.rb', line 42 def reset_output @output=[' '] end |
#run(var) ⇒ Object
13 14 15 |
# File 'lib/shards/meta/meta.rb', line 13 def run var eval( config[var.to_s] ) end |
#ssh_conn ⇒ Object
54 55 56 57 58 |
# File 'lib/shards/meta/meta.rb', line 54 def ssh_conn Net::SSH.start(proxy, proxy_user) do |ssh| yield ssh end end |
#test_env? ⇒ Boolean
46 47 48 |
# File 'lib/shards/meta/meta.rb', line 46 def test_env? ENV['TEST'] || false end |
#write_extra_config_dirs(stage) ⇒ Object
68 69 70 71 72 |
# File 'lib/shards/meta/meta.rb', line 68 def write_extra_config_dirs stage unless stage.get('extra_config_dirs').empty? copy_file_to_extra_dirs(stage.get('extra_config_dirs')) end end |
#yaml_file ⇒ Object
17 18 19 |
# File 'lib/shards/meta/meta.rb', line 17 def yaml_file ENV['FORMAT_METHODS_FILE'].nil? ? default_yaml : default_yaml.merge(custom_yaml) end |