pivotxt 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +21 -0
- data/.rspec +1 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +48 -0
- data/LICENSE +22 -0
- data/README.markdown +50 -0
- data/Rakefile +45 -0
- data/VERSION +1 -0
- data/autotest/discover.rb +1 -0
- data/bin/pivotxt +18 -0
- data/lib/pivotxt.rb +40 -0
- data/lib/pivtxt.treetop +135 -0
- data/pivotxt.gemspec +66 -0
- data/pivotxt_config.yml +4 -0
- data/spec/fixtures/pivotxt_stories.txt +19 -0
- data/spec/pivotxt_spec.rb +33 -0
- data/spec/pivotxt_treetop_grammar_spec.rb +44 -0
- data/spec/spec_helper.rb +9 -0
- metadata +103 -0
data/.document
ADDED
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
builder (2.1.2)
|
5
|
+
columnize (0.3.1)
|
6
|
+
diff-lcs (1.1.2)
|
7
|
+
fakeweb (1.3.0)
|
8
|
+
happymapper (0.3.2)
|
9
|
+
libxml-ruby (~> 1.1.3)
|
10
|
+
libxml-ruby (1.1.4)
|
11
|
+
linecache (0.43)
|
12
|
+
mime-types (1.16)
|
13
|
+
nokogiri (1.4.3.1)
|
14
|
+
pivotal-tracker (0.2.2)
|
15
|
+
builder
|
16
|
+
happymapper (>= 0.3.2)
|
17
|
+
nokogiri (~> 1.4.3.1)
|
18
|
+
rest-client (~> 1.6.0)
|
19
|
+
polyglot (0.3.1)
|
20
|
+
rest-client (1.6.1)
|
21
|
+
mime-types (>= 1.16)
|
22
|
+
rspec (2.0.0.beta.22)
|
23
|
+
rspec-core (= 2.0.0.beta.22)
|
24
|
+
rspec-expectations (= 2.0.0.beta.22)
|
25
|
+
rspec-mocks (= 2.0.0.beta.22)
|
26
|
+
rspec-core (2.0.0.beta.22)
|
27
|
+
rspec-expectations (2.0.0.beta.22)
|
28
|
+
diff-lcs (>= 1.1.2)
|
29
|
+
rspec-mocks (2.0.0.beta.22)
|
30
|
+
rspec-core (= 2.0.0.beta.22)
|
31
|
+
rspec-expectations (= 2.0.0.beta.22)
|
32
|
+
ruby-debug (0.10.3)
|
33
|
+
columnize (>= 0.1)
|
34
|
+
ruby-debug-base (~> 0.10.3.0)
|
35
|
+
ruby-debug-base (0.10.3)
|
36
|
+
linecache (>= 0.3)
|
37
|
+
treetop (1.4.8)
|
38
|
+
polyglot (>= 0.3.1)
|
39
|
+
|
40
|
+
PLATFORMS
|
41
|
+
ruby
|
42
|
+
|
43
|
+
DEPENDENCIES
|
44
|
+
fakeweb
|
45
|
+
pivotal-tracker
|
46
|
+
rspec (>= 2.0.0.beta.17)
|
47
|
+
ruby-debug
|
48
|
+
treetop
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2010 Gabe Hollombe
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
22
|
+
|
data/README.markdown
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# Pivotxt lets you easily create stories in Pivotal Tracker from a simple text file.
|
2
|
+
|
3
|
+
Sure, there's [slurper](http://github.com/hashrocket/slurper) but I didn't like slurper's file format; it's too YAML-y.
|
4
|
+
Hint: if you need a vim plugin to help you write your stories file, it's probably overly-complicated.
|
5
|
+
|
6
|
+
So, I drafted a simple file format that I'd like to use and I wrote a grammar in Treetop to parse that format. Pivotxt is the result. Hopefully you'll find it as useful as I do.
|
7
|
+
|
8
|
+
## Configuration & Usage
|
9
|
+
1. Stick your appropriate values into pivotxt_config.yml
|
10
|
+
2. Use bin/pivotxt like this: pivotxt stories.pivotxt
|
11
|
+
3. You're done.
|
12
|
+
|
13
|
+
|
14
|
+
## Sample stories.pivotxt file format
|
15
|
+
<pre>
|
16
|
+
LabelOne LabelTwo
|
17
|
+
- Features start with -'s as you can see (an inline description for this feature would go here)
|
18
|
+
|
19
|
+
- Features can have multi-line descriptions too, like this one
|
20
|
+
This is the first description line for the above feature.
|
21
|
+
Here is another line.
|
22
|
+
And yet another line here.
|
23
|
+
|
24
|
+
- All stories nested under a line of labels will have those labels applied to them.
|
25
|
+
In this case, we'll end up with 3 features and 2 chores,
|
26
|
+
all with the 'LabelOne' and 'LabelTwo' labels assigned to them
|
27
|
+
because these are all nested under the 'LabelOne LabelTwo' line above.
|
28
|
+
|
29
|
+
[] Chores look like check boxes (and they can have inline descriptions too)
|
30
|
+
|
31
|
+
[] Chores can also have multi-line descriptions
|
32
|
+
Here's a multiline description for the above chore.
|
33
|
+
This is a second line of description.
|
34
|
+
|
35
|
+
|
36
|
+
AnotherLabel
|
37
|
+
- Obviously, you can have as many labeled groups of stories as you want.
|
38
|
+
This feature belongs to a new label group called 'AnotherLabel'
|
39
|
+
and it will be the only story created for the 'AnotherLabel' label.
|
40
|
+
</pre>
|
41
|
+
|
42
|
+
|
43
|
+
## Acknowledgements
|
44
|
+
* Special thanks to Clifford Heath ([@cliffordheath](http://twitter.com/cliffordheath)) for helping me grok Treetop and get started with my grammar.
|
45
|
+
* Thanks to [Hashrocket's slurper](http://github.com/hashrocket/slurper) for the inspriation.
|
46
|
+
|
47
|
+
|
48
|
+
## Copyright
|
49
|
+
|
50
|
+
MIT Licensed. Copyright (c) 2010 Gabe Hollombe. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "pivotxt"
|
8
|
+
gem.summary = %Q{Pivotxt lets you easily create stories in Pivotal Tracker from a simple text file.}
|
9
|
+
gem.description = %Q{Pivotxt lets you easily create stories in Pivotal Tracker from a simple text file.}
|
10
|
+
gem.email = "gabe@avantbard.com"
|
11
|
+
gem.homepage = "http://github.com/gabehollombe/pivotxt"
|
12
|
+
gem.authors = ["Gabe Hollombe"]
|
13
|
+
gem.add_development_dependency "rspec", ">= 1.2.9"
|
14
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
15
|
+
end
|
16
|
+
Jeweler::GemcutterTasks.new
|
17
|
+
rescue LoadError
|
18
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
19
|
+
end
|
20
|
+
|
21
|
+
require 'spec/rake/spectask'
|
22
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
23
|
+
spec.libs << 'lib' << 'spec'
|
24
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
25
|
+
end
|
26
|
+
|
27
|
+
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
28
|
+
spec.libs << 'lib' << 'spec'
|
29
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
30
|
+
spec.rcov = true
|
31
|
+
end
|
32
|
+
|
33
|
+
task :spec => :check_dependencies
|
34
|
+
|
35
|
+
task :default => :spec
|
36
|
+
|
37
|
+
require 'rake/rdoctask'
|
38
|
+
Rake::RDocTask.new do |rdoc|
|
39
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
40
|
+
|
41
|
+
rdoc.rdoc_dir = 'rdoc'
|
42
|
+
rdoc.title = "pivotxt #{version}"
|
43
|
+
rdoc.rdoc_files.include('README*')
|
44
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
45
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
@@ -0,0 +1 @@
|
|
1
|
+
Autotest.add_discovery { "rspec2" }
|
data/bin/pivotxt
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$:.unshift(File.join(File.dirname(File.dirname(__FILE__)), '..', 'lib'))
|
4
|
+
require 'rubygems'
|
5
|
+
require 'pivotxt'
|
6
|
+
require 'optparse'
|
7
|
+
|
8
|
+
options = {}
|
9
|
+
OptionParser.new do |opts|
|
10
|
+
opts.on("-r", "--reverse", "Reverse story creation order") do |v|
|
11
|
+
options[:reverse] = v
|
12
|
+
end
|
13
|
+
end.parse!
|
14
|
+
|
15
|
+
story_file = ARGV.empty? ? "stories.pivotxt" : ARGV[0]
|
16
|
+
|
17
|
+
pivotxt = Pivotxt.new(story_file, '../pivotxt_config.yml')
|
18
|
+
pivotxt.upload_stories!
|
data/lib/pivotxt.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'treetop'
|
2
|
+
require 'pivotal-tracker'
|
3
|
+
require 'yaml'
|
4
|
+
|
5
|
+
class Pivotxt
|
6
|
+
attr_reader :project
|
7
|
+
|
8
|
+
def initialize(stories_file, config_file)
|
9
|
+
@stories_file = stories_file
|
10
|
+
@config = YAML.load_file(config_file)
|
11
|
+
|
12
|
+
PivotalTracker::Client.token = @config['token']
|
13
|
+
@project = PivotalTracker::Project.find(@config['project_id'])
|
14
|
+
end
|
15
|
+
|
16
|
+
def load_stories
|
17
|
+
grammar = File.join(File.dirname(__FILE__), 'pivtxt.treetop')
|
18
|
+
Treetop.load grammar
|
19
|
+
|
20
|
+
parser = PivtxtParser.new
|
21
|
+
parser.consume_all_input = false
|
22
|
+
tree = parser.parse(File.read(@stories_file).to_s)
|
23
|
+
|
24
|
+
return tree.value
|
25
|
+
end
|
26
|
+
|
27
|
+
def upload_stories!
|
28
|
+
labeled_groups = load_stories()
|
29
|
+
labeled_groups.each do |labeled_group|
|
30
|
+
labels = labeled_group[:labels]
|
31
|
+
stories = labeled_group[:stories]
|
32
|
+
stories.each do |story|
|
33
|
+
title = story[:title].value
|
34
|
+
description = story[:description].value
|
35
|
+
@project.stories.create(:name => title, :description => description, :labels => labels, :story_type => story[:type].to_s)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
data/lib/pivtxt.treetop
ADDED
@@ -0,0 +1,135 @@
|
|
1
|
+
grammar Pivtxt
|
2
|
+
|
3
|
+
rule label_groups
|
4
|
+
labeled_stories*
|
5
|
+
{
|
6
|
+
def value
|
7
|
+
elements.collect{|e| e.value}
|
8
|
+
end
|
9
|
+
}
|
10
|
+
end
|
11
|
+
|
12
|
+
rule labeled_stories
|
13
|
+
blank_line*
|
14
|
+
labels:(one_line "\n")
|
15
|
+
stories
|
16
|
+
{
|
17
|
+
def value
|
18
|
+
{ :labels => labels.text_value.split(' '),
|
19
|
+
:stories => stories.stories_array
|
20
|
+
}
|
21
|
+
end
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
rule stories
|
26
|
+
story*
|
27
|
+
{
|
28
|
+
def stories_array
|
29
|
+
elements.collect {|e| e.value}
|
30
|
+
end
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
rule story
|
35
|
+
blank_line*
|
36
|
+
item:(feature / chore)
|
37
|
+
{
|
38
|
+
def value
|
39
|
+
item.value
|
40
|
+
end
|
41
|
+
}
|
42
|
+
end
|
43
|
+
|
44
|
+
rule feature
|
45
|
+
indent '- '
|
46
|
+
story_body
|
47
|
+
{
|
48
|
+
def value
|
49
|
+
{:type => :feature, :title => story_body.title, :description => story_body.description}
|
50
|
+
end
|
51
|
+
}
|
52
|
+
end
|
53
|
+
|
54
|
+
rule chore
|
55
|
+
indent '[] '
|
56
|
+
story_body
|
57
|
+
{
|
58
|
+
def value
|
59
|
+
{:type => :chore, :title => story_body.title, :description => story_body.description}
|
60
|
+
end
|
61
|
+
}
|
62
|
+
end
|
63
|
+
|
64
|
+
rule story_body
|
65
|
+
title
|
66
|
+
description:(
|
67
|
+
"\n" multiline_description { def value; multiline_description.value; end }
|
68
|
+
/
|
69
|
+
inline_description "\n" { def value; inline_description.value; end }
|
70
|
+
)
|
71
|
+
end
|
72
|
+
|
73
|
+
rule title
|
74
|
+
plain_text {
|
75
|
+
def value
|
76
|
+
text_value
|
77
|
+
end
|
78
|
+
}
|
79
|
+
end
|
80
|
+
|
81
|
+
rule inline_description
|
82
|
+
(
|
83
|
+
'(' inline_description ')'
|
84
|
+
/
|
85
|
+
plain_text
|
86
|
+
)
|
87
|
+
{
|
88
|
+
def value
|
89
|
+
text_value
|
90
|
+
end
|
91
|
+
}
|
92
|
+
end
|
93
|
+
|
94
|
+
rule multiline_description
|
95
|
+
(indent indent one_line "\n")*
|
96
|
+
{
|
97
|
+
def value
|
98
|
+
text_value
|
99
|
+
end
|
100
|
+
}
|
101
|
+
end
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
#==========================================
|
107
|
+
# Utility rules
|
108
|
+
#==========================================
|
109
|
+
|
110
|
+
rule plain_text
|
111
|
+
(!non_plain .)*
|
112
|
+
end
|
113
|
+
|
114
|
+
# Characters not allowed in a one-line text fragment
|
115
|
+
rule non_plain
|
116
|
+
([()] / "\n")
|
117
|
+
end
|
118
|
+
|
119
|
+
|
120
|
+
# Any text to end of line:
|
121
|
+
rule one_line
|
122
|
+
(!"\n" .)*
|
123
|
+
end
|
124
|
+
|
125
|
+
|
126
|
+
rule blank_line
|
127
|
+
[ \t]* "\n"
|
128
|
+
end
|
129
|
+
|
130
|
+
|
131
|
+
rule indent
|
132
|
+
' '
|
133
|
+
end
|
134
|
+
|
135
|
+
end
|
data/pivotxt.gemspec
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{pivotxt}
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Gabe Hollombe"]
|
12
|
+
s.date = %q{2010-10-01}
|
13
|
+
s.default_executable = %q{pivotxt}
|
14
|
+
s.description = %q{Pivotxt lets you easily create stories in Pivotal Tracker from a simple text file.}
|
15
|
+
s.email = %q{gabe@avantbard.com}
|
16
|
+
s.executables = ["pivotxt"]
|
17
|
+
s.extra_rdoc_files = [
|
18
|
+
"LICENSE",
|
19
|
+
"README.markdown"
|
20
|
+
]
|
21
|
+
s.files = [
|
22
|
+
".document",
|
23
|
+
".gitignore",
|
24
|
+
".rspec",
|
25
|
+
"Gemfile",
|
26
|
+
"Gemfile.lock",
|
27
|
+
"LICENSE",
|
28
|
+
"README.markdown",
|
29
|
+
"Rakefile",
|
30
|
+
"VERSION",
|
31
|
+
"autotest/discover.rb",
|
32
|
+
"bin/pivotxt",
|
33
|
+
"lib/pivotxt.rb",
|
34
|
+
"lib/pivtxt.treetop",
|
35
|
+
"pivotxt.gemspec",
|
36
|
+
"pivotxt_config.yml",
|
37
|
+
"spec/fixtures/pivotxt_stories.txt",
|
38
|
+
"spec/pivotxt_spec.rb",
|
39
|
+
"spec/pivotxt_treetop_grammar_spec.rb",
|
40
|
+
"spec/spec_helper.rb"
|
41
|
+
]
|
42
|
+
s.homepage = %q{http://github.com/gabehollombe/pivotxt}
|
43
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
44
|
+
s.require_paths = ["lib"]
|
45
|
+
s.rubygems_version = %q{1.3.7}
|
46
|
+
s.summary = %q{Pivotxt lets you easily create stories in Pivotal Tracker from a simple text file.}
|
47
|
+
s.test_files = [
|
48
|
+
"spec/pivotxt_spec.rb",
|
49
|
+
"spec/pivotxt_treetop_grammar_spec.rb",
|
50
|
+
"spec/spec_helper.rb"
|
51
|
+
]
|
52
|
+
|
53
|
+
if s.respond_to? :specification_version then
|
54
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
55
|
+
s.specification_version = 3
|
56
|
+
|
57
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
58
|
+
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
59
|
+
else
|
60
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
61
|
+
end
|
62
|
+
else
|
63
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
data/pivotxt_config.yml
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
LabelOne LabelTwo
|
2
|
+
- feature one (description one)
|
3
|
+
|
4
|
+
- feature two (description two)
|
5
|
+
|
6
|
+
- feature three with multiline desc following
|
7
|
+
desc line 1
|
8
|
+
desc line 2
|
9
|
+
desc line 3
|
10
|
+
|
11
|
+
[] chore one (chore desc one)
|
12
|
+
|
13
|
+
[] chore two with multiline desc
|
14
|
+
chore desc line 1
|
15
|
+
chore desc line 2
|
16
|
+
|
17
|
+
|
18
|
+
LabelThree
|
19
|
+
- feature four (desc for feature four)
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe Pivotxt do
|
4
|
+
before do
|
5
|
+
stories_file = File.join(File.dirname(__FILE__), 'fixtures', 'pivotxt_stories.txt')
|
6
|
+
config_file = File.join(File.dirname(__FILE__), '..', 'pivotxt_config.yml')
|
7
|
+
|
8
|
+
PivotalTracker::Project.stub!(:find).and_return(PivotalTracker::Project.new)
|
9
|
+
@pivotxt = Pivotxt.new(stories_file, config_file)
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'sets the pivotal project as configured' do
|
13
|
+
@pivotxt.project.should be_a_kind_of(PivotalTracker::Project)
|
14
|
+
end
|
15
|
+
|
16
|
+
describe '#load_stories(file)' do
|
17
|
+
before do
|
18
|
+
@label_groups = @pivotxt.load_stories
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'returns label_groups' do
|
22
|
+
@label_groups.length.should == 2
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe "#upload_stories!" do
|
27
|
+
it 'creates a story of the appropriate type with the appropriate labels' do
|
28
|
+
@pivotxt.project.stories.stub!(:create).and_return(PivotalTracker::Story.new)
|
29
|
+
@pivotxt.project.stories.should_receive(:create).exactly(6).times
|
30
|
+
@pivotxt.upload_stories!
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'the pivotxt treetop grammar' do
|
4
|
+
before do
|
5
|
+
grammar = File.join(File.dirname(__FILE__), '..', 'lib', 'pivtxt.treetop')
|
6
|
+
Treetop.load grammar
|
7
|
+
|
8
|
+
@parser = PivtxtParser.new
|
9
|
+
@parser.consume_all_input = false
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'parses an example stories file' do
|
13
|
+
stories_file = File.join(File.dirname(__FILE__), 'fixtures', 'pivotxt_stories.txt')
|
14
|
+
tree = @parser.parse(File.read(stories_file).to_s)
|
15
|
+
print "FAILURE REASON: " + @parser.failure_reason.to_s if ! tree
|
16
|
+
|
17
|
+
|
18
|
+
label_groups = tree.value
|
19
|
+
|
20
|
+
labels = label_groups.first[:labels]
|
21
|
+
labels.should include('LabelOne', 'LabelTwo')
|
22
|
+
|
23
|
+
stories = label_groups.first[:stories]
|
24
|
+
stories.length.should == 5
|
25
|
+
|
26
|
+
|
27
|
+
stories[0][:title].value.should == "feature one "
|
28
|
+
stories[0][:description].value.should == "(description one)"
|
29
|
+
stories[0][:type].should == :feature
|
30
|
+
|
31
|
+
multi_line_desc = stories[2][:description].value
|
32
|
+
multi_line_desc.should include('desc line 1', 'desc line 2', 'desc line 3')
|
33
|
+
|
34
|
+
stories[3][:type].should == :chore
|
35
|
+
stories[3][:title].value.should == "chore one "
|
36
|
+
stories[3][:description].value.should == "(chore desc one)"
|
37
|
+
|
38
|
+
|
39
|
+
#next label group
|
40
|
+
stories = label_groups[1][:stories]
|
41
|
+
stories.length.should == 1
|
42
|
+
label_groups[1][:labels].should include('LabelThree')
|
43
|
+
end
|
44
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pivotxt
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Gabe Hollombe
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-10-01 00:00:00 +10:00
|
19
|
+
default_executable: pivotxt
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: rspec
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 13
|
30
|
+
segments:
|
31
|
+
- 1
|
32
|
+
- 2
|
33
|
+
- 9
|
34
|
+
version: 1.2.9
|
35
|
+
type: :development
|
36
|
+
version_requirements: *id001
|
37
|
+
description: Pivotxt lets you easily create stories in Pivotal Tracker from a simple text file.
|
38
|
+
email: gabe@avantbard.com
|
39
|
+
executables:
|
40
|
+
- pivotxt
|
41
|
+
extensions: []
|
42
|
+
|
43
|
+
extra_rdoc_files:
|
44
|
+
- LICENSE
|
45
|
+
- README.markdown
|
46
|
+
files:
|
47
|
+
- .document
|
48
|
+
- .gitignore
|
49
|
+
- .rspec
|
50
|
+
- Gemfile
|
51
|
+
- Gemfile.lock
|
52
|
+
- LICENSE
|
53
|
+
- README.markdown
|
54
|
+
- Rakefile
|
55
|
+
- VERSION
|
56
|
+
- autotest/discover.rb
|
57
|
+
- bin/pivotxt
|
58
|
+
- lib/pivotxt.rb
|
59
|
+
- lib/pivtxt.treetop
|
60
|
+
- pivotxt.gemspec
|
61
|
+
- pivotxt_config.yml
|
62
|
+
- spec/fixtures/pivotxt_stories.txt
|
63
|
+
- spec/pivotxt_spec.rb
|
64
|
+
- spec/pivotxt_treetop_grammar_spec.rb
|
65
|
+
- spec/spec_helper.rb
|
66
|
+
has_rdoc: true
|
67
|
+
homepage: http://github.com/gabehollombe/pivotxt
|
68
|
+
licenses: []
|
69
|
+
|
70
|
+
post_install_message:
|
71
|
+
rdoc_options:
|
72
|
+
- --charset=UTF-8
|
73
|
+
require_paths:
|
74
|
+
- lib
|
75
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
76
|
+
none: false
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
hash: 3
|
81
|
+
segments:
|
82
|
+
- 0
|
83
|
+
version: "0"
|
84
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
|
+
none: false
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
hash: 3
|
90
|
+
segments:
|
91
|
+
- 0
|
92
|
+
version: "0"
|
93
|
+
requirements: []
|
94
|
+
|
95
|
+
rubyforge_project:
|
96
|
+
rubygems_version: 1.3.7
|
97
|
+
signing_key:
|
98
|
+
specification_version: 3
|
99
|
+
summary: Pivotxt lets you easily create stories in Pivotal Tracker from a simple text file.
|
100
|
+
test_files:
|
101
|
+
- spec/pivotxt_spec.rb
|
102
|
+
- spec/pivotxt_treetop_grammar_spec.rb
|
103
|
+
- spec/spec_helper.rb
|