charter 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cbdd2201e293d31ca060ac5282cac57f145a851a
4
- data.tar.gz: fbf9314129688e853c429ad1ad6c8c2d299cdd0b
3
+ metadata.gz: d8499a80980f057511a5cbd8101f51bce30c9d50
4
+ data.tar.gz: 6dd597907ebb88b07b8658e957c6d2a4ceaae7c3
5
5
  SHA512:
6
- metadata.gz: 6a43c9cc6978de481be21315028e628d3cd045597405c07869a0a96864d4ec2f63c1ac84b03bd4736f1e7c9a0433ec6a26e2783529da280f7e03e1f420e09905
7
- data.tar.gz: 70be4ca1e6d7f946dc3ce3430de4610a0575792ac2d5afeffec1f859a8f26d754e5cfdd182384ac75254e1b2adf3f493dee40a2f369214c2001b0d65a3cc1511
6
+ metadata.gz: b29d08eb2bfb19895512eaaf3b85acb0818e61426d3152b15390a36d1e5745d9cd98e669d38b8a1240cb1608f73cad6da6dfbba17910bb742dc96c37d3071767
7
+ data.tar.gz: 035ab19ea04d67b0a3ad76f3f6def1d7d709405f422c8d359b8533dd105bac3e4a616cbfb3ff211720d8b8139a3376d0ed600956035c8a7ee7d9dcd2c82fb6a4
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- Session
1
+ Charter
2
2
  =======
3
3
 
4
4
  Command line interface for creating a test charter exported in markdown.
@@ -69,4 +69,4 @@ Mark Grossman
69
69
  - Refine code structure
70
70
  - Release to RubyGems.org
71
71
  - Add more fields to charter
72
- - Add optional fields
72
+ - Add optional fields
data/bin/charter CHANGED
@@ -14,7 +14,7 @@ desc 'Starts a new session charter'
14
14
  arg_name 'SessionName'
15
15
  command :start do |c|
16
16
  c.action do |global_options,options,args|
17
- doc.create(args)
17
+ doc.create_charter(args)
18
18
  end
19
19
  end
20
20
 
@@ -22,23 +22,24 @@ desc 'What are you testing'
22
22
  arg_name 'What is the purpose of this session'
23
23
  command :purpose, :p do |c|
24
24
  c.action do |global_options,options,args|
25
- doc.purpose(args[0])
25
+ doc.set_purpose(args[0])
26
26
  end
27
27
  end
28
28
 
29
- desc 'Describe environment here'
29
+ desc 'Add an item to describe system under test'
30
30
  arg_name 'List your environment'
31
31
  command :env do |c|
32
32
  c.action do |global_options,options,args|
33
- doc.env(args[0])
33
+ doc.set_env(args[0])
34
34
  end
35
35
  end
36
36
 
37
37
  desc 'Add a bug found during testing'
38
38
  arg_name 'Add a bug to the current session'
39
39
  command :bug do |c|
40
+ c.switch :s
40
41
  c.action do |global_options,options,args|
41
- doc.bug(args[0])
42
+ doc.add_bug(args[0], options[:s])
42
43
  end
43
44
  end
44
45
 
@@ -46,16 +47,19 @@ desc 'Describe a scenario here'
46
47
  arg_name 'Add a scenario to the current session'
47
48
  command :scenario, :s do |c|
48
49
  c.action do |global_options,options,args|
49
- doc.scenario(args[0])
50
+ doc.add_scenario(args[0])
50
51
  end
51
52
  end
52
53
 
53
54
  desc 'Final formatting to charter'
54
55
  arg_name 'Type of export'
55
56
  command :finish do |c|
57
+ c.switch :e
56
58
  c.action do |global_options,options,args|
57
- c.flag :e
58
- doc.finish
59
+ doc.finish_charter
60
+ if options[:e]
61
+ doc.export("finalCharter")
62
+ end
59
63
  end
60
64
  end
61
65
 
@@ -6,7 +6,8 @@
6
6
 
7
7
  ##Length
8
8
  Start Time: <start_time>
9
- End Time: <end_time>
9
+ End Time: <end_time>
10
+ Elapsed: <elapsed>
10
11
 
11
12
  ##Tester
12
13
  <tester>
@@ -16,7 +17,3 @@ End Time: <end_time>
16
17
 
17
18
  ##Defects Found:
18
19
  <defects>
19
-
20
-
21
-
22
-
data/lib/charter/doc.rb CHANGED
@@ -6,48 +6,60 @@ class Doc
6
6
  @config = read_config
