Module: ErrorList

Included in:
Errors
Defined in:
lib/errors.rb

Instance Method Summary collapse

Instance Method Details

#errors(error) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
# File 'lib/errors.rb', line 3

def errors(error)
  case error
  when 'rails' #----------------
    puts "\nThere is no Rails project on this server.\n\n"
  when 'scale int' #----------------
    puts "\nError: scale requiers an Integer value.\nUsage: < badger [app#] scale [number_of_workers] >\n\n"
  when 'scale' #----------------
    puts "\nError: did you mean scale?\nUsage: < badger [app#] scale [#] >\n\n"
  when 'app build' #----------------
    puts "\nError: did you mean build?\nUsage: < badger [app#] build >\n\n"
  when 'app usage' #----------------
    puts "\nUsage:\n< badger [app#] scale [#} >\n< badger [app#] build >\n\n"
  when 'name' #----------------
    puts "\nError: name of rails app is required.\nUsage: badger create < name_of_rails_app >\n\n"
  when 'specific name' #----------------
    puts "\nError: name of project cannot be < db > or start with < app >.\n\n"
  when 'db build' #----------------
    puts "\nError: did you mean build?\nUsage: badger db build\n\n"
  when 'plugins' #----------------
    puts "\nError: Plugin already exists.\n\n"
  when 'rails root' #----------------
    puts "\nError: could not locate rails application.\nEnter the root of your rails application and try again.\n\n"
  when 'badger yaml' #----------------
    puts "\nError: badger.yml already exists.\n\n"
  when 'yaml exists' #----------------
    puts "\nError: could not locate badger.yml file.\nA config/badger.yml file is required for server configuration.\n\n"
  when 'environment' #----------------
    puts "\nError: no envirionment specified.\nPlease add an either staging or production to the config/badger.yml file.\n\n"
  when 'generate plugins' #----------------
    puts "\nError: no generate specified.\nBadger does not know what to generate. Did you mean plugins?\n\n"
  when 'generate yaml' #----------------
    puts "\nError: no generate specified.\nBadger does not know what to generate. Did you mean yml?\n\n"
  when 'generate' #----------------
    puts "\nError: no gererate specified.\n< badger generate yml >\n< badger generate plugins >\n\n"
  when 'gemset clear' #----------------
    puts "\nCommand not understood did you mean badger gemset clear?\n\n"
  when 'usage' #----------------
    puts "\nUsage:\n< badger create [project-name] >\n< badger remove [project-name] >\n< badger update [project-name] >\n< badger deploy >\n< badger deploy --with-workers >\n< badger gemset clear >\n< badger generate [generator] >\n< badger rake [rake command] >\n< badger db build >\n< badger app[number] build >\n< badger info >\n< badger logs >\n< badger logs tail >\ng, gen, generate - yml, plugins\n\n"
  when 'rubyracer' #----------------
    puts "\nError: Gemfile is missing therubyracer.\nAdd therubyracter, :platform => :ruby to your Gemfile\nand run bundle update.\n\n"
  when 'mysql2' #----------------
    puts "\nError: Gemfile is missing mysql2 adapter.\nAdd mysql2 to your Gemfile and run bundle update.\n\n"
  when 'unicorn' #----------------
    puts "\nError: Gemfile is missing unicorn.\nAdd unicorn to your Gemfile and run bundle update.\n\n"
  when 'ssh' #----------------
    puts "\nError: no ssh key found.\nGenerate a ssh key via < ssh-keygen -t rsa >.\n\n"
  when 'rails project' #----------------
    puts "\nRails project already exists.\n\n"
  when 'info error' #----------------
    puts "\nNo Rails project found.\n\n"
  when 'update error' #----------------
    puts "\nRails project \#{ARGV[1]} was not found.\n\n"
  when 'local db'
    puts "\nError: cannot deploy app withou local_db set to false.\nPlace local_db: false in your config/badger.yml\n\n"
  end
end