Class: Ckancli::Commands::Upload
- Inherits:
-
Ckancli::Command
- Object
- Ckancli::Command
- Ckancli::Commands::Upload
- Defined in:
- lib/ckancli/commands/upload.rb
Instance Method Summary collapse
- #execute(input: $stdin, output: $stdout) ⇒ Object
-
#initialize(options) ⇒ Upload
constructor
A new instance of Upload.
Methods inherited from Ckancli::Command
#command, #cursor, #editor, #exec_exist?, #generator, #pager, #platform, #prompt, #screen, #which
Constructor Details
#initialize(options) ⇒ Upload
Returns a new instance of Upload.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/ckancli/commands/upload.rb', line 20 def initialize() @options = @dir = nil @resources = [] @http_resource = false @schema = nil @resource_config = nil @dataset_config = nil @api_config = nil @logger = nil @ckan_client = nil @update_modified = false @mail_server = nil end |
Instance Method Details
#execute(input: $stdin, output: $stdout) ⇒ Object
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 |
# File 'lib/ckancli/commands/upload.rb', line 36 def execute(input: $stdin, output: $stdout) begin (@options) if !@schema.nil? validate() else puts "" show_info "No schema - skipping validation" end upload() if !@dataset_config.nil? update_dataset() else puts "" show_info "No dataset configuration - skipping update" end @resources.each do |res| if !res[:log_file].nil? res[:log_file].close end end if !@mail_server.nil? && !@mail_receivers.nil? mail_notify() end rescue StandardError => e return_error "Unexpected error", e end end |