Class: Ayadn::Set

Inherits:
Thor show all
Defined in:
lib/ayadn/set.rb

Instance Method Summary collapse

Instance Method Details

#api(*args) ⇒ Object



197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# File 'lib/ayadn/set.rb', line 197

def api(*args)
  if args[0]
    begin
      SetAPI.new.setURL(args[0])
    rescue NoMethodError, ArgumentError => e
      Status.new.error_missing_parameters
      exit
    rescue => e
      raise e
    end
  else
    Status.new.error_missing_parameters
    exit
  end
end

#backup(*args) ⇒ Object



151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# File 'lib/ayadn/set.rb', line 151

def backup(*args)
  backup_config = SetBackup.new
  if args[0]
    begin
      backup_config.send(args[0], args[1])
    rescue NoMethodError, ArgumentError
      Status.new.error_missing_parameters
      exit
    rescue => e
      raise e
    end
  else
    Status.new.error_missing_parameters
    exit
  end
  backup_config.save
end

#blacklist(*args) ⇒ Object



44
45
46
47
48
49
50
51
52
53
# File 'lib/ayadn/set.rb', line 44

def blacklist(*args)
  blacklist_config = SetBlacklist.new
  unless args.length != 2
    blacklist_config.send(args[0], args[1])
  else
    Status.new.error_missing_parameters
    exit
  end
  blacklist_config.save
end

#channels(*args) ⇒ Object



32
33
34
35
36
37
38
39
40
41
# File 'lib/ayadn/set.rb', line 32

def channels(*args)
  channels_config = SetChannels.new
  unless args.length != 2
    channels_config.send(args[0], args[1])
  else
    Status.new.error_missing_parameters
    exit
  end
  channels_config.save
end

#color(*args) ⇒ Object



131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# File 'lib/ayadn/set.rb', line 131

def color(*args)
  color_config = SetColor.new
  if args[0]
    begin
      color_config.send(args[0], args[1])
    rescue NoMethodError, ArgumentError
      Status.new.error_missing_parameters
      exit
    rescue => e
      raise e
    end
  else
    Status.new.error_missing_parameters
    exit
  end
  color_config.save
end

#count(*args) ⇒ Object



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/ayadn/set.rb', line 91

def count(*args)
  counts_config = SetCounts.new
  if args[0]
    begin
      counts_config.send(args[0], args[1])
    rescue NoMethodError, ArgumentError
      Status.new.error_missing_parameters
      exit
    rescue => e
      raise e
    end
  else
    Status.new.error_missing_parameters
    exit
  end
  counts_config.save
end

#defaultsObject



171
172
173
174
# File 'lib/ayadn/set.rb', line 171

def defaults
  Settings.restore_defaults
  Status.new.done
end

#editObject



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/ayadn/set.rb', line 110

def edit
  Settings.load_config()
  sets = Settings.config.paths.config + "/config.yml"
  if sets.blank?
    Status.new.not_authorized
    exit
  end
  ed = `echo $EDITOR`
  if ed.blank?
    Status.new.info "No predefined EDITOR, opening in VIM"
    `vim #{sets}`
    exit
  end
  `$EDITOR #{sets}`
end

#formats(*args) ⇒ Object



177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# File 'lib/ayadn/set.rb', line 177

def formats(*args)
  formats_config = SetFormats.new
  if args[0]
    begin
      command = args.shift
      formats_config.send(command, args)
    rescue NoMethodError, ArgumentError
      Status.new.error_missing_parameters
      exit
    rescue => e
      raise e
    end
  else
    Status.new.error_missing_parameters
    exit
  end
  formats_config.save
end

#marker(*args) ⇒ Object



19
20
21
22
23
24
25
26
27
28
# File 'lib/ayadn/set.rb', line 19

def marker(*args)
  marker_config = SetMarker.new
  unless args.length != 2
    marker_config.send(args[0], args[1])
  else
    Status.new.error_missing_parameters
    exit
  end
  marker_config.save
end

#nicerank(*args) ⇒ Object



57
58
59
60
61
62
63
64
65
66
# File 'lib/ayadn/set.rb', line 57

def nicerank *args
  nicerank_config = SetNiceRank.new
  if args[0]
    nicerank_config.send(args[0], args[1])
  else
    Status.new.error_missing_parameters
    exit
  end
  nicerank_config.save
end

#scroll(*args) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/ayadn/set.rb', line 6

def scroll(*args)
  scroll_config = SetScroll.new
  if args[0]
    scroll_config.send(args[0], args[1])
  else
    Status.new.error_missing_parameters
    exit
  end
  scroll_config.save
end

#timeline(*args) ⇒ Object



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/ayadn/set.rb', line 70

def timeline(*args)
  timeline_config = SetTimeline.new
  if args[0]
    begin
      timeline_config.send(args[0], args[1])
    rescue NoMethodError, ArgumentError
      Status.new.error_missing_parameters
      exit
    rescue => e
      raise e
    end
  else
    Status.new.error_missing_parameters
    exit
  end
  timeline_config.save
end