cuki 0.0.8 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.rdoc CHANGED
@@ -2,14 +2,13 @@
2
2
 
3
3
  Cuki provides an easy way to import acceptance criteria from a Confluence wiki into Cucumber feature files
4
4
 
5
- * Supports a mapping between Confluence pages and feature files
6
- * Extracts only the acceptance criteria section of a wiki page
7
- * Converts Confluence tables to Cucumber tables
8
- * Strips out unnecessary Confluence formatting (headers., macros, etc.)
9
- * Includes a link back to the original Confluence page
10
- * Formats the feature using Cucumber's auto-formatter (optional)
11
- * Support client SSL certificates for use within an organisation's secure intranet
12
- * Assign tags to a feature based on the wiki page content
5
+ - Supports a mapping between Confluence pages and feature files
6
+ - Converts Confluence tables to Cucumber tables
7
+ - Strips out unnecessary Confluence formatting (headers, etc.)
8
+ - Includes a link back to the original Confluence page
9
+ - Formats the feature using Cucumber's auto-formatter (optional)
10
+ - Support client SSL certificates for use within an organisation's secure intranet
11
+ - Assign tags to a feature based on the wiki page content
13
12
 
14
13
  It can be used as part of a CI process or just for ad-hoc imports.
15
14
 
@@ -23,6 +22,15 @@ Require the gem in your Gemfile:
23
22
 
24
23
  Cuki expects a configuration file in config/cuki.yml. See the sample provided.
25
24
 
25
+ You can have a one-to-one association between Confluences pages, or you can split a single Confluence
26
+ pages into multiple features. The splitter is a little fussy about structure, it must be:
27
+
28
+ h1. Acceptance Criteria
29
+
30
+ h2. Feature Name
31
+
32
+ h2. Another Feature Name
33
+
26
34
  == Usage
27
35
 
28
36
  Run it from the command line:
@@ -39,21 +47,21 @@ You can also pull a single feature:
39
47
 
40
48
  == Options
41
49
 
42
- * SKIP_AUTOFORMAT to avoid reformatting features (runs over the whole features directory)
43
- * PEM=/path/to/something.pem.cer (for client certificates)
44
- * CER=/path/to/something.pem (for client certificates)
50
+ - SKIP_AUTOFORMAT to avoid reformatting features (runs over the whole features directory)
51
+ - PEM=/path/to/something.pem.cer (for client certificates)
52
+ - CER=/path/to/something.pem (for client certificates)
45
53
 
46
- == Known Issues and Limitation
54
+ == Known Issues and Limitations
47
55
 
48
- * Expects the Cucumber scenarios to continue to the the last part of the the page
49
- * Will only work with Confluence setups which have no password, or use client certificates for authentcation
50
- * One provides one-way sync, i.e. you can't edit a file locally and push it to Confluence
51
- * Fails if the specified folder to save a feature to doesn't exist
56
+ - Will only work with Confluence setups which have no password, or use client certificates for authentcation
57
+ - Only provides one-way sync, i.e. you can't edit a file locally and push it to Confluence
58
+ - Fails if the AC block is the last H1 section of the page
59
+ - Should fail if no features found in container block
52
60
 
53
61
  == TODO
54
62
 
55
- * Handle links
56
- * Support for pushing features to Confluence (roundtrip editing)
63
+ - Handle links
64
+ - Support for pushing features to Confluence (roundtrip editing)
57
65
 
58
66
  == Copyright
59
67
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.8
1
+ 0.0.9
data/cuki.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "cuki"
8
- s.version = "0.0.8"
8
+ s.version = "0.0.9"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Andy Waite"]
12
- s.date = "2011-10-17"
12
+ s.date = "2011-10-18"
13
13
  s.description = ""
14
14
  s.email = "andy@andywaite.com"
15
15
  s.executables = ["cuki"]
data/cuki.yaml.sample CHANGED
@@ -6,5 +6,6 @@ tags:
6
6
  draft: "{info:title=Draft version}"
7
7
  signed_off: "{info:title=Signed-off}"
8
8
  mappings:
9
- 123: features/products/add_product.feature
10
- 124: features/products/remove_product.feature
9
+ 123: features/products/add_product.feature # single file mapping
10
+ 124: features/products/remove_product.feature # single file mapping
11
+ 125: features/admin # folder mapping
@@ -29,6 +29,10 @@ Feature: Pull
29
29
  <input id="content-title" value="Add Product">
30
30
  <div id="markupTextarea">
31
31
  This feature describes adding a product
32
+
33
+ # Some comment
34
+
35
+ Blah
32
36
  </div>
33
37
  """
34
38
  And a Confluence page on "example.com" with id 456:
@@ -47,6 +51,10 @@ Feature: Pull
47
51
 
48
52
 
49
53
  This feature describes adding a product
54
+
55
+ - Some comment
56
+
57
+ Blah
50
58
 
51
59
  """
52
60
  And the file "features/products/remove_product.feature" should contain exactly:
