# File lib/fastcst/command/init.rb, line 34
34:         def run
35:             # create the repository
36:             env = {"Created By" => {"E-Mail" => @email, "Name" => @name},  
37:             "Project" => @project, "Path" => []}
38:             Dir.mkdir Repository::DEFAULT_FASTCST_DIR
39:             repo = Repository.create(Repository::DEFAULT_FASTCST_DIR, env)
40:         
41:             # now we make the very first revision which is the root of it all
42:             cs_name = "root"
43:             md_file = "meta-data.yaml"
44: 
45:             Dir.chdir repo.work_dir do
46:                 originals = File.join("..","originals")
47:                 sources = File.join("..","..")
48:                 data_file = cs_name + ".fcs"
49:                 journal_file = cs_name + ".yaml"
50:                 purpose = "Initial repository creation"
51: 
52:                 # first we try to make the changeset so we can see if this is pristine or not
53:                 puts "originals: #{originals}, sources: #{sources}, #{cs_name}"
54:                 changes = ChangeSet.make_changeset(cs_name, originals, sources)
55:                 
56:                 if not changes.has_changes?
57:                     UI.event :info, "Looks like you have a pristine directory.  You'll need to bootsrap this one."
58:                     return
59:                 end
60:                 
61:                 MetaData.create_metadata(md_file, @project, "root", purpose, @name, @email)
62:                 
63:                 journal_in = Zlib::GzipReader.new(File.open(journal_file))
64:                 data_in = Zlib::GzipReader.new(File.open(data_file))
65:                     
66:                 # apply closes the files for us
67:                 ChangeSet.apply_changeset(journal_in, data_in, originals)
68:                 
69:                 MetaData.finish_metadata(md_file, "NONE", data_file, journal_file)
70:             end
71:         
72:             # store the newly created changeset, doing a move instead of a copy
73:             md = repo.store_changeset repo.work_dir, md_file, move=true
74:             # and update the environment to reflect our new revision path
75:             repo["Path"] = repo["Path"] << md['ID']
76:             
77:             UI.event :finished, "Root revision: #{repo.build_readable_name md['ID']}"
78:         end