Class: WhatsupGithub::Runner
- Inherits:
-
Object
- Object
- WhatsupGithub::Runner
- Defined in:
- lib/whatsup_github/runner.rb
Instance Method Summary collapse
- #check_dir_at(filepath) ⇒ Object
- #data ⇒ Object
-
#initialize(date) ⇒ Runner
constructor
A new instance of Runner.
- #run ⇒ Object
- #table ⇒ Object
- #write_results(file, formatter) ⇒ Object
Constructor Details
Instance Method Details
#check_dir_at(filepath) ⇒ Object
32 33 34 |
# File 'lib/whatsup_github/runner.rb', line 32 def check_dir_at(filepath) FileUtils.mkdir_p filepath unless Dir.exist? filepath end |
#data ⇒ Object
40 41 42 |
# File 'lib/whatsup_github/runner.rb', line 40 def data write_results 'tmp/whats-new.yml', YAMLFormatter.new end |
#run ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/whatsup_github/runner.rb', line 17 def run format = @config.output_format raise 'Cannot find "output_format" in config.yml' unless format table if format.include? 'markdown' data if format.include? 'yaml' end |
#table ⇒ Object
36 37 38 |
# File 'lib/whatsup_github/runner.rb', line 36 def table write_results 'tmp/whats-new-on-devdocs.md', Table.new end |
#write_results(file, formatter) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/whatsup_github/runner.rb', line 25 def write_results(file, formatter) formatted_content = @generator.run formatter, @content check_dir_at File.dirname file File.write file, formatted_content puts "Done!\nOpen \"#{file}\" to see the result." end |