Class: Stories
Overview
FIXME We are using both restclient and ARes at the moment. We should migrate everything to restclient, since it’s way smaller.
Instance Method Summary collapse
Instance Method Details
#add_pending_stories ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/stories_sync.rb', line 17 def add_pending_stories say_status(:fetch, "Fetching stories from Pivotal.") new_external_stories = difference(fetch_stories, local_stories) if new_external_stories.empty? say_status(:complete, "Pivotal stories up to date.") else new_external_stories.each_pair do |label, stories| say_status(:compare, "There are #{stories.size} new stories in Pivotal with the label '#{label}'.") end add_new_stories(new_external_stories) end end |
#setup ⇒ Object
59 60 61 62 63 64 65 66 67 68 |
# File 'lib/stories_sync.rb', line 59 def setup unless user_config say "You need to create a configuration file" create_config_file else say "This is your pivotal configuration" say user_config create_config_file if yes? "Do you want to change your configuration? (Y/N)" end end |
#sync ⇒ Object
53 54 55 56 |
# File 'lib/stories_sync.rb', line 53 def sync add_pending_stories upload_new_stories end |
#upload_new_stories ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/stories_sync.rb', line 32 def upload_new_stories new_local_stories = difference(local_stories, fetch_stories) new_local_stories.each_pair do |label, stories| say_status(:compare, "You have #{stories.size} new local stories in #{label}_test.rb.") end if new_local_stories.empty? say_status(:complete, "Local stories up to date.") else new_local_stories.each_pair do |label, stories| stories.each do |story| upload_new_story(story, label) say_status(:append, "Added story: '#{story}'") end end say_status(:completed, "Stories added to Pivotal successfully.") end end |