taketo 0.0.10 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. data/Gemfile +1 -1
  2. data/Gemfile.lock +14 -30
  3. data/README.md +4 -0
  4. data/Rakefile +4 -8
  5. data/VERSION +1 -1
  6. data/bin/taketo +5 -5
  7. data/lib/taketo/config_printer_visitor.rb +6 -22
  8. data/lib/taketo/config_traverser.rb +4 -33
  9. data/lib/taketo/config_validator.rb +1 -1
  10. data/lib/taketo/config_visitor.rb +15 -1
  11. data/lib/taketo/constructs/base_construct.rb +30 -6
  12. data/lib/taketo/constructs/config.rb +5 -0
  13. data/lib/taketo/constructs/environment.rb +6 -3
  14. data/lib/taketo/constructs/project.rb +3 -3
  15. data/lib/taketo/constructs/server.rb +3 -4
  16. data/lib/taketo/constructs.rb +6 -1
  17. data/lib/taketo/destination_resolver.rb +37 -52
  18. data/lib/taketo/dsl.rb +6 -3
  19. data/lib/taketo/printer.rb +29 -0
  20. data/lib/taketo/ssh_config_generator_visitor.rb +8 -22
  21. data/spec/acceptance/command_spec.rb +20 -0
  22. data/spec/acceptance/config_dsl_spec.rb +277 -0
  23. data/spec/acceptance/config_validation_spec.rb +109 -0
  24. data/spec/acceptance/connect_to_server_spec.rb +60 -0
  25. data/spec/acceptance/error_handling_spec.rb +31 -0
  26. data/spec/acceptance/generate_ssh_config_spec.rb +44 -0
  27. data/spec/acceptance/help_spec.rb +74 -0
  28. data/spec/acceptance/location_spec.rb +21 -0
  29. data/spec/acceptance_spec_helper.rb +71 -0
  30. data/spec/lib/taketo/config_traverser_spec.rb +20 -33
  31. data/spec/lib/taketo/config_validator_spec.rb +4 -4
  32. data/spec/lib/taketo/config_visitor_spec.rb +0 -4
  33. data/spec/lib/taketo/constructs/base_construct_spec.rb +37 -5
  34. data/spec/lib/taketo/constructs/environment_spec.rb +1 -1
  35. data/spec/lib/taketo/constructs/project_spec.rb +0 -6
  36. data/spec/lib/taketo/constructs/server_spec.rb +1 -3
  37. data/spec/lib/taketo/destination_resolver_spec.rb +21 -54
  38. data/spec/lib/taketo/dsl_spec.rb +46 -44
  39. data/spec/spec_helper.rb +1 -1
  40. data/spec/support/helpers/construct_spec_helper.rb +29 -0
  41. metadata +94 -82
  42. data/features/commands.feature +0 -36
  43. data/features/config.feature +0 -177
  44. data/features/config_validation.feature +0 -43
  45. data/features/connect_to_server.feature +0 -87
  46. data/features/default_server_config.feature +0 -41
  47. data/features/error_handling.feature +0 -29
  48. data/features/generate_ssh_config.feature +0 -44
  49. data/features/help.feature +0 -76
  50. data/features/step_definitions/main_steps.rb +0 -16
  51. data/features/support/env.rb +0 -14
@@ -1,44 +0,0 @@
1
- Feature:
2
- In order to eliminate duplication between taketo config and ssh config
3
- As a user
4
- I want to be able to convert taketo config to ssh config
5
-
6
- Background:
7
- When I have the following config
8
- """
9
- project :foo do
10
- environment :bar do
11
- server do
12
- host "bar.foo.com"
13
- port 5678
14
- user "pivo"
15
- identity_file "~/.ssh/id_rsa"
16
- end
17
- end
18
- end
19
-
20
- project :baz do
21
- environment :qux do
22
- server :bart do
23
- global_alias :bazqux
24
- host "2.3.4.5"
25
- end
26
- end
27
- end
28
- """
29
-
30
- Scenario: Generate ssh config
31
- When I run taketo --generate-ssh-config
32
- Then the output should contain exactly:
33
- """
34
- Host bar.foo.com
35
- Hostname bar.foo.com
36
- Port 5678
37
- User pivo
38
- IdentityFile ~/.ssh/id_rsa
39
-
40
- Host bazqux
41
- Hostname 2.3.4.5
42
-
43
- """
44
-
@@ -1,76 +0,0 @@
1
- Feature:
2
- In order to be able to use the tool effectively
3
- As a user
4
- I want to view what's set up in config quickly
5
-
6
- Background:
7
- When I have the following config
8
- """
9
- project :foo do
10
- environment :bar do
11
- server do
12
- host "1.2.3.4"
13
- port 5678
14
- user "pivo"
15
- location "/var/apps/vodka"
16
- end
17
- end
18
- end
19
-
20
- project :baz do
21
- environment :qux do
22
- server :bart do
23
- host "2.3.4.5"
24
- default_command :console
25
- command :console do
26
- execute "rails c"
27
- end
28
- command :killall do
29
- execute "killall humans"
30
- desc "Kill ALL humans"
31
- end
32
- end
33
- end
34
- end
35
- """
36
-
37
- Scenario: View full config
38
- When I run taketo --view
39
- Then the output should contain exactly:
40
- """
41
-
42
- Project: foo
43
- Environment: bar
44
- Server: default
45
- Host: 1.2.3.4
46
- Port: 5678
47
- User: pivo
48
- Default location: /var/apps/vodka
49
- Default command: bash
50
- Environment: RAILS_ENV=bar
51
-
52
- Project: baz
53
- Environment: qux
54
- Server: bart
55
- Host: 2.3.4.5
56
- Default command: rails c
57
- Environment: RAILS_ENV=qux
58
- Commands:
59
- console
60
- killall - Kill ALL humans
61
-
62
- """
63
-
64
- Scenario: View particular server
65
- When I run taketo --view foo:bar:default
66
- Then the output should contain exactly:
67
- """
68
- Server: default
69
- Host: 1.2.3.4
70
- Port: 5678
71
- User: pivo
72
- Default location: /var/apps/vodka
73
- Default command: bash
74
- Environment: RAILS_ENV=bar
75
-
76
- """
@@ -1,16 +0,0 @@
1
- DEFAULT_TEST_CONFIG_PATH = "/tmp/taketo_test_cfg.rb".freeze
2
-
3
- When /^I have the following config$/ do |config|
4
- @config_path = DEFAULT_TEST_CONFIG_PATH
5
- File.open(@config_path, "w") do |f|
6
- f.write(config)
7
- end
8
- end
9
-
10
- When /^I run taketo\s?(.*)$/ do |arguments|
11
- step "I run `taketo --config=/tmp/taketo_test_cfg.rb #{arguments}`"
12
- end
13
-
14
- Then /^the output should contain$/ do |expected|
15
- assert_partial_output(expected, all_output)
16
- end
@@ -1,14 +0,0 @@
1
- require 'rubygems'
2
- require 'bundler/setup'
3
- require 'aruba/cucumber'
4
- require 'fileutils'
5
-
6
- ENV['PATH'] = "#{File.expand_path('../../../bin', __FILE__)}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
7
- ENV['RUBYOPT'] = '-Ilib'
8
- ENV["TAKETO_DEV"] = 'true'
9
-
10
- After do
11
- if defined? @config_path and File.exist?(@config_path)
12
- FileUtils.rm(@config_path)
13
- end
14
- end