Class: Octodmin::Controllers::Syncs::Create
- Inherits:
-
Object
- Object
- Octodmin::Controllers::Syncs::Create
- Includes:
- Action
- Defined in:
- app/controllers/syncs/create.rb
Instance Method Summary collapse
Instance Method Details
#call(params) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/syncs/create.rb', line 6 def call(params) self.format = :json site = Octodmin::Site.new git = Git.open(Octodmin::App.dir) # Add files to commit stage stage(site, git) # Pull changes git.pull # Commit and push changes if any sync(site, git) rescue Git::GitExecuteError => e halt 400, JSON.dump(errors: [e.]) ensure git.reset(".") end |