Class: Protozoa::App

Inherits:
Sinatra::Base
  • Object
show all
Includes:
Amiba::Repo
Defined in:
lib/amiba/frontend/app.rb

Instance Method Summary collapse

Methods included from Amiba::Repo

#add_and_commit, #init, #last_commit_date, #last_commit_dates, #pull, #push, #repo

Instance Method Details

#actorObject

dsci specific



159
160
161
# File 'lib/amiba/frontend/app.rb', line 159

def actor
  Grit::Actor.new(env["X-DSCI-USER"],env["X-DSCI-EMAIL"])
end

#all_pagesObject



143
144
145
146
147
148
149
150
151
152
# File 'lib/amiba/frontend/app.rb', line 143

def all_pages
  Dir.glob('pages/**/[^_]*').inject([]) do |acc, page_file|
    if !File.directory? page_file
      page = Amiba::Source::Page.new(File.relpath(page_file, "pages"))
      ent = Amiba::Source::PageEntry.new(page)
      acc << page unless ent.new?
    end
    acc
  end
end

#commit(filename) ⇒ Object



163
164
165
166
167
# File 'lib/amiba/frontend/app.rb', line 163

def commit(filename)
  r = Grit::Repo.new(Dir.pwd)
  r.add(filename)
  r.index.commit(commit_message, nil, actor)
end

#commit_messageObject



154
155
156
# File 'lib/amiba/frontend/app.rb', line 154

def commit_message
  { :message => params[:message] }
end