Class: Shards::Site
Instance Attribute Summary collapse
#internal_host, #stage, #yaml
Attributes inherited from Base
#subdomain_param
Attributes included from Meta
#config
Instance Method Summary
collapse
#command_to_read_remote, #command_to_remote, #copy_file_to_extra_dirs, #dir, #file, #file_path, #fingerprint_command, #fingerprints, #initialize, #local_fingerprint, #proxy_read_remote_file, #remote_file, #remote_fingerprint, #same_fingerprint?, #ssh!, #target_config_dir
Methods inherited from Base
#default_region, method_list, #set_config
Methods included from Meta
#add, #custom_yaml, #default_yaml, #get_config, #method_list, #output, #print_output, #proxy, #proxy_user, #reset_output, #run, #ssh_conn, #test_env?, #write_extra_config_dirs, #yaml_file
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
7
8
9
|
# File 'lib/shards/site.rb', line 7
def client
@client
end
|
#shard ⇒ Object
Returns the value of attribute shard.
7
8
9
|
# File 'lib/shards/site.rb', line 7
def shard
@shard
end
|
Instance Method Details
#add_site(dryrun: false) ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/shards/site.rb', line 13
def add_site dryrun: false
add_data
if dryrun
add_site_message
else
write_yaml
end
end
|
#delete ⇒ Object
45
46
47
48
49
50
51
52
|
# File 'lib/shards/site.rb', line 45
def delete
site_to_delete = select_by_domain
raise "there are more than one site with this domain" if site_to_delete.count > 1
raise "there are not a site with this domain" if site_to_delete.count < 1
@shard=site_to_delete.first['shard']
@yaml=reject_by_domain
write_yaml
end
|
#domain_param ⇒ Object
25
26
27
|
# File 'lib/shards/site.rb', line 25
def domain_param
subdomain_param || domain
end
|
#exist? ⇒ Boolean
29
30
31
|
# File 'lib/shards/site.rb', line 29
def exist?
!select_by_domain.empty?
end
|
#reject_by_domain ⇒ Object
37
38
39
|
# File 'lib/shards/site.rb', line 37
def reject_by_domain
yaml.reject { |x| x['domain']==domain_param }
end
|
#select_by_domain ⇒ Object
33
34
35
|
# File 'lib/shards/site.rb', line 33
def select_by_domain
yaml.select { |x| x['domain']==domain_param }
end
|
#select_by_shard ⇒ Object
41
42
43
|
# File 'lib/shards/site.rb', line 41
def select_by_shard
yaml.select { |x| x['shard']==shard }
end
|
#write_yaml ⇒ Object
54
55
56
57
|
# File 'lib/shards/site.rb', line 54
def write_yaml
super
stage
end
|