7
7
  end
8
8
 
9
- def create(name)
9
+ def create_charter(name)
10
10
  template = File.read(File.dirname(__FILE__) + '/charter_template.md')
11
11
  charter = File.new("#{@config['session_folder']}/#{name[0]}.md", "w+")
12
12
  charter.write(template)
13
13
  charter.close
14
-
14
+
15
15
  @config['current_session'] = "#{@config['session_folder']}/#{name[0]}.md"
16
-
17
- replace_text('<start_time>', Time.now.strftime("%m/%d/%Y %H:%M") + " \r\n")
16
+ @config['start_time'] = Time.now.strftime("%l:%M %P")
17
+
18
+ replace_text('<start_time>', @config['start_time'] + " \r\n")
18
19
  replace_text('<tester>', @config['tester'])
19
20
 
20
21
  write_config
21
22
  end
22
23
 
23
- def bug(text)
24
+ def add_bug(text, screenshot)
24
25
  replace_text('<defects>', "1. #{text} \r\n<defects>")
26
+ if screenshot
27
+ %x(screencapture -s "#{@config['session_folder']}/#{text}".jpg)
28
+ replace_text('<defects>', " - Screenshot Attached \r\n<defects>")
29
+ end
25
30
  end
26
31
 
27
- def scenario(text)
32
+ def add_scenario(text)
28
33
  replace_text('<scenarios>', "1. #{text} \r\n<scenarios>")
29
34
  end
30
35
 
31
- def env(text)
32
- replace_text("<environment>", text)
36
+ def set_env(text)
37
+ replace_text('<environment>', "1. #{text} \r\n<environment>")
33
38
  end
34
39
 
35
- def purpose(text)
36
- replace_text("<purpose>", text)
40
+ def set_purpose(text)
41
+ replace_text('<purpose>', text)
37
42
  end
38
43
 
39
- def finish
40
- replace_text('<end_time>', Time.now.strftime("%m/%d/%Y %H:%M"))
41
-
44
+ def finish_charter
45
+ @config['end_time'] = Time.now.strftime("%l:%M %P")
46
+ replace_text('<end_time>', @config['end_time'])
47
+
48
+ elapsed_time = (Time.parse(@config['end_time']) - Time.parse(@config['start_time']))/60
49
+
50
+ replace_text('<elapsed>',elapsed_time.to_i.to_s + ' minutes')
51
+
42
52
  aString = File.read(@config['current_session'])
53
+
43
54
  #remove remaining placeholders
44
55
  aString.gsub!(/\<(.*?)\>/, "")
56
+
45
57
  file = File.open(@config['current_session'], "w")
46
58
  file.puts aString
47
59
  file.close
48
60
  end
49
61
 
50
- def export(name)
62
+ def export_charter(name)
51
63
  renderer = Redcarpet::Render::HTML.new(render_options = {})
52
64
  markdown = Redcarpet::Markdown.new(renderer, extensions = {})
53
65
  text = File.read(@config['current_session'])
@@ -56,6 +68,7 @@ class Doc
56
68
  html_file.write(html_text)
57
69
  end
58
70
 
71
+ private
59
72
  def replace_text(find,replace)
60
73
  aString = File.read(@config['current_session'])
61
74
  aString.gsub!(find, replace)
@@ -64,16 +77,15 @@ class Doc
64
77
  file.close
65
78
  end
66
79
 
67
- private
68
80
  def read_config
69
81
  if File.exists? File.expand_path(SESSION_CONFIG)
70
82
  return YAML.load_file(File.expand_path(SESSION_CONFIG))
71
83
  else
72
84
  return {}
73
85
  end
74
- end
86
+ end
75
87
 
76
- def write_config
88
+ def write_config
77
89
  File.open(File.expand_path(SESSION_CONFIG), 'w') { |yf| YAML::dump(@config, yf) }
78
90
  end
79
91
  end
@@ -1,3 +1,3 @@
1
1
  module Charter
2
- VERSION = '0.0.5'
2
+ VERSION = '0.0.6'
3
3
  end
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: charter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Grossman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-01 00:00:00.000000000 Z
11
+ date: 2014-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rdoc
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: aruba
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
@@ -112,7 +112,6 @@ rdoc_options:
112
112
  - README.md
113
113
  - "--markup"
114
114
  - markdown
115
- - "-ri"
116
115
  require_paths:
117
116
  - lib
118
117
  - lib