turbot 0.0.21 → 0.0.22
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/turbot/auth.rb +1 -1
- data/lib/turbot/command/bots.rb +9 -17
- data/lib/turbot/command/status.rb +1 -2
- data/lib/turbot/version.rb +1 -1
- metadata +1 -1
data/lib/turbot/auth.rb
CHANGED
data/lib/turbot/command/bots.rb
CHANGED
@@ -92,14 +92,12 @@ class Turbot::Command::Bots < Turbot::Command::Base
|
|
92
92
|
# Created new bot template at my_amazing_bot!
|
93
93
|
|
94
94
|
def generate
|
95
|
-
puts "running generate"
|
96
95
|
response = api.show_bot(bot)
|
97
96
|
if response.is_a? Turbot::API::SuccessResponse
|
98
97
|
error("There's already a bot called #{bot}")
|
99
98
|
end
|
100
99
|
validate_arguments!
|
101
100
|
language = options[:language] || "ruby"
|
102
|
-
puts "Generating #{language} code..."
|
103
101
|
manifest_template = File.expand_path("../../../../templates/manifest.json", __FILE__)
|
104
102
|
scraper_template = File.expand_path("../../../../templates/#{language}", __FILE__)
|
105
103
|
license_template = File.expand_path("../../../../templates/LICENSE.txt", __FILE__)
|
@@ -149,7 +147,7 @@ class Turbot::Command::Bots < Turbot::Command::Base
|
|
149
147
|
# Push bot code to the turbot server. Must be run from a local bot checkout.
|
150
148
|
#
|
151
149
|
# $ turbot bots:push
|
152
|
-
#
|
150
|
+
# Your bot has been pushed to Turbot and will be reviewed for inclusion as soon as we can. THANKYOU!
|
153
151
|
|
154
152
|
def push
|
155
153
|
validate_arguments!
|
@@ -169,6 +167,7 @@ class Turbot::Command::Bots < Turbot::Command::Base
|
|
169
167
|
File.open(archive_path) do |file|
|
170
168
|
api.update_code(bot, file)
|
171
169
|
end
|
170
|
+
puts "Your bot has been pushed to Turbot and will be reviewed for inclusion as soon as we can. THANKYOU!"
|
172
171
|
end
|
173
172
|
|
174
173
|
alias_command "push", "bots:push"
|
@@ -180,7 +179,7 @@ class Turbot::Command::Bots < Turbot::Command::Base
|
|
180
179
|
# $ heroku bots:validate
|
181
180
|
# Validating example... done
|
182
181
|
|
183
|
-
def validate
|
182
|
+
def validate(opts={})
|
184
183
|
scraper_path = shift_argument || scraper_file(Dir.pwd)
|
185
184
|
validate_arguments!
|
186
185
|
config = parsed_manifest(Dir.pwd)
|
@@ -208,14 +207,14 @@ class Turbot::Command::Bots < Turbot::Command::Base
|
|
208
207
|
if !errors.empty?
|
209
208
|
error("LINE WITH ERROR: #{line}\n\nERRORS: #{errors}")
|
210
209
|
end
|
211
|
-
|
210
|
+
puts line if opts[:dump]
|
212
211
|
if JSON.parse(line).slice(*config['identifying_fields']).blank?
|
213
212
|
error("LINE WITH ERROR: #{line}\n\nERRORS: No value provided for identifying fields")
|
214
213
|
end
|
215
214
|
|
216
215
|
count += 1
|
217
216
|
end
|
218
|
-
puts "Validated #{count} records successfully!"
|
217
|
+
puts "Validated #{count} records successfully!" if !opts[:dump]
|
219
218
|
end
|
220
219
|
|
221
220
|
# bots:dump
|
@@ -227,14 +226,7 @@ class Turbot::Command::Bots < Turbot::Command::Base
|
|
227
226
|
# {'foo2': 'bar2'}
|
228
227
|
|
229
228
|
def dump
|
230
|
-
|
231
|
-
scraper_path = shift_argument || scraper_file(Dir.pwd)
|
232
|
-
validate_arguments!
|
233
|
-
count = 0
|
234
|
-
run_scraper_each_line("#{scraper_path} #{bot}") do |line|
|
235
|
-
puts line
|
236
|
-
count += 1
|
237
|
-
end
|
229
|
+
validate(:dump => true)
|
238
230
|
end
|
239
231
|
|
240
232
|
# bots:single
|
@@ -263,9 +255,9 @@ class Turbot::Command::Bots < Turbot::Command::Base
|
|
263
255
|
|
264
256
|
# bots:preview
|
265
257
|
#
|
266
|
-
# Send bot data to
|
258
|
+
# Send bot data to Turbot for remote previewing / sharing
|
267
259
|
#
|
268
|
-
# Sending example to
|
260
|
+
# Sending example to turbot... done
|
269
261
|
def preview
|
270
262
|
scraper_path = shift_argument || scraper_file(Dir.pwd)
|
271
263
|
validate_arguments!
|
@@ -273,7 +265,7 @@ class Turbot::Command::Bots < Turbot::Command::Base
|
|
273
265
|
batch = []
|
274
266
|
count = 0
|
275
267
|
config = parsed_manifest(Dir.pwd)
|
276
|
-
puts "Sending to
|
268
|
+
puts "Sending to turbot... "
|
277
269
|
|
278
270
|
api.destroy_draft_data(bot)
|
279
271
|
|
@@ -18,9 +18,8 @@ class Turbot::Command::Status < Turbot::Command::Base
|
|
18
18
|
def index
|
19
19
|
validate_arguments!
|
20
20
|
|
21
|
-
turbot_status_host = ENV['TURBOT_STATUS_HOST'] || "status.turbot.com"
|
22
21
|
require('excon')
|
23
|
-
status = json_decode(Excon.get("
|
22
|
+
status = json_decode(Excon.get("http://turbot.opencorporates.com/current-status.json", :nonblock => false).body)
|
24
23
|
|
25
24
|
styled_header("Turbot Status")
|
26
25
|
|
data/lib/turbot/version.rb
CHANGED