librarian 0.0.24 → 0.0.25

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. data/.travis.yml +7 -1
  2. data/CHANGELOG.md +19 -1
  3. data/README.md +2 -9
  4. data/Rakefile +0 -11
  5. data/lib/librarian.rb +0 -8
  6. data/lib/librarian/action/base.rb +6 -4
  7. data/lib/librarian/chef/cli.rb +1 -1
  8. data/lib/librarian/chef/integration/knife.rb +4 -0
  9. data/lib/librarian/chef/manifest_reader.rb +14 -2
  10. data/lib/librarian/chef/source/local.rb +2 -0
  11. data/lib/librarian/chef/source/site.rb +49 -41
  12. data/lib/librarian/cli.rb +32 -17
  13. data/lib/librarian/dependency.rb +1 -9
  14. data/lib/librarian/dsl.rb +6 -3
  15. data/lib/librarian/dsl/receiver.rb +10 -12
  16. data/lib/librarian/dsl/target.rb +5 -10
  17. data/lib/librarian/environment.rb +41 -2
  18. data/lib/librarian/lockfile.rb +0 -4
  19. data/lib/librarian/lockfile/compiler.rb +0 -4
  20. data/lib/librarian/lockfile/parser.rb +0 -4
  21. data/lib/librarian/logger.rb +46 -0
  22. data/lib/librarian/manifest.rb +1 -9
  23. data/lib/librarian/resolution.rb +5 -3
  24. data/lib/librarian/resolver.rb +6 -1
  25. data/lib/librarian/resolver/implementation.rb +18 -8
  26. data/lib/librarian/source/git.rb +2 -0
  27. data/lib/librarian/source/git/repository.rb +9 -5
  28. data/lib/librarian/source/local.rb +12 -2
  29. data/lib/librarian/spec.rb +4 -4
  30. data/lib/librarian/spec_change_set.rb +7 -4
  31. data/lib/librarian/specfile.rb +3 -8
  32. data/lib/librarian/version.rb +1 -1
  33. data/librarian.gemspec +3 -9
  34. data/spec/functional/chef/cli_spec.rb +194 -0
  35. data/spec/functional/chef/source/site_spec.rb +11 -10
  36. data/spec/functional/source/git/repository_spec.rb +1 -1
  37. data/spec/support/cli_macro.rb +122 -0
  38. data/spec/support/with_env_macro.rb +20 -0
  39. data/spec/unit/config/database_spec.rb +2 -2
  40. data/spec/unit/dependency_spec.rb +6 -0
  41. data/spec/unit/dsl_spec.rb +16 -37
  42. data/spec/unit/environment_spec.rb +95 -0
  43. data/spec/unit/manifest_spec.rb +6 -0
  44. data/spec/unit/resolver_spec.rb +41 -0
  45. metadata +7 -42
  46. data/config/cucumber.yaml +0 -1
  47. data/features/chef/cli/init.feature +0 -11
  48. data/features/chef/cli/install.feature +0 -64
  49. data/features/chef/cli/show.feature +0 -77
  50. data/features/chef/cli/version.feature +0 -11
  51. data/features/support/env.rb +0 -9
  52. data/lib/librarian/helpers/debug.rb +0 -35
