Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Gemify! 💎 #2

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

Gemify! 💎 #2

wants to merge 9 commits into from

Conversation

lmarburger
Copy link
Contributor

This is based off #1.

@lmarburger
Copy link
Contributor Author

@pedro As per our conversation, I need to extract Devdigest out of bin/devdigest so it can be used outside of the CLI so it's on par with what you've committed to master.

The using the Devdigest class directly should rely on ENV vars. The CLI can make use of prompting for credentials and persisting in ~/.netrc.

@lmarburger
Copy link
Contributor Author

@pedro OK. I think we're good. You can move Rakefile to another project which will be pushed to Heroku and keep it mostly identical. You'll need to add devdigest to its Gemfile (once it's pushed, of course), require it, and tweak the call to Devdigest.run.

# changed from './devdigest'
require 'devdigest'

task :digest do
  # defaults to 1 day
  puts Devdigest.run
end

task :daily_digest do
  since = Time.now-24*60*60
  # api changed from run(since) to run(since: since)
  puts Devdigest.run(since: since)
end

task :daily_email do
  case Time.now.wday
  when 0, 6
    puts "Skipping weekend"
    next
  when 1 # monday
    since = Time.now-3*24*60*60
    puts "Monday - fetching activity since #{since}"
  else   # regular weekday
    since = Time.now-24*60*60
    puts "Weekday - fetching activity since #{since}"
  end

  # api changed from run(since) to run(since: since)
  digest   = Devdigest.run(since: since)
  markdown = RDiscount.new(digest)

  # remaining email code identical...
end

Let me know what you think and I can start merging this into master. We can extract bits from `lib/d

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant