Class: Ayadn::Set

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

Instance Method Summary collapse

Instance Method Details

#api(*args) ⇒ Object



223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
# File 'lib/ayadn/set.rb', line 223

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



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

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



70
71
72
73
74
75
76
77
78
79
# File 'lib/ayadn/set.rb', line 70

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



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

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



157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# File 'lib/ayadn/set.rb', line 157

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



117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/ayadn/set.rb', line 117

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



197
198
199
200
# File 'lib/ayadn/set.rb', line 197

def defaults
  Settings.restore_defaults
  Status.new.done
end

#editObject



136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/ayadn/set.rb', line 136

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



203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
# File 'lib/ayadn/set.rb', line 203

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



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

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

#movie(*args) ⇒ Object



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

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

#nicerank(*args) ⇒ Object



83
84
85
86
87
88
89
90
91
92
# File 'lib/ayadn/set.rb', line 83

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



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/ayadn/set.rb', line 96

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

#tvshow(*args) ⇒ Object



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

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