data/config/cucumber.yaml DELETED
@@ -1 +0,0 @@
1
- default: --tags ~@wip --format progress
@@ -1,11 +0,0 @@
1
- Feature: cli/init
2
-
3
-
4
-
5
- Scenario: Initing a directory
6
- When I run `librarian-chef init`
7
- Then the exit status should be 0
8
- Then a file named "Cheffile" should exist
9
-
10
-
11
-
@@ -1,64 +0,0 @@
1
- Feature: cli/install
2
-
3
-
4
-
5
- Scenario: A simple Cheffile with one cookbook
6
- Given a file named "cookbook-sources/apt/metadata.yaml" with:
7
- """
8
- name: apt
9
- version: 1.0.0
10
- dependencies: { }
11
- """
12
- Given a file named "Cheffile" with:
13
- """
14
- cookbook 'apt',
15
- :path => 'cookbook-sources'
16
- """
17
- When I run `librarian-chef install --verbose`
18
- Then the exit status should be 0
19
- And the file "cookbooks/apt/metadata.yaml" should contain exactly:
20
- """
21
- name: apt
22
- version: 1.0.0
23
- dependencies: { }
24
- """
25
-
26
-
27
-
28
- Scenario: A simple Cheffile with one cookbook with one dependency
29
- Given a file named "cookbook-sources/main/metadata.yaml" with:
30
- """
31
- name: main
32
- version: 1.0.0
33
- dependencies:
34
- sub: 1.0.0
35
- """
36
- Given a file named "cookbook-sources/sub/metadata.yaml" with:
37
- """
38
- name: sub
39
- version: 1.0.0
40
- dependencies: {}
41
- """
42
- Given a file named "Cheffile" with:
43
- """
44
- path 'cookbook-sources'
45
- cookbook 'main'
46
- """
47
- When I run `librarian-chef install --verbose`
48
- Then the exit status should be 0
49
- And the file "cookbooks/main/metadata.yaml" should contain exactly:
50
- """
51
- name: main
52
- version: 1.0.0
53
- dependencies:
54
- sub: 1.0.0
55
- """
56
- And the file "cookbooks/sub/metadata.yaml" should contain exactly:
57
- """
58
- name: sub
59
- version: 1.0.0
60
- dependencies: {}
61
- """
62
-
63
-
64
-
@@ -1,77 +0,0 @@
1
- Feature: cli/show
2
-
3
-
4
-
5
- Background: A simple Cheffile with one cookbook with one dependency
6
- Given a file named "cookbook-sources/main/metadata.yaml" with:
7
- """
8
- name: main
9
- version: 1.0.0
10
- dependencies:
11
- sub: 1.0.0
12
- """
13
- Given a file named "cookbook-sources/sub/metadata.yaml" with:
14
- """
15
- name: sub
16
- version: 1.0.0
17
- dependencies: {}
18
- """
19
- Given a file named "Cheffile" with:
20
- """
21
- path 'cookbook-sources'
22
- cookbook 'main'
23
- """
24
- Given I run `librarian-chef install`
25
-
26
-
27
-
28
- Scenario: Showing al without a lockfile
29
- Given I remove the file "Cheffile.lock"
30
- When I run `librarian-chef show`
31
- Then the exit status should be 1
32
- Then the output should contain exactly:
33
- """
34
- Be sure to install first!
35
-
36
- """
37
-
38
-
39
-
40
- Scenario: Showing all
41
- When I run `librarian-chef show`
42
- Then the exit status should be 0
43
- Then the output should contain exactly:
44
- """
45
- main (1.0.0)
46
- sub (1.0.0)
47
-
48
- """
49
-
50
-
51
-
52
- Scenario: Showing one without dependencies
53
- When I run `librarian-chef show sub`
54
- Then the exit status should be 0
55
- Then the output should contain exactly:
56
- """
57
- sub (1.0.0)
58
- source: cookbook-sources
59
-
60
- """
61
-
62
-
63
-
64
- Scenario: Showing one with dependencies
65
- When I run `librarian-chef show main`
66
- Then the exit status should be 0
67
- Then the output should contain exactly:
68
- """
69
- main (1.0.0)
70
- source: cookbook-sources
71
- dependencies:
72
- sub (= 1.0.0)
73
-
74
- """
75
-
76
-
77
-
@@ -1,11 +0,0 @@
1
- Feature: cli/version
2
-
3
-
4
-
5
- Scenario: Getting the version
6
- When I run `librarian-chef version`
7
- Then the exit status should be 0
8
- And the output should contain "librarian-"
9
-
10
-
11
-
@@ -1,9 +0,0 @@
1
- require 'aruba/cucumber'
2
-
3
- Before do
4
- slow_boot = false
5
- slow_boot ||= RUBY_PLATFORM == "java"
6
- slow_boot ||= defined?(::Rubinius)
7
-
8
- @aruba_timeout_seconds = slow_boot ? 5 : 2
9
- end
@@ -1,35 +0,0 @@
1
- require 'librarian/support/abstract_method'
2
-
3
- module Librarian
4
- module Helpers
5
- module Debug
6
-
7
- include Support::AbstractMethod
8
-
9
- LIBRARIAN_PATH = Pathname.new('../../../../').expand_path(__FILE__)
10
-
11
- abstract_method :environment
12
-
13
- private
14
-
15
- def relative_path_to(path)
16
- environment.project_relative_path_to(path)
17
- end
18
-
19
- def debug
20
- if ui = environment.ui
21
- if ui.respond_to? :debug_line_numbers and ui.debug_line_numbers
22
- loc = caller.find{|l| !(l =~ /in `debug'$/)}
23
- if loc =~ /^(.+):(\d+):in `(.+)'$/
24
- loc = "#{Pathname.new($1).relative_path_from(LIBRARIAN_PATH)}:#{$2}:in `#{$3}'"
25
- end
26
- ui.debug { "[Librarian] #{yield} [#{loc}]" }
27
- else
28
- ui.debug { "[Librarian] #{yield}" }
29
- end
30
- end
31
- end
32
-
33
- end
34
- end
35
- end