tddium-preview 0.9.8 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/config/tddium.yml +4 -0
- data/features/account_command.feature +1 -3
- data/features/step_definitions/aruba_steps.rb +9 -0
- data/features/step_definitions/not_logged_in_steps.rb +7 -0
- data/features/step_definitions/suite_steps.rb +15 -0
- data/features/suite_command.feature +9 -63
- data/features/suite_command_tddium_yml.feature +129 -0
- data/features/support/aruba.rb +8 -1
- data/lib/tddium.rb +10 -90
- data/lib/tddium/commands/suite.rb +111 -1
- data/lib/tddium/constant.rb +36 -3
- data/lib/tddium/version.rb +1 -1
- metadata +110 -156
data/Gemfile.lock
CHANGED
data/config/tddium.yml
ADDED
@@ -38,9 +38,7 @@ Feature: Account command
|
|
38
38
|
|
39
39
|
Scenario: Fail if user isn't logged in
|
40
40
|
When I run `tddium account`
|
41
|
-
Then
|
42
|
-
And the output should contain "tddium login"
|
43
|
-
And the output should contain "tddium heroku"
|
41
|
+
Then it should fail with a login hint
|
44
42
|
|
45
43
|
Scenario: Add member to account successfully
|
46
44
|
Given the user is logged in
|
@@ -3,3 +3,12 @@
|
|
3
3
|
When /^the console session ends$/ do
|
4
4
|
@last_exit_status = @interactive.stop(true)
|
5
5
|
end
|
6
|
+
|
7
|
+
When /^the console session is killed$/ do
|
8
|
+
@interactive.kill(true)
|
9
|
+
@last_exit_status = -1
|
10
|
+
end
|
11
|
+
|
12
|
+
Then /^the output from "([^"]*)" should contain:$/ do |cmd, expected|
|
13
|
+
assert_partial_output(expected, output_from(cmd))
|
14
|
+
end
|
@@ -29,6 +29,12 @@ end
|
|
29
29
|
Given /^I choose defaults for test pattern, CI and campfire settings$/ do
|
30
30
|
steps %Q{
|
31
31
|
And I respond to "test pattern" with ""
|
32
|
+
And I choose defaults for CI and campfire settings
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
Given /^I choose defaults for CI and campfire settings$/ do
|
37
|
+
steps %Q{
|
32
38
|
And I respond to "URL to pull from" with "disable"
|
33
39
|
And I respond to "URL to push to" with "disable"
|
34
40
|
And I respond to "Campfire subdomain" with "disable"
|
@@ -36,3 +42,12 @@ Given /^I choose defaults for test pattern, CI and campfire settings$/ do
|
|
36
42
|
end
|
37
43
|
|
38
44
|
|
45
|
+
Given /^the user is logged in, and can successfully create a new suite in a git repo$/ do
|
46
|
+
steps %Q{
|
47
|
+
Given the destination repo exists
|
48
|
+
And a git repo is initialized on branch "test/foobar"
|
49
|
+
And the user is logged in
|
50
|
+
And the user has no suites
|
51
|
+
And the user can create a suite named "beta" on branch "test/foobar"
|
52
|
+
}
|
53
|
+
end
|
@@ -9,82 +9,28 @@ Feature: suite command
|
|
9
9
|
Background:
|
10
10
|
Given the command is "tddium suite"
|
11
11
|
|
12
|
-
Scenario:
|
13
|
-
|
14
|
-
|
15
|
-
And the user is logged in
|
16
|
-
And the user has no suites
|
17
|
-
And the user can create a suite named "beta" on branch "test/foobar"
|
18
|
-
When I run `tddium suite` interactively
|
19
|
-
Then the output from "tddium suite" should contain "Looks like"
|
20
|
-
And I respond to "repo name" with "beta"
|
21
|
-
Then the output from "tddium suite" should contain "Detected branch test/foobar"
|
22
|
-
When I choose defaults for test pattern, CI and campfire settings
|
23
|
-
Then the output from "tddium suite" should contain "Created suite..."
|
24
|
-
When the console session ends
|
25
|
-
Then the exit status should be 0
|
12
|
+
Scenario: Fail if the user is not logged in
|
13
|
+
When I run `tddium suite`
|
14
|
+
Then it should fail with a login hint
|
26
15
|
|
27
|
-
Scenario:
|
28
|
-
Given the
|
29
|
-
|
30
|
-
|
31
|
-
And the
|
32
|
-
And the user can create a suite named "beta" on branch "test/foobar"
|
33
|
-
And a file named "config/tddium.yml" with:
|
34
|
-
"""
|
35
|
-
---
|
36
|
-
:tddium:
|
37
|
-
:ruby_version: ruby-1.9.2-p290-psych
|
38
|
-
"""
|
39
|
-
When I run `tddium suite` interactively
|
40
|
-
Then the output from "tddium suite" should contain "Looks like"
|
41
|
-
And I respond to "repo name" with "beta"
|
42
|
-
Then the output from "tddium suite" should contain "Detected branch test/foobar"
|
43
|
-
Then the output from "tddium suite" should contain "Configured ruby ruby-1.9.2-p290-psych from tddium.yml"
|
44
|
-
When I choose defaults for test pattern, CI and campfire settings
|
45
|
-
Then the output from "tddium suite" should contain "Created suite..."
|
46
|
-
When the console session ends
|
47
|
-
Then the exit status should be 0
|
16
|
+
Scenario: Fail if CWD isn't in a git repo
|
17
|
+
Given the user is logged in
|
18
|
+
When I run `tddium suite`
|
19
|
+
Then the output should contain "git repo"
|
20
|
+
And the exit status should not be 0
|
48
21
|
|
49
|
-
Scenario: Configure new suite with
|
22
|
+
Scenario: Configure a new suite with a complex branch
|
50
23
|
Given the destination repo exists
|
51
24
|
And a git repo is initialized on branch "test/foobar"
|
52
25
|
And the user is logged in
|
53
26
|
And the user has no suites
|
54
27
|
And the user can create a suite named "beta" on branch "test/foobar"
|
55
|
-
And a file named "config/tddium.yml" with:
|
56
|
-
"""
|
57
|
-
---
|
58
|
-
:foo:
|
59
|
-
:ruby_version: ruby-1.9.2-p290-psych
|
60
|
-
"""
|
61
28
|
When I run `tddium suite` interactively
|
62
29
|
Then the output from "tddium suite" should contain "Looks like"
|
63
30
|
And I respond to "repo name" with "beta"
|
64
31
|
Then the output from "tddium suite" should contain "Detected branch test/foobar"
|
65
|
-
Then the output from "tddium suite" should not contain "Configured ruby ruby-1.9.2-p290-psych from tddium.yml"
|
66
|
-
Then the output from "tddium suite" should contain "Detected ruby"
|
67
32
|
When I choose defaults for test pattern, CI and campfire settings
|
68
33
|
Then the output from "tddium suite" should contain "Created suite..."
|
69
34
|
When the console session ends
|
70
35
|
Then the exit status should be 0
|
71
36
|
|
72
|
-
Scenario: Configure new suite with empty tddium.yml
|
73
|
-
Given the destination repo exists
|
74
|
-
And a git repo is initialized on branch "test/foobar"
|
75
|
-
And the user is logged in
|
76
|
-
And the user has no suites
|
77
|
-
And the user can create a suite named "beta" on branch "test/foobar"
|
78
|
-
And a file named "config/tddium.yml" with:
|
79
|
-
"""
|
80
|
-
"""
|
81
|
-
When I run `tddium suite` interactively
|
82
|
-
Then the output from "tddium suite" should contain "Looks like"
|
83
|
-
And I respond to "repo name" with "beta"
|
84
|
-
Then the output from "tddium suite" should contain "Detected branch test/foobar"
|
85
|
-
Then the output from "tddium suite" should not contain "Configured ruby ruby-1.9.2-p290-psych from tddium.yml"
|
86
|
-
Then the output from "tddium suite" should contain "Detected ruby"
|
87
|
-
When I choose defaults for test pattern, CI and campfire settings
|
88
|
-
Then the output from "tddium suite" should contain "Created suite..."
|
89
|
-
When the console session ends
|
90
|
-
Then the exit status should be 0
|
@@ -0,0 +1,129 @@
|
|
1
|
+
# Copyright (c) 2011 Solano Labs All Rights Reserved
|
2
|
+
|
3
|
+
@mimic
|
4
|
+
Feature: suite command
|
5
|
+
As a user
|
6
|
+
In order to interact with Tddium
|
7
|
+
I want to configure a test suite
|
8
|
+
|
9
|
+
Background:
|
10
|
+
Given the command is "tddium suite"
|
11
|
+
|
12
|
+
Scenario: Configure new suite with ruby from tddium.yml
|
13
|
+
Given the user is logged in, and can successfully create a new suite in a git repo
|
14
|
+
And a file named "config/tddium.yml" with:
|
15
|
+
"""
|
16
|
+
---
|
17
|
+
:tddium:
|
18
|
+
:ruby_version: ruby-1.9.2-p290-psych
|
19
|
+
"""
|
20
|
+
When I run `tddium suite` interactively
|
21
|
+
Then the output from "tddium suite" should contain "Looks like"
|
22
|
+
And I respond to "repo name" with "beta"
|
23
|
+
Then the output from "tddium suite" should contain "Detected branch test/foobar"
|
24
|
+
Then the output from "tddium suite" should contain "Configured ruby ruby-1.9.2-p290-psych from config/tddium.yml"
|
25
|
+
When I choose defaults for test pattern, CI and campfire settings
|
26
|
+
Then the output from "tddium suite" should contain "Created suite..."
|
27
|
+
When the console session ends
|
28
|
+
Then the exit status should be 0
|
29
|
+
|
30
|
+
Scenario: Configure new suite with tddium.yml without matching key
|
31
|
+
Given the user is logged in, and can successfully create a new suite in a git repo
|
32
|
+
And a file named "config/tddium.yml" with:
|
33
|
+
"""
|
34
|
+
---
|
35
|
+
:foo:
|
36
|
+
:ruby_version: ruby-1.9.2-p290-psych
|
37
|
+
"""
|
38
|
+
When I run `tddium suite` interactively
|
39
|
+
Then the output from "tddium suite" should contain "Looks like"
|
40
|
+
And I respond to "repo name" with "beta"
|
41
|
+
Then the output from "tddium suite" should contain "Detected branch test/foobar"
|
42
|
+
Then the output from "tddium suite" should not contain "Configured ruby ruby-1.9.2-p290-psych from config/tddium.yml"
|
43
|
+
Then the output from "tddium suite" should contain "Detected ruby"
|
44
|
+
When I choose defaults for test pattern, CI and campfire settings
|
45
|
+
Then the output from "tddium suite" should contain "Created suite..."
|
46
|
+
When the console session ends
|
47
|
+
Then the exit status should be 0
|
48
|
+
|
49
|
+
Scenario: Configure new suite with empty tddium.yml
|
50
|
+
Given the user is logged in, and can successfully create a new suite in a git repo
|
51
|
+
And a file named "config/tddium.yml" with:
|
52
|
+
"""
|
53
|
+
"""
|
54
|
+
When I run `tddium suite` interactively
|
55
|
+
Then the output from "tddium suite" should contain "Looks like"
|
56
|
+
And I respond to "repo name" with "beta"
|
57
|
+
Then the output from "tddium suite" should contain "Detected branch test/foobar"
|
58
|
+
Then the output from "tddium suite" should not contain "Configured ruby ruby-1.9.2-p290-psych from config/tddium.yml"
|
59
|
+
Then the output from "tddium suite" should contain "Detected ruby"
|
60
|
+
When I choose defaults for test pattern, CI and campfire settings
|
61
|
+
Then the output from "tddium suite" should contain "Created suite..."
|
62
|
+
When the console session ends
|
63
|
+
Then the exit status should be 0
|
64
|
+
|
65
|
+
Scenario: Non-YAML tddium.yml should generate a warning and then prompt
|
66
|
+
Given the user is logged in, and can successfully create a new suite in a git repo
|
67
|
+
And a file named "config/tddium.yml" with:
|
68
|
+
"""
|
69
|
+
---
|
70
|
+
:tddium:
|
71
|
+
:test_pattern:
|
72
|
+
- spec/controllers/**_spec.rb
|
73
|
+
+
|
74
|
+
"""
|
75
|
+
When I run `tddium suite` interactively
|
76
|
+
Then the output from "tddium suite" should contain "Looks like"
|
77
|
+
And I respond to "repo name" with "beta"
|
78
|
+
Then the output from "tddium suite" should not contain "Configured ruby ruby-1.9.2-p290-psych from config/tddium.yml"
|
79
|
+
Then the output from "tddium suite" should contain "Detected ruby"
|
80
|
+
When I choose defaults for test pattern, CI and campfire settings
|
81
|
+
Then the output from "tddium suite" should contain "Created suite..."
|
82
|
+
Then the stderr from "tddium suite" should contain "WARNING: Unable to parse"
|
83
|
+
When the console session ends
|
84
|
+
Then the exit status should be 0
|
85
|
+
|
86
|
+
Scenario: Configure new suite with test pattern from tddium.yml
|
87
|
+
Given the user is logged in, and can successfully create a new suite in a git repo
|
88
|
+
And a file named "config/tddium.yml" with:
|
89
|
+
"""
|
90
|
+
---
|
91
|
+
:tddium:
|
92
|
+
:test_pattern:
|
93
|
+
- spec/controllers/**_spec.rb
|
94
|
+
- features/api/**.feature
|
95
|
+
- test/unit/**_test.rb
|
96
|
+
"""
|
97
|
+
When I run `tddium suite` interactively
|
98
|
+
Then the output from "tddium suite" should contain "Looks like"
|
99
|
+
And I respond to "repo name" with "beta"
|
100
|
+
Then the output from "tddium suite" should contain "Detected branch test/foobar"
|
101
|
+
And the output from "tddium suite" should contain "Detected ruby"
|
102
|
+
And the output from "tddium suite" should contain "Configured test pattern from config/tddium.yml:"
|
103
|
+
And the output from "tddium suite" should contain:
|
104
|
+
"""
|
105
|
+
- spec/controllers/**_spec.rb
|
106
|
+
- features/api/**.feature
|
107
|
+
- test/unit/**_test.rb
|
108
|
+
"""
|
109
|
+
When I choose defaults for CI and campfire settings
|
110
|
+
Then the output from "tddium suite" should contain "Created suite..."
|
111
|
+
When the console session ends
|
112
|
+
Then the exit status should be 0
|
113
|
+
|
114
|
+
Scenario: Exit with error if config/tddium.yml contains the wrong type
|
115
|
+
Given the user is logged in, and can successfully create a new suite in a git repo
|
116
|
+
And a file named "config/tddium.yml" with:
|
117
|
+
"""
|
118
|
+
---
|
119
|
+
:tddium:
|
120
|
+
:test_pattern:
|
121
|
+
:this: is
|
122
|
+
:not: a list
|
123
|
+
"""
|
124
|
+
When I run `tddium suite` interactively
|
125
|
+
Then the output from "tddium suite" should contain "Looks like"
|
126
|
+
And I respond to "repo name" with "beta"
|
127
|
+
And the output from "tddium suite" should contain "not properly formatted"
|
128
|
+
When the console session ends
|
129
|
+
Then the exit status should not be 0
|
data/features/support/aruba.rb
CHANGED
@@ -1,8 +1,15 @@
|
|
1
1
|
# Copyright (c) 2011 Solano Labs All Rights Reserved
|
2
2
|
|
3
|
+
class Aruba::Process
|
4
|
+
def kill(keep_ansi)
|
5
|
+
stdout(keep_ansi) && stderr(keep_ansi) # flush output
|
6
|
+
@process.stop
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
3
10
|
Before do
|
4
11
|
@aruba_timeout_seconds = 10
|
5
|
-
@aruba_io_wait_seconds =
|
12
|
+
@aruba_io_wait_seconds = 1.3
|
6
13
|
@dirs = [Dir.tmpdir, "tddium-aruba"]
|
7
14
|
FileUtils.rm_rf(current_dir)
|
8
15
|
end
|
data/lib/tddium.rb
CHANGED
@@ -110,20 +110,6 @@ class Tddium < Thor
|
|
110
110
|
end
|
111
111
|
end
|
112
112
|
|
113
|
-
def tool_version(tool)
|
114
|
-
key = "#{tool}_version".to_sym
|
115
|
-
result = tddium_config[key]
|
116
|
-
|
117
|
-
if result
|
118
|
-
say Text::Process::CONFIGURED_VERSION % [tool, result]
|
119
|
-
return result
|
120
|
-
end
|
121
|
-
|
122
|
-
result = `#{tool} -v`.strip
|
123
|
-
say Text::Process::DEPENDENCY_VERSION % [tool, result]
|
124
|
-
result
|
125
|
-
end
|
126
|
-
|
127
113
|
def current_git_branch
|
128
114
|
@current_git_branch ||= `git symbolic-ref HEAD`.gsub("\n", "").split("/")[2..-1].join("/")
|
129
115
|
end
|
@@ -296,80 +282,6 @@ class Tddium < Thor
|
|
296
282
|
data
|
297
283
|
end
|
298
284
|
|
299
|
-
def prompt_suite_params(options, params, current={})
|
300
|
-
say Text::Process::DETECTED_BRANCH % params[:branch] if params[:branch]
|
301
|
-
params[:ruby_version] = tool_version(:ruby)
|
302
|
-
params[:bundler_version] = tool_version(:bundle)
|
303
|
-
params[:rubygems_version] = tool_version(:gem)
|
304
|
-
|
305
|
-
ask_or_update = lambda do |key, text, default|
|
306
|
-
params[key] = prompt(text, options[key], current.fetch(key.to_s, default))
|
307
|
-
end
|
308
|
-
|
309
|
-
ask_or_update.call(:test_pattern, Text::Prompt::TEST_PATTERN, Default::SUITE_TEST_PATTERN)
|
310
|
-
|
311
|
-
if current.size > 0 && current['ci_pull_url']
|
312
|
-
say(Text::Process::SETUP_CI_EDIT)
|
313
|
-
else
|
314
|
-
say(Text::Process::SETUP_CI_FIRST_TIME % params[:test_pattern])
|
315
|
-
end
|
316
|
-
|
317
|
-
ask_or_update.call(:ci_pull_url, Text::Prompt::CI_PULL_URL, git_origin_url)
|
318
|
-
ask_or_update.call(:ci_push_url, Text::Prompt::CI_PUSH_URL, nil)
|
319
|
-
|
320
|
-
if current.size > 0 && current['campfire_room']
|
321
|
-
say(Text::Process::SETUP_CAMPFIRE_EDIT)
|
322
|
-
else
|
323
|
-
say(Text::Process::SETUP_CAMPFIRE_FIRST_TIME)
|
324
|
-
end
|
325
|
-
|
326
|
-
subdomain = ask_or_update.call(:campfire_subdomain, Text::Prompt::CAMPFIRE_SUBDOMAIN, nil)
|
327
|
-
if !subdomain.nil? && subdomain != 'disable' then
|
328
|
-
ask_or_update.call(:campfire_token, Text::Prompt::CAMPFIRE_TOKEN, nil)
|
329
|
-
ask_or_update.call(:campfire_room, Text::Prompt::CAMPFIRE_ROOM, nil)
|
330
|
-
end
|
331
|
-
end
|
332
|
-
|
333
|
-
def update_suite(suite, options)
|
334
|
-
params = {}
|
335
|
-
prompt_suite_params(options, params, suite)
|
336
|
-
call_api(:put, "#{Api::Path::SUITES}/#{suite['id']}", params)
|
337
|
-
say Text::Process::UPDATED_SUITE
|
338
|
-
end
|
339
|
-
|
340
|
-
def resolve_suite_name(options, params, default_suite_name)
|
341
|
-
# XXX updates params
|
342
|
-
existing_suite = nil
|
343
|
-
use_existing_suite = false
|
344
|
-
suite_name_resolved = false
|
345
|
-
while !suite_name_resolved
|
346
|
-
# Check to see if there is an existing suite
|
347
|
-
current_suites = call_api(:get, Api::Path::SUITES, params)
|
348
|
-
existing_suite = current_suites["suites"].first
|
349
|
-
|
350
|
-
# Get the suite name
|
351
|
-
current_suite_name = params[:repo_name]
|
352
|
-
if existing_suite
|
353
|
-
# Prompt for using existing suite (unless suite name is passed from command line) or entering new one
|
354
|
-
params[:repo_name] = prompt(Text::Prompt::USE_EXISTING_SUITE % params[:branch], options[:name], current_suite_name)
|
355
|
-
if options[:name] || params[:repo_name] == Text::Prompt::Response::YES
|
356
|
-
# Use the existing suite, so assign the value back and exit the loop
|
357
|
-
params[:repo_name] = current_suite_name
|
358
|
-
use_existing_suite = true
|
359
|
-
suite_name_resolved = true
|
360
|
-
end
|
361
|
-
elsif current_suite_name == default_suite_name
|
362
|
-
# Prompt for using default suite name or entering new one
|
363
|
-
params[:repo_name] = prompt(Text::Prompt::SUITE_NAME, options[:name], current_suite_name)
|
364
|
-
suite_name_resolved = true if params[:repo_name] == default_suite_name
|
365
|
-
else
|
366
|
-
# Suite name does not exist yet and already prompted
|
367
|
-
suite_name_resolved = true
|
368
|
-
end
|
369
|
-
end
|
370
|
-
[use_existing_suite, existing_suite]
|
371
|
-
end
|
372
|
-
|
373
285
|
def set_shell
|
374
286
|
if !$stdout.tty? || !$stderr.tty? then
|
375
287
|
@shell = Thor::Shell::Basic.new
|
@@ -447,12 +359,20 @@ class Tddium < Thor
|
|
447
359
|
end
|
448
360
|
|
449
361
|
def tddium_config
|
450
|
-
|
362
|
+
return @tddium_yml if @tddium_yml
|
363
|
+
|
364
|
+
config = begin
|
365
|
+
YAML.load(File.read(Config::CONFIG_PATH))
|
366
|
+
rescue
|
367
|
+
warn(Text::Warning::YAML_PARSE_FAILED % Config::CONFIG_PATH)
|
368
|
+
{}
|
369
|
+
end
|
451
370
|
return {} unless config.is_a?(Hash)
|
452
371
|
|
453
372
|
config = config[:tddium] || config['tddium']
|
454
373
|
config ||= {}
|
455
|
-
config
|
374
|
+
@tddium_yml = config
|
375
|
+
@tddium_yml
|
456
376
|
end
|
457
377
|
|
458
378
|
def tddium_file_name
|
@@ -13,7 +13,7 @@ class Tddium
|
|
13
13
|
def suite
|
14
14
|
set_default_environment
|
15
15
|
git_version_ok
|
16
|
-
|
16
|
+
exit_failure unless tddium_settings && git_repo?
|
17
17
|
|
18
18
|
params = {}
|
19
19
|
begin
|
@@ -59,4 +59,114 @@ class Tddium
|
|
59
59
|
exit_failure
|
60
60
|
end
|
61
61
|
end
|
62
|
+
|
63
|
+
private
|
64
|
+
|
65
|
+
def tool_version(tool)
|
66
|
+
key = "#{tool}_version".to_sym
|
67
|
+
result = tddium_config[key]
|
68
|
+
|
69
|
+
if result
|
70
|
+
say Text::Process::CONFIGURED_VERSION % [tool, result]
|
71
|
+
return result
|
72
|
+
end
|
73
|
+
|
74
|
+
result = `#{tool} -v`.strip
|
75
|
+
say Text::Process::DEPENDENCY_VERSION % [tool, result]
|
76
|
+
result
|
77
|
+
end
|
78
|
+
|
79
|
+
def configured_test_pattern
|
80
|
+
pattern = tddium_config[:test_pattern] || tddium_config['test_pattern']
|
81
|
+
|
82
|
+
return nil if pattern.nil? || pattern.empty?
|
83
|
+
|
84
|
+
return pattern
|
85
|
+
end
|
86
|
+
|
87
|
+
def prompt_suite_params(options, params, current={})
|
88
|
+
say Text::Process::DETECTED_BRANCH % params[:branch] if params[:branch]
|
89
|
+
params[:ruby_version] = tool_version(:ruby)
|
90
|
+
params[:bundler_version] = tool_version(:bundle)
|
91
|
+
params[:rubygems_version] = tool_version(:gem)
|
92
|
+
|
93
|
+
ask_or_update = lambda do |key, text, default|
|
94
|
+
params[key] = prompt(text, options[key], current.fetch(key.to_s, default))
|
95
|
+
end
|
96
|
+
|
97
|
+
pattern = configured_test_pattern
|
98
|
+
|
99
|
+
if pattern.is_a?(Array)
|
100
|
+
say Text::Process::CONFIGURED_PATTERN % pattern.map{|p| " - #{p}"}.join("\n")
|
101
|
+
params[:test_pattern] = pattern.join(",")
|
102
|
+
elsif pattern
|
103
|
+
exit_failure Text::Error::INVALID_CONFIGURED_PATTERN % pattern.inspect
|
104
|
+
else
|
105
|
+
say Text::Process::TEST_PATTERN_INSTRUCTIONS
|
106
|
+
ask_or_update.call(:test_pattern, Text::Prompt::TEST_PATTERN, Default::SUITE_TEST_PATTERN)
|
107
|
+
end
|
108
|
+
|
109
|
+
|
110
|
+
if current.size > 0 && current['ci_pull_url']
|
111
|
+
say(Text::Process::SETUP_CI_EDIT)
|
112
|
+
else
|
113
|
+
say(Text::Process::SETUP_CI_FIRST_TIME)
|
114
|
+
end
|
115
|
+
|
116
|
+
ask_or_update.call(:ci_pull_url, Text::Prompt::CI_PULL_URL, git_origin_url)
|
117
|
+
ask_or_update.call(:ci_push_url, Text::Prompt::CI_PUSH_URL, nil)
|
118
|
+
|
119
|
+
if current.size > 0 && current['campfire_room']
|
120
|
+
say(Text::Process::SETUP_CAMPFIRE_EDIT)
|
121
|
+
else
|
122
|
+
say(Text::Process::SETUP_CAMPFIRE_FIRST_TIME)
|
123
|
+
end
|
124
|
+
|
125
|
+
subdomain = ask_or_update.call(:campfire_subdomain, Text::Prompt::CAMPFIRE_SUBDOMAIN, nil)
|
126
|
+
if !subdomain.nil? && subdomain != 'disable' then
|
127
|
+
ask_or_update.call(:campfire_token, Text::Prompt::CAMPFIRE_TOKEN, nil)
|
128
|
+
ask_or_update.call(:campfire_room, Text::Prompt::CAMPFIRE_ROOM, nil)
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
def update_suite(suite, options)
|
133
|
+
params = {}
|
134
|
+
prompt_suite_params(options, params, suite)
|
135
|
+
call_api(:put, "#{Api::Path::SUITES}/#{suite['id']}", params)
|
136
|
+
say Text::Process::UPDATED_SUITE
|
137
|
+
end
|
138
|
+
|
139
|
+
def resolve_suite_name(options, params, default_suite_name)
|
140
|
+
# XXX updates params
|
141
|
+
existing_suite = nil
|
142
|
+
use_existing_suite = false
|
143
|
+
suite_name_resolved = false
|
144
|
+
while !suite_name_resolved
|
145
|
+
# Check to see if there is an existing suite
|
146
|
+
current_suites = call_api(:get, Api::Path::SUITES, params)
|
147
|
+
existing_suite = current_suites["suites"].first
|
148
|
+
|
149
|
+
# Get the suite name
|
150
|
+
current_suite_name = params[:repo_name]
|
151
|
+
if existing_suite
|
152
|
+
# Prompt for using existing suite (unless suite name is passed from command line) or entering new one
|
153
|
+
params[:repo_name] = prompt(Text::Prompt::USE_EXISTING_SUITE % params[:branch], options[:name], current_suite_name)
|
154
|
+
if options[:name] || params[:repo_name] == Text::Prompt::Response::YES
|
155
|
+
# Use the existing suite, so assign the value back and exit the loop
|
156
|
+
params[:repo_name] = current_suite_name
|
157
|
+
use_existing_suite = true
|
158
|
+
suite_name_resolved = true
|
159
|
+
end
|
160
|
+
elsif current_suite_name == default_suite_name
|
161
|
+
# Prompt for using default suite name or entering new one
|
162
|
+
params[:repo_name] = prompt(Text::Prompt::SUITE_NAME, options[:name], current_suite_name)
|
163
|
+
suite_name_resolved = true if params[:repo_name] == default_suite_name
|
164
|
+
else
|
165
|
+
# Suite name does not exist yet and already prompted
|
166
|
+
suite_name_resolved = true
|
167
|
+
end
|
168
|
+
end
|
169
|
+
[use_existing_suite, existing_suite]
|
170
|
+
end
|
171
|
+
|
62
172
|
end
|
data/lib/tddium/constant.rb
CHANGED
@@ -64,7 +64,7 @@ module TddiumConstant
|
|
64
64
|
PASSWORD_CONFIRMATION = "Confirm your password: "
|
65
65
|
INVITATION_TOKEN = "Enter your invitation token:"
|
66
66
|
USE_EXISTING_SUITE = "A suite exists '%%s' (branch %s). Enter '#{Response::YES}' to use it, or enter a new repo name:"
|
67
|
-
TEST_PATTERN = "Enter a
|
67
|
+
TEST_PATTERN = "Enter a pattern or press 'Return'. Using '%s' by default:"
|
68
68
|
CI_PULL_URL = "Enter git URL to pull from (default '%s') or enter 'disable':"
|
69
69
|
CI_PUSH_URL = "Enter git URL to push to (default '%s') or enter 'disable':"
|
70
70
|
CAMPFIRE_SUBDOMAIN = "Enter your Campfire subdomain (default '%s') or enter 'disable':"
|
@@ -76,9 +76,20 @@ module TddiumConstant
|
|
76
76
|
GIT_VERSION = "Unsupported git version: %s"
|
77
77
|
GIT_CHANGES_NOT_COMMITTED = "There are uncommitted changes in the local git repository"
|
78
78
|
GIT_UNABLE_TO_DETECT = "Unable to detect uncommitted git changes"
|
79
|
+
YAML_PARSE_FAILED = "Unable to parse %s as YAML"
|
79
80
|
end
|
80
81
|
|
81
82
|
module Process
|
83
|
+
TEST_PATTERN_INSTRUCTIONS =<<EOF
|
84
|
+
|
85
|
+
>>> Tddium selects tests to run by default (e.g., in CI) by matching against a
|
86
|
+
list of Ruby glob patterns. Use "," to join multiple globs.
|
87
|
+
|
88
|
+
You can instead specify a test pattern Array in config/tddium.yml.
|
89
|
+
|
90
|
+
Read more here: https://www.tddium.com/support/reference#customization
|
91
|
+
|
92
|
+
EOF
|
82
93
|
NO_CONFIGURED_SUITE = "Looks like you haven't set up a suite on this computer for %s/%s..."
|
83
94
|
TERMINATE_INSTRUCTION = "Press Ctrl-C to stop waiting. Tests will continue running."
|
84
95
|
INTERRUPT = "Interrupted"
|
@@ -143,7 +154,17 @@ with Tddium.
|
|
143
154
|
"
|
144
155
|
UPDATED_SUITE = "Updated suite successfully."
|
145
156
|
DEPENDENCY_VERSION = "Detected %s %s"
|
146
|
-
CONFIGURED_VERSION = "Configured %s %s from tddium.yml"
|
157
|
+
CONFIGURED_VERSION = "Configured %s %s from config/tddium.yml"
|
158
|
+
CONFIGURED_PATTERN =<<EOF;
|
159
|
+
Configured test pattern from config/tddium.yml:
|
160
|
+
|
161
|
+
%s
|
162
|
+
|
163
|
+
>>> To change the pattern:
|
164
|
+
1. Edit config/tddium.yml
|
165
|
+
2. Run `tddium suite --edit` again.
|
166
|
+
|
167
|
+
EOF
|
147
168
|
DETECTED_BRANCH = "Detected branch %s"
|
148
169
|
SETUP_CI_FIRST_TIME =<<EOF;
|
149
170
|
|
@@ -151,7 +172,7 @@ Tddium includes a Hosted Continuous Integration srvice that will run a
|
|
151
172
|
CI build when it's triggered by a POST:
|
152
173
|
|
153
174
|
1. Pull from your git server
|
154
|
-
2. Run tests that match the test pattern for this suite
|
175
|
+
2. Run tests that match the test pattern you saved for this suite
|
155
176
|
3. Notify you by email and/or campfire
|
156
177
|
4. Optionally, Tddium CI will then push to a git server (push to URL). For
|
157
178
|
example, enter the git URL to your Heroku staging app.
|
@@ -304,6 +325,18 @@ EOF
|
|
304
325
|
end
|
305
326
|
|
306
327
|
module Error
|
328
|
+
INVALID_CONFIGURED_PATTERN =<<EOF;
|
329
|
+
Configuring test pattern from config/tddium.yml...
|
330
|
+
|
331
|
+
>>> The test_pattern in config/tddium.yml is not properly formatted. It must be a YAML list.
|
332
|
+
|
333
|
+
You entered:
|
334
|
+
|
335
|
+
%s
|
336
|
+
|
337
|
+
>>> Edit config/tddium.yml and rerun `tddium suite --edit`
|
338
|
+
|
339
|
+
EOF
|
307
340
|
GIT_REPO_NOT_READY = "Your git repository is being prepped. Try again in a minute."
|
308
341
|
GIT_PUSH_FAILED = <<EOF;
|
309
342
|
|
data/lib/tddium/version.rb
CHANGED
metadata
CHANGED
@@ -1,186 +1,148 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: tddium-preview
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.10.0
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 9
|
9
|
-
- 8
|
10
|
-
version: 0.9.8
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Solano Labs
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-10-18 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
22
15
|
name: thor
|
23
|
-
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &14172440 !ruby/object:Gem::Requirement
|
25
17
|
none: false
|
26
|
-
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
segments:
|
31
|
-
- 0
|
32
|
-
version: "0"
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
33
22
|
type: :runtime
|
34
|
-
version_requirements: *id001
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
name: highline
|
37
23
|
prerelease: false
|
38
|
-
|
24
|
+
version_requirements: *14172440
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: highline
|
27
|
+
requirement: &14171680 !ruby/object:Gem::Requirement
|
39
28
|
none: false
|
40
|
-
requirements:
|
41
|
-
- -
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
|
44
|
-
segments:
|
45
|
-
- 0
|
46
|
-
version: "0"
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
47
33
|
type: :runtime
|
48
|
-
version_requirements: *id002
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
name: json
|
51
34
|
prerelease: false
|
52
|
-
|
35
|
+
version_requirements: *14171680
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: json
|
38
|
+
requirement: &14170980 !ruby/object:Gem::Requirement
|
53
39
|
none: false
|
54
|
-
requirements:
|
55
|
-
- -
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
|
58
|
-
segments:
|
59
|
-
- 0
|
60
|
-
version: "0"
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
61
44
|
type: :runtime
|
62
|
-
version_requirements: *id003
|
63
|
-
- !ruby/object:Gem::Dependency
|
64
|
-
name: tddium_client
|
65
45
|
prerelease: false
|
66
|
-
|
46
|
+
version_requirements: *14170980
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: tddium_client
|
49
|
+
requirement: &14170100 !ruby/object:Gem::Requirement
|
67
50
|
none: false
|
68
|
-
requirements:
|
51
|
+
requirements:
|
69
52
|
- - ~>
|
70
|
-
- !ruby/object:Gem::Version
|
71
|
-
hash: 25
|
72
|
-
segments:
|
73
|
-
- 0
|
74
|
-
- 1
|
75
|
-
- 1
|
53
|
+
- !ruby/object:Gem::Version
|
76
54
|
version: 0.1.1
|
77
55
|
type: :runtime
|
78
|
-
version_requirements: *id004
|
79
|
-
- !ruby/object:Gem::Dependency
|
80
|
-
name: tddium_reporting
|
81
56
|
prerelease: false
|
82
|
-
|
57
|
+
version_requirements: *14170100
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: tddium_reporting
|
60
|
+
requirement: &14169480 !ruby/object:Gem::Requirement
|
83
61
|
none: false
|
84
|
-
requirements:
|
85
|
-
- -
|
86
|
-
- !ruby/object:Gem::Version
|
87
|
-
hash: 19
|
88
|
-
segments:
|
89
|
-
- 0
|
90
|
-
- 0
|
91
|
-
- 6
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
92
65
|
version: 0.0.6
|
93
66
|
type: :runtime
|
94
|
-
version_requirements: *id005
|
95
|
-
- !ruby/object:Gem::Dependency
|
96
|
-
name: bundler
|
97
67
|
prerelease: false
|
98
|
-
|
68
|
+
version_requirements: *14169480
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: bundler
|
71
|
+
requirement: &14169040 !ruby/object:Gem::Requirement
|
99
72
|
none: false
|
100
|
-
requirements:
|
101
|
-
- -
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
|
104
|
-
segments:
|
105
|
-
- 0
|
106
|
-
version: "0"
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
107
77
|
type: :runtime
|
108
|
-
version_requirements: *id006
|
109
|
-
- !ruby/object:Gem::Dependency
|
110
|
-
name: rspec
|
111
78
|
prerelease: false
|
112
|
-
|
79
|
+
version_requirements: *14169040
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: rspec
|
82
|
+
requirement: &14168460 !ruby/object:Gem::Requirement
|
113
83
|
none: false
|
114
|
-
requirements:
|
115
|
-
- -
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
|
118
|
-
segments:
|
119
|
-
- 0
|
120
|
-
version: "0"
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
121
88
|
type: :development
|
122
|
-
version_requirements: *id007
|
123
|
-
- !ruby/object:Gem::Dependency
|
124
|
-
name: fakefs
|
125
89
|
prerelease: false
|
126
|
-
|
90
|
+
version_requirements: *14168460
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: fakefs
|
93
|
+
requirement: &14167740 !ruby/object:Gem::Requirement
|
127
94
|
none: false
|
128
|
-
requirements:
|
129
|
-
- -
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
|
132
|
-
segments:
|
133
|
-
- 0
|
134
|
-
version: "0"
|
95
|
+
requirements:
|
96
|
+
- - ! '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
135
99
|
type: :development
|
136
|
-
version_requirements: *id008
|
137
|
-
- !ruby/object:Gem::Dependency
|
138
|
-
name: simplecov
|
139
100
|
prerelease: false
|
140
|
-
|
101
|
+
version_requirements: *14167740
|
102
|
+
- !ruby/object:Gem::Dependency
|
103
|
+
name: simplecov
|
104
|
+
requirement: &14167000 !ruby/object:Gem::Requirement
|
141
105
|
none: false
|
142
|
-
requirements:
|
143
|
-
- -
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
|
146
|
-
segments:
|
147
|
-
- 0
|
148
|
-
version: "0"
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
149
110
|
type: :development
|
150
|
-
version_requirements: *id009
|
151
|
-
- !ruby/object:Gem::Dependency
|
152
|
-
name: rake
|
153
111
|
prerelease: false
|
154
|
-
|
112
|
+
version_requirements: *14167000
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
name: rake
|
115
|
+
requirement: &14166320 !ruby/object:Gem::Requirement
|
155
116
|
none: false
|
156
|
-
requirements:
|
157
|
-
- -
|
158
|
-
- !ruby/object:Gem::Version
|
159
|
-
|
160
|
-
segments:
|
161
|
-
- 0
|
162
|
-
version: "0"
|
117
|
+
requirements:
|
118
|
+
- - ! '>='
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
163
121
|
type: :development
|
164
|
-
|
165
|
-
|
166
|
-
|
122
|
+
prerelease: false
|
123
|
+
version_requirements: *14166320
|
124
|
+
description: ! 'tddium runs your rspec, cucumber, and test::unit tests in our managed
|
125
|
+
|
167
126
|
cloud environment. You can run tests by hand, or enable our hosted CI to watch
|
127
|
+
|
168
128
|
your git repos automatically.
|
169
|
-
|
129
|
+
|
130
|
+
|
170
131
|
Tests run in parallel to save you time, and, if you use Rails, tddium takes care
|
132
|
+
|
171
133
|
of setting up fresh isolated DB instances for each test instance.
|
172
|
-
|
134
|
+
|
135
|
+
|
173
136
|
Tests can access a limited set of private Selenium RC servers.
|
174
137
|
|
175
|
-
|
138
|
+
'
|
139
|
+
email:
|
176
140
|
- info@tddium.com
|
177
|
-
executables:
|
141
|
+
executables:
|
178
142
|
- tddium
|
179
143
|
extensions: []
|
180
|
-
|
181
144
|
extra_rdoc_files: []
|
182
|
-
|
183
|
-
files:
|
145
|
+
files:
|
184
146
|
- .document
|
185
147
|
- .gitignore
|
186
148
|
- CHANGELOG
|
@@ -190,6 +152,7 @@ files:
|
|
190
152
|
- README.rdoc
|
191
153
|
- Rakefile
|
192
154
|
- bin/tddium
|
155
|
+
- config/tddium.yml
|
193
156
|
- features/account_command.feature
|
194
157
|
- features/activate_command.feature
|
195
158
|
- features/heroku_command.feature
|
@@ -204,11 +167,13 @@ files:
|
|
204
167
|
- features/step_definitions/git_steps.rb
|
205
168
|
- features/step_definitions/login_steps.rb
|
206
169
|
- features/step_definitions/mimic_steps.rb
|
170
|
+
- features/step_definitions/not_logged_in_steps.rb
|
207
171
|
- features/step_definitions/password_steps.rb
|
208
172
|
- features/step_definitions/session_steps.rb
|
209
173
|
- features/step_definitions/suite_steps.rb
|
210
174
|
- features/step_definitions/upgrade_steps.rb
|
211
175
|
- features/suite_command.feature
|
176
|
+
- features/suite_command_tddium_yml.feature
|
212
177
|
- features/support/aruba.rb
|
213
178
|
- features/support/constants.rb
|
214
179
|
- features/support/env.rb
|
@@ -231,39 +196,28 @@ files:
|
|
231
196
|
- spec/spec_helper.rb
|
232
197
|
- spec/tddium_oldspec.rb
|
233
198
|
- tddium.gemspec
|
234
|
-
has_rdoc: true
|
235
199
|
homepage: http://www.tddium.com/
|
236
200
|
licenses: []
|
237
|
-
|
238
201
|
post_install_message:
|
239
202
|
rdoc_options: []
|
240
|
-
|
241
|
-
require_paths:
|
203
|
+
require_paths:
|
242
204
|
- lib
|
243
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
205
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
244
206
|
none: false
|
245
|
-
requirements:
|
246
|
-
- -
|
247
|
-
- !ruby/object:Gem::Version
|
248
|
-
|
249
|
-
|
250
|
-
- 0
|
251
|
-
version: "0"
|
252
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
207
|
+
requirements:
|
208
|
+
- - ! '>='
|
209
|
+
- !ruby/object:Gem::Version
|
210
|
+
version: '0'
|
211
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
253
212
|
none: false
|
254
|
-
requirements:
|
255
|
-
- -
|
256
|
-
- !ruby/object:Gem::Version
|
257
|
-
|
258
|
-
segments:
|
259
|
-
- 0
|
260
|
-
version: "0"
|
213
|
+
requirements:
|
214
|
+
- - ! '>='
|
215
|
+
- !ruby/object:Gem::Version
|
216
|
+
version: '0'
|
261
217
|
requirements: []
|
262
|
-
|
263
218
|
rubyforge_project: tddium
|
264
|
-
rubygems_version: 1.
|
219
|
+
rubygems_version: 1.8.10
|
265
220
|
signing_key:
|
266
221
|
specification_version: 3
|
267
222
|
summary: tddium Hosted Ruby Testing
|
268
223
|
test_files: []
|
269
|
-
|