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