Method: GoodData::Project#clone

Defined in:
lib/gooddata/models/project.rb

#clone(options = {}) ⇒ GoodData::Project

Clones project

Parameters:

  • options (Hash) (defaults to: {})

    Export options

Options Hash (options):

  • :data (Boolean)

    Clone project with data

  • :users (Boolean)

    Clone project with users

  • :exclude_schedules (Boolean)

    Specifies whether to include scheduled emails

Returns:


880
881
882
883
884
885
886
887
888
889
890
891
892
893
# File 'lib/gooddata/models/project.rb', line 880

def clone(options = {})
  a_title = options[:title] || "Clone of #{title}"

  begin
    # Create the project first so we know that it is passing.
    # What most likely is wrong is the token and the export actaully takes majority of the time
    new_project = GoodData::Project.create(options.merge(:title => a_title, :client => client, :driver => content[:driver]))
    export_token = export_clone(options)
    new_project.import_clone(export_token)
  rescue
    new_project.delete if new_project
    raise
  end
end