Class: Mushikago::Mitsubachi::Scripts

Inherits:
Object
  • Object
show all
Defined in:
lib/mushikago/mitsubachi/scripts.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, project_name) ⇒ Scripts

Returns a new instance of Scripts.



8
9
10
11
# File 'lib/mushikago/mitsubachi/scripts.rb', line 8

def initialize client, project_name
  @client = client
  @project_name = project_name
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



5
6
7
# File 'lib/mushikago/mitsubachi/scripts.rb', line 5

def client
  @client
end

#project_nameObject (readonly)

Returns the value of attribute project_name.



6
7
8
# File 'lib/mushikago/mitsubachi/scripts.rb', line 6

def project_name
  @project_name
end

Instance Method Details

#[](script_name) ⇒ Object



13
14
15
# File 'lib/mushikago/mitsubachi/scripts.rb', line 13

def [] script_name
  Mitsubachi::Script.new(client, project_name, script_name)
end

#deploy(script_file, options = {}) ⇒ Object



17
18
19
# File 'lib/mushikago/mitsubachi/scripts.rb', line 17

def deploy script_file, options={}
  client.script_deploy(project_name, script_file, options)
end

#eachObject



25
26
27
# File 'lib/mushikago/mitsubachi/scripts.rb', line 25

def each
  list.each
end

#listObject



21
22
23
# File 'lib/mushikago/mitsubachi/scripts.rb', line 21

def list
  client.script_list(project_name)['scripts'].map{|p| self[p['name']]}
end