Class: Mumukit::Sync::Store::Github::GuideExport
- Defined in:
- lib/mumukit/sync/store/github/guide_export.rb
Instance Attribute Summary collapse
-
#author_email ⇒ Object
Returns the value of attribute author_email.
-
#bot ⇒ Object
Returns the value of attribute bot.
-
#guide_resource_h ⇒ Object
Returns the value of attribute guide_resource_h.
Instance Method Summary collapse
- #before_run_in_local_repo ⇒ Object
- #can_run? ⇒ Boolean
-
#initialize(options) ⇒ GuideExport
constructor
A new instance of GuideExport.
- #repo ⇒ Object
- #run_in_local_repo(dir, local_repo) ⇒ Object
Methods inherited from Operation
#ensure_post_commit_hook!, #run!, #with_local_repo
Constructor Details
#initialize(options) ⇒ GuideExport
Returns a new instance of GuideExport.
6 7 8 9 10 |
# File 'lib/mumukit/sync/store/github/guide_export.rb', line 6 def initialize() super() @guide_resource_h = [:document] = [:author_email] end |
Instance Attribute Details
#author_email ⇒ Object
Returns the value of attribute author_email.
4 5 6 |
# File 'lib/mumukit/sync/store/github/guide_export.rb', line 4 def end |
#bot ⇒ Object
Returns the value of attribute bot.
4 5 6 |
# File 'lib/mumukit/sync/store/github/guide_export.rb', line 4 def bot @bot end |
#guide_resource_h ⇒ Object
Returns the value of attribute guide_resource_h.
4 5 6 |
# File 'lib/mumukit/sync/store/github/guide_export.rb', line 4 def guide_resource_h @guide_resource_h end |
Instance Method Details
#before_run_in_local_repo ⇒ Object
20 21 22 |
# File 'lib/mumukit/sync/store/github/guide_export.rb', line 20 def before_run_in_local_repo bot.ensure_exists! repo, guide_resource_h[:private] end |
#can_run? ⇒ Boolean
16 17 18 |
# File 'lib/mumukit/sync/store/github/guide_export.rb', line 16 def can_run? bot.authenticated? end |
#repo ⇒ Object
12 13 14 |
# File 'lib/mumukit/sync/store/github/guide_export.rb', line 12 def repo @repo ||= Mumukit::Auth::Slug.parse(guide_resource_h[:slug]) end |
#run_in_local_repo(dir, local_repo) ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/mumukit/sync/store/github/guide_export.rb', line 24 def run_in_local_repo(dir, local_repo) clear_repo local_repo GuideWriter.new(dir, log).write_guide! guide_resource_h local_repo.add(all: true) local_repo.commit("Mumuki Export on #{Time.now}", ) local_repo.push rescue Git::GitExecuteError => e puts "Could not export guide #{guide_resource_h[:slug]} to git #{e}" end |