Sha256: 1e3e7ae0d18a3f1a63b9b3c305ea23f53c2fa317e3a472279efcccb8bef784a1

Contents?: true

Size: 1.24 KB

Versions: 3

Compression:

Stored size: 1.24 KB

Contents

require 'xcdm/schema'
require 'xcdm/entity'

if defined?(Motion::Project::Config)

  class Motion::Project::Config
    variable :xcdm

    def xcdm
      @xcdm ||= Struct.new(:name).new(nil)
    end
  end

  if File.directory?(File.join(App.config.project_dir, "schemas"))
    namespace :schema do

      desc "Clear the datamodel outputs"
      task :clean do
        App.config.xcdm.name ||= App.config.name
        files = Dir.glob(File.join(App.config.project_dir, 'resources', App.config.xcdm.name) + ".{momd,xcdatamodeld}")
        files.each do |f|
          rm_rf f
        end
      end

      desc "Generate the xcdatamodel file"
      task :build => :clean do
        App.config.xcdm.name ||= App.config.name
        Dir.chdir App.config.project_dir
        if `xcodebuild -version` =~ /Xcode (\d.\d+)/
          xcode_version = $1
        else
          raise "could not determine xcode version"
        end
        runner = XCDM::Schema::Runner.new( App.config.xcdm.name, "schemas", "resources", App.config.sdk_version)
        App.info "Generating", "Data Model #{App.config.xcdm.name}"
        runner.load_all { |schema, file| App.info "Loading", file }
        runner.write_all { |schema, file| App.info "Writing", file }
      end
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruby-xcdm-0.0.10 lib/ruby-xcdm.rb
ruby-xcdm-0.0.9 lib/ruby-xcdm.rb
ruby-xcdm-0.0.8 lib/ruby-xcdm.rb