@@ -3,12 +3,11 @@ Feature: Splitting
3
3
  Instead of association one wiki page per feature file, you can split a wiki file across multiple feature files.
4
4
 
5
5
  @announce
6
- Scenario: Pull all features
6
+ Scenario: Pull all features (default container)
7
7
  Given a file named "config/cuki.yaml" with:
8
8
  """
9
9
  ---
10
10
  host: http://example.com
11
- container: !ruby/regexp '/h1\. Acceptance Criteria(.*)h1\./m'
12
11
  mappings:
13
12
  123: features/products
14
13
  """
@@ -16,6 +15,8 @@ Feature: Splitting
16
15
  """
17
16
  <input id="content-title" value="Product Management">
18
17
  <div id="markupTextarea">
18
+ Pretext
19
+
19
20
  h1. Acceptance Criteria
20
21
 
21
22
  Something
@@ -65,3 +66,45 @@ Feature: Splitting
65
66
 
66
67
  """
67
68
 
69
+ @announce
70
+ Scenario: Pull all features (specified container)
71
+ Given a file named "config/cuki.yaml" with:
72
+ """
73
+ ---
74
+ host: http://example.com
75
+ container: !ruby/regexp '/h1\. \*Acceptance Criteria\*(.*)h1\./m'
76
+ mappings:
77
+ 123: features/products
78
+ """
79
+ And a Confluence page on "example.com" with id 123:
80
+ """
81
+ <input id="content-title" value="Product Management">
82
+ <div id="markupTextarea">
83
+ h1. *Acceptance Criteria*
84
+
85
+ Something
86
+
87
+ h2. Add Product
88
+
89
+ This feature describes adding a product
90
+
91
+ h6. Scenario: Scenario A
92
+
93
+ h1. Next Section
94
+ </div>
95
+ """
96
+ When I run `cuki pull --skip-autoformat --skip-header`
97
+ Then the file "features/products/add_product.feature" should contain exactly:
98
+ """
99
+ Feature: Add Product
100
+
101
+
102
+
103
+ http://example.com/pages/viewpage.action?pageId=123#ProductManagement-AddProduct
104
+
105
+ This feature describes adding a product
106
+
107
+ Scenario: Scenario A
108
+
109
+
110
+ """
data/lib/cuki.rb CHANGED
@@ -95,8 +95,12 @@ class Cuki
95
95
  puts doc.to_s
96
96
  exit(1)
97
97
  end
98
-
99
- if @config['container'] && !filepath.include?('.feature')
98
+
99
+
100
+ unless filepath.include?('.feature')
101
+
102
+ @config['container'] ||= /h1\. Acceptance Criteria(.*)h1\./m
103
+
100
104
  handle_multi doc, id
101
105
  else
102
106
 
@@ -108,12 +112,16 @@ class Cuki
108
112
 
109
113
  process_tags
110
114
 
111
- @content = "# Generated by Cuki (#{Time.now})\n" + @content unless @skip_header
115
+ @content = generated_by + @content unless @skip_header
112
116
 
113
117
  save_file filepath
114
118
  end
115
119
  end
116
120
 
121
+ def generated_by
122
+ "# Generated by Cuki (#{Time.now})\n"
123
+ end
124
+
117
125
  def autoformat
118
126
  `cucumber -a . --dry-run -P` unless @skip_autoformat
119
127
  end
@@ -122,9 +130,12 @@ class Cuki
122
130
  feature_title_compressed = doc.at('#content-title')[:value].anchorize
123
131
 
124
132
  @content += get_markup(doc)
133
+
134
+ clean
135
+
125
136
  acceptance_criteria_matches = @content.match(@config['container'])
126
137
  unless acceptance_criteria_matches
127
- puts "Could not match #{config['container']}"
138
+ puts "Could not match #{@config['container']} in #{id}"
128
139
  exit(1)
129
140
  end
130
141
  acceptance_criteria = acceptance_criteria_matches[1]
@@ -147,6 +158,7 @@ class Cuki
147
158
  fname = "#{dirpath}/#{feature_filename.gsub("\r", '')}.feature"
148
159
  File.open(fname, 'w') do |f|
149
160
  puts "Writing #{fname}"
161
+ f.write generated_by unless @skip_header
150
162
  f.write "Feature: #{title}\n\n"
151
163
  link = @config['host'] + "/pages/viewpage.action?pageId=#{id}##{feature_title_compressed}-#{scenario_title_compressed}"
152
164
  f.write "\n\n" + link
@@ -177,6 +189,8 @@ class Cuki
177
189
  @content.gsub!('‘', "'")
178
190
  @content.gsub!('“', '"')
179
191
  @content.gsub!('”', '"')
192
+
193
+ @content.gsub!(/^#(.*)/, '-' + '\1')
180
194
 
181
195
  end
182
196
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cuki
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 8
10
- version: 0.0.8
9
+ - 9
10
+ version: 0.0.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - Andy Waite
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-10-17 00:00:00 Z
18
+ date: 2011-10-18 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  requirement: &id001 !ruby/object:Gem::Requirement