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 +1 -4
- data/lib/stories_sync.rb +4 -2
- data/stories_sync.gemspec +1 -1
- data/test/stories_sync_test.rb +1 -1
- metadata +1 -1
data/lib/pivotal.rb
CHANGED
@@ -1,9 +1,6 @@
|
|
1
1
|
CONFIG_FILE = File.join("#{Dir.pwd}", "config", "pivotal.yml")
|
2
2
|
|
3
|
-
|
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
|
-
|
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(
|
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
data/test/stories_sync_test.rb
CHANGED
@@ -17,7 +17,7 @@ class StorySyncTest < Test::Unit::TestCase
|
|
17
17
|
spawn_story("3", "label_2")
|
18
18
|
end
|
19
19
|
|
20
|
-
should "Synchronize
|
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|
|