cuki 0.0.2 → 0.0.3

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
@@ -5,11 +5,11 @@ Cuki provides an easy way to import acceptance criteria from a Confluence wiki i
5
5
  * Supports a mapping between Confluence pages and feature files
6
6
  * Extracts only the acceptance criteria section of a wiki page
7
7
  * Converts Confluence tables to Cucumber tables
8
- * Strips out unncessary Confluence formatting (h1., macros, etc.)
9
- * Adds a @pending tag if the wiki page is marked as a draft
8
+ * Strips out unnecessary Confluence formatting (headers., macros, etc.)
10
9
  * Includes a link back to the original Confluence page
11
- * Formats the feature using Cucumber's autoformatter (optional)
10
+ * Formats the feature using Cucumber's auto-formatter (optional)
12
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
13
13
 
14
14
  It can be used as part of a CI process or just for ad-hoc imports.
15
15
 
@@ -44,6 +44,7 @@ or, if using Bundler binstubs:
44
44
  * Expects the Cucumber scenarios to continue to the the last part of the the page
45
45
  * Will only work with Confluence setups which have no password, or use client certificates for authentcation
46
46
  * One provides one-way sync, i.e. you can't edit a file locally and push it to Confluence
47
+ * Fails if the specified folder to save a feature to doesn't exist
47
48
 
48
49
  == TODO
49
50
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.2
1
+ 0.0.3
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.2"
8
+ s.version = "0.0.3"
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-12"
12
+ s.date = "2011-10-14"
13
13
  s.description = ""
14
14
  s.email = "andy@andywaite.com"
15
15
  s.executables = ["cuki"]
data/cuki.yaml.sample CHANGED
@@ -1,7 +1,10 @@
1
1
  # edit this and save it as config/cuki.yaml
2
+ # the mappings associate the page IDs on Confluence with local feature files
3
+ # the .feature extension is added automatically
2
4
  ---
3
5
  base: http://mywiki/pages/editpage.action?pageId=
4
- draft: "{info:title=Draft version}"
6
+ tags:
7
+ draft: "{info:title=Draft version}"
5
8
  mappings:
6
9
  123: products/add_product
7
10
  124: products/remove_product
data/lib/cuki.rb CHANGED
@@ -14,12 +14,13 @@ class Cuki
14
14
  end
15
15
 
16
16
  def initialize
17
+ autoformat
17
18
  read_config
18
19
  configure_http_client
19
20
  @mappings.each { |key, value| process_mapping key, value }
20
21
  autoformat
21
22
  end
22
-
23
+
23
24
  private
24
25
 
25
26
  def read_config
@@ -33,7 +34,7 @@ class Cuki
33
34
  @mappings = config["mappings"]
34
35
  raise "mappings not found in #{config_path}" unless @mappings
35
36
 
36
- @draft_indicator = config['draft']
37
+ @tag_mappings = config['tags']
37
38
  end
38
39
 
39
40
  def configure_http_client
@@ -57,7 +58,15 @@ class Cuki
57
58
  wiki_text.gsub(' ', '')
58
59
 
59
60
  cuke_text = ''
60
- cuke_text += "@pending\n" if wiki_text.include?(@draft_indicator)
61
+
62
+ tags = []
63
+ if @tag_mappings
64
+ @tag_mappings.each do |tag, snippet|
65
+ tags << "@#{tag}" if wiki_text.include?(snippet)
66
+ end
67
+ end
68
+
69
+ cuke_text += tags.join(' ') + "\n" unless [] == tags
61
70
 
62
71
  title = title.split(' - ').first
63
72
 
@@ -66,14 +75,18 @@ class Cuki
66
75
 
67
76
  cuke_text += "#{wiki_link}\n\n"
68
77
 
69
- raise "couldn't find start of acceptance criteria in #{title}" unless wiki_text.match(START_INDICATOR)
70
-
71
- cuke_text += wiki_text.split(START_INDICATOR).last
78
+ if wiki_text.match(START_INDICATOR)
79
+ cuke_text += wiki_text.split(START_INDICATOR).last
80
+ else
81
+ cuke_text += wiki_text.split(START_INDICATOR).last
82
+ end
72
83
 
73
84
  # remove the double pipes used for table headers in Confluence
74
85
  cuke_text.gsub!('||', '|')
75
86
 
76
87
  # remove other noise
88
+ cuke_text.gsub!("\r\n", "\n")
89
+ cuke_text.gsub!("\\\\\n", '')
77
90
  cuke_text.gsub!('\\', '')
78
91
 
79
92
  # remove any unwanted headers
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: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
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-12 00:00:00 Z
18
+ date: 2011-10-14 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  requirement: &id001 !ruby/object:Gem::Requirement