Method: Turbot::Command::Bots#push
- Defined in:
- lib/turbot/command/bots.rb
#push ⇒ Object
bots:push
Push the bot's code to Turbot. Must be run from a bot directory containing a manifest.json
file.
-y, --yes # skip confirmation
Example:
$ turbot bots:push
This will submit your bot and its data for review.
Are you happy your bot produces valid data (e.g. with turbot bots:validate
)? [Y/n]
Your bot has been pushed to Turbot and will be reviewed for inclusion as soon as we can. THANK YOU!
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 197 198 199 200 |
# File 'lib/turbot/command/bots.rb', line 171 def push validate_arguments! error_if_no_local_bot_found unless [:yes] puts 'This will submit your bot and its data for review.' puts 'Are you happy your bot produces valid data (e.g. with `turbot bots:validate`)? [Y/n]' answer = ask unless ['', 'y'].include?(answer.downcase.strip) error 'Aborted.' end end # TODO Validate the manifest.json file. manifest = parse_manifest tempfile = Tempfile.new(bot) tempfile.close # Windows will raise Errno::EACCES on Zip::File.open below archive_path = "#{tempfile.path}.zip" create_zip_archive(archive_path, manifest['files'] + ['manifest.json']) response = File.open(archive_path) do |f| api.update_code(bot, f) end if response.is_a?(Turbot::API::SuccessResponse) puts 'Your bot has been pushed to Turbot and will be reviewed for inclusion as soon as we can. THANK YOU!' else (response) end end |