Module: RIM::Manifest

Included in:
Command::Sync, Command::Upload, CommandHelper
Defined in:
lib/rim/manifest/model.rb,
lib/rim/manifest/helper.rb,
lib/rim/manifest/json_reader.rb,
lib/rim/manifest/repo_reader.rb

Defined Under Namespace

Modules: Helpers Classes: Manifest, ManifestFileNotFound, Module, RepoReader, RimError

Instance Method Summary collapse

Instance Method Details

#parse_manifest(json) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/rim/manifest/json_reader.rb', line 21

def parse_manifest(json)
  data_hash = JSON.parse(json)
  modules = []
  if data_hash.has_key?("modules")
    data_hash["modules"].each do |mod|
      modules.push(
        Module.new(
          :remote_path => mod["remote_path"],
          :local_path => mod["local_path"],
          :target_revision => mod["target_revision"],
          :ignores => mod["ignores"],
          :subdir => mod["subdir"]
        ))
    end
  end
  Manifest.new(data_hash["remote_url"], modules)
end

#read_manifest(f) ⇒ Object



16
17
18
19
# File 'lib/rim/manifest/json_reader.rb', line 16

def read_manifest(f)
  raise "no manifest found" unless f
  parse_manifest(File.read(f))
end