stories_sync 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/lib/pivotal.rb CHANGED
@@ -1,9 +1,6 @@
1
1
  CONFIG_FILE = File.join("#{Dir.pwd}", "config", "pivotal.yml")
2
2
 
3
- # Failsafe in case there's no config file
4
- raise "You don't have a configuration file yet, try running 'stories setup'" unless File.exists?(CONFIG_FILE)
5
-
6
- PIVOTAL_CONFIG = YAML.load_file(CONFIG_FILE)
3
+ PIVOTAL_CONFIG = File.exists?(CONFIG_FILE) ? YAML.load_file(CONFIG_FILE) : {:user => {:token => ""}, :project => {:id => 1}}
7
4
 
8
5
  # Interaction with Pivotal
9
6
  class Iteration < ActiveResource::Base
data/lib/stories_sync.rb CHANGED
@@ -71,7 +71,8 @@ private
71
71
  def difference(hash_a ,hash_b)
72
72
  new_stories = {}
73
73
  hash_a.each_pair do |label, stories|
74
- new_stories[label] = stories - hash_b[label].to_a
74
+ new_label_stories = stories - hash_b[label].to_a
75
+ new_stories[label] = new_label_stories unless new_label_stories.empty?
75
76
  end
76
77
  new_stories
77
78
  end
@@ -147,12 +148,13 @@ private
147
148
 
148
149
  def add_new_stories(new_stories)
149
150
  new_stories.each_pair do |label, stories|
151
+
150
152
  file = story_file(label)
151
153
  if File.exists?(file)
152
154
  original_file = File.read(file).scan(/(.*)end/m)
153
155
  original_file << "\n # Pending stories\n"
154
156
 
155
- File.open(story_file(label), "w") do |f|
157
+ File.open(file, "w") do |f|
156
158
  f.puts original_file
157
159
  f.puts stories.map {|story| " story \"#{story}\""}.join("\n")
158
160
  f.puts "end"
data/stories_sync.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "stories_sync"
3
- s.version = "0.0.3"
3
+ s.version = "0.0.4"
4
4
  s.summary = "Stories Sync"
5
5
  s.description = "Manage and syncrhonize your UATs with Pivotal Tracker."
6
6
  s.authors = ["Evelin Garcia", "Lucas Nasif"]
@@ -17,7 +17,7 @@ class StorySyncTest < Test::Unit::TestCase
17
17
  spawn_story("3", "label_2")
18
18
  end
19
19
 
20
- should "Synchronize multi-files with Pivotal" do
20
+ should "Synchronize multiple files with Pivotal" do
21
21
  execute_at_root("sync")
22
22
 
23
23
  stories = Story.find(:all).inject({}) do |result, story|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stories_sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evelin Garcia