Class: AmsLayout::Generate

Inherits:
Thor
  • Object
show all
Defined in:
lib/ams_layout/cli/generate.rb

Instance Method Summary collapse

Instance Method Details

#all(path) ⇒ Object



105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/ams_layout/cli/generate.rb', line 105

def all(path)
  env = AmsLayout.configuration.default_environment
  env = options[:env] if options[:env]
  user, pass = credentials env

  # Generate layout file
  client.(user, pass)
  client.write_layout path, false
  client.logout

  # Generate layout class
  if options[:name]
    client.layout_class_name = options[:name]
  end

  client.write_layout_class path, path

  # Generate delegate class
  if options[:delegate]
    client.delegate_class_name = options[:delegate]
  end

  client.write_delegate_class path, path
end

#cls(path, layout_path) ⇒ Object



53
54
55
56
57
58
59
# File 'lib/ams_layout/cli/generate.rb', line 53

def cls(path, layout_path)
  if options[:name]
    client.layout_class_name = options[:name]
  end

  client.write_layout_class path, layout_path
end

#delegate(path, layout_path) ⇒ Object



78
79
80
81
82
83
84
# File 'lib/ams_layout/cli/generate.rb', line 78

def delegate(path, layout_path)
  if options[:delegate]
    client.delegate_class_name = options[:delegate]
  end

  client.write_delegate_class path, layout_path
end

#layout(path) ⇒ Object



26
27
28
29
30
31
32
33
34
# File 'lib/ams_layout/cli/generate.rb', line 26

def layout(path)
  env = AmsLayout.configuration.default_environment
  env = options[:env] if options[:env]
  user, pass = credentials env

  client.(user, pass)
  client.write_layout path, false
  client.logout
end