vendorificator 0.0.1

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.
Files changed (57) hide show
  1. data/.gitignore +19 -0
  2. data/.travis.yml +9 -0
  3. data/Gemfile +11 -0
  4. data/LICENSE +22 -0
  5. data/README.md +45 -0
  6. data/Rakefile +29 -0
  7. data/bin/vendor +4 -0
  8. data/bin/vendorify +6 -0
  9. data/examples/Vendorfile +25 -0
  10. data/features/chef_cookbook.feature +44 -0
  11. data/features/deprecated.feature +17 -0
  12. data/features/fixtures/git/testrepo/HEAD +1 -0
  13. data/features/fixtures/git/testrepo/config +7 -0
  14. data/features/fixtures/git/testrepo/description +1 -0
  15. data/features/fixtures/git/testrepo/hooks/applypatch-msg.sample +15 -0
  16. data/features/fixtures/git/testrepo/hooks/commit-msg.sample +24 -0
  17. data/features/fixtures/git/testrepo/hooks/post-update.sample +8 -0
  18. data/features/fixtures/git/testrepo/hooks/pre-applypatch.sample +14 -0
  19. data/features/fixtures/git/testrepo/hooks/pre-commit.sample +50 -0
  20. data/features/fixtures/git/testrepo/hooks/pre-rebase.sample +169 -0
  21. data/features/fixtures/git/testrepo/hooks/prepare-commit-msg.sample +36 -0
  22. data/features/fixtures/git/testrepo/hooks/update.sample +128 -0
  23. data/features/fixtures/git/testrepo/info/exclude +6 -0
  24. data/features/fixtures/git/testrepo/info/refs +5 -0
  25. data/features/fixtures/git/testrepo/objects/info/packs +2 -0
  26. data/features/fixtures/git/testrepo/objects/pack/pack-46f7621b6a6b9b1c22dd15c08d457dfedf76e55f.idx +0 -0
  27. data/features/fixtures/git/testrepo/objects/pack/pack-46f7621b6a6b9b1c22dd15c08d457dfedf76e55f.pack +0 -0
  28. data/features/fixtures/git/testrepo/packed-refs +6 -0
  29. data/features/fixtures/git/testrepo/refs/heads/.sentinel +0 -0
  30. data/features/fixtures/git/testrepo/refs/tags/.sentinel +0 -0
  31. data/features/fixtures/vcr_cassettes/vendorificator.yml +2375 -0
  32. data/features/git.feature +12 -0
  33. data/features/needed.feature +16 -0
  34. data/features/smoke.feature +14 -0
  35. data/features/status.feature +47 -0
  36. data/features/step_definitions/basic.rb +52 -0
  37. data/features/step_definitions/git.rb +39 -0
  38. data/features/step_definitions/vendorificator.rb +27 -0
  39. data/features/support/env.rb +32 -0
  40. data/features/support/transform_pattern.rb +12 -0
  41. data/features/support/world_git.rb +40 -0
  42. data/features/support/world_runs.rb +90 -0
  43. data/features/tarball.feature +63 -0
  44. data/features/tarball_edit.feature +15 -0
  45. data/features/vendor.feature +16 -0
  46. data/lib/vendorificator/cli.rb +233 -0
  47. data/lib/vendorificator/config.rb +72 -0
  48. data/lib/vendorificator/hooks/chef_cookbook.rb +23 -0
  49. data/lib/vendorificator/repo.rb +69 -0
  50. data/lib/vendorificator/vendor/archive.rb +90 -0
  51. data/lib/vendorificator/vendor/chef_cookbook.rb +58 -0
  52. data/lib/vendorificator/vendor/git.rb +47 -0
  53. data/lib/vendorificator/vendor.rb +260 -0
  54. data/lib/vendorificator/version.rb +3 -0
  55. data/lib/vendorificator.rb +9 -0
  56. data/vendorificator.gemspec +30 -0
  57. metadata +321 -0
@@ -0,0 +1,128 @@
1
+ #!/bin/sh
2
+ #
3
+ # An example hook script to blocks unannotated tags from entering.
4
+ # Called by "git receive-pack" with arguments: refname sha1-old sha1-new
5
+ #
6
+ # To enable this hook, rename this file to "update".
7
+ #
8
+ # Config
9
+ # ------
10
+ # hooks.allowunannotated
11
+ # This boolean sets whether unannotated tags will be allowed into the
12
+ # repository. By default they won't be.
13
+ # hooks.allowdeletetag
14
+ # This boolean sets whether deleting tags will be allowed in the
15
+ # repository. By default they won't be.
16
+ # hooks.allowmodifytag
17
+ # This boolean sets whether a tag may be modified after creation. By default
18
+ # it won't be.
19
+ # hooks.allowdeletebranch
20
+ # This boolean sets whether deleting branches will be allowed in the
21
+ # repository. By default they won't be.
22
+ # hooks.denycreatebranch
23
+ # This boolean sets whether remotely creating branches will be denied
24
+ # in the repository. By default this is allowed.
25
+ #
26
+
27
+ # --- Command line
28
+ refname="$1"
29
+ oldrev="$2"
30
+ newrev="$3"
31
+
32
+ # --- Safety check
33
+ if [ -z "$GIT_DIR" ]; then
34
+ echo "Don't run this script from the command line." >&2
35
+ echo " (if you want, you could supply GIT_DIR then run" >&2
36
+ echo " $0 <ref> <oldrev> <newrev>)" >&2
37
+ exit 1
38
+ fi
39
+
40
+ if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
41
+ echo "Usage: $0 <ref> <oldrev> <newrev>" >&2
42
+ exit 1
43
+ fi
44
+
45
+ # --- Config
46
+ allowunannotated=$(git config --bool hooks.allowunannotated)
47
+ allowdeletebranch=$(git config --bool hooks.allowdeletebranch)
48
+ denycreatebranch=$(git config --bool hooks.denycreatebranch)
49
+ allowdeletetag=$(git config --bool hooks.allowdeletetag)
50
+ allowmodifytag=$(git config --bool hooks.allowmodifytag)
51
+
52
+ # check for no description
53
+ projectdesc=$(sed -e '1q' "$GIT_DIR/description")
54
+ case "$projectdesc" in
55
+ "Unnamed repository"* | "")
56
+ echo "*** Project description file hasn't been set" >&2
57
+ exit 1
58
+ ;;
59
+ esac
60
+
61
+ # --- Check types
62
+ # if $newrev is 0000...0000, it's a commit to delete a ref.
63
+ zero="0000000000000000000000000000000000000000"
64
+ if [ "$newrev" = "$zero" ]; then
65
+ newrev_type=delete
66
+ else
67
+ newrev_type=$(git cat-file -t $newrev)
68
+ fi
69
+
70
+ case "$refname","$newrev_type" in
71
+ refs/tags/*,commit)
72
+ # un-annotated tag
73
+ short_refname=${refname##refs/tags/}
74
+ if [ "$allowunannotated" != "true" ]; then
75
+ echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2
76
+ echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2
77
+ exit 1
78
+ fi
79
+ ;;
80
+ refs/tags/*,delete)
81
+ # delete tag
82
+ if [ "$allowdeletetag" != "true" ]; then
83
+ echo "*** Deleting a tag is not allowed in this repository" >&2
84
+ exit 1
85
+ fi
86
+ ;;
87
+ refs/tags/*,tag)
88
+ # annotated tag
89
+ if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1
90
+ then
91
+ echo "*** Tag '$refname' already exists." >&2
92
+ echo "*** Modifying a tag is not allowed in this repository." >&2
93
+ exit 1
94
+ fi
95
+ ;;
96
+ refs/heads/*,commit)
97
+ # branch
98
+ if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then
99
+ echo "*** Creating a branch is not allowed in this repository" >&2
100
+ exit 1
101
+ fi
102
+ ;;
103
+ refs/heads/*,delete)
104
+ # delete branch
105
+ if [ "$allowdeletebranch" != "true" ]; then
106
+ echo "*** Deleting a branch is not allowed in this repository" >&2
107
+ exit 1
108
+ fi
109
+ ;;
110
+ refs/remotes/*,commit)
111
+ # tracking branch
112
+ ;;
113
+ refs/remotes/*,delete)
114
+ # delete tracking branch
115
+ if [ "$allowdeletebranch" != "true" ]; then
116
+ echo "*** Deleting a tracking branch is not allowed in this repository" >&2
117
+ exit 1
118
+ fi
119
+ ;;
120
+ *)
121
+ # Anything else (is there anything else?)
122
+ echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2
123
+ exit 1
124
+ ;;
125
+ esac
126
+
127
+ # --- Finished
128
+ exit 0
@@ -0,0 +1,6 @@
1
+ # git ls-files --others --exclude-from=.git/info/exclude
2
+ # Lines that start with '#' are comments.
3
+ # For a project mostly in C, the following would be a good set of
4
+ # exclude patterns (uncomment them if you want to use them):
5
+ # *.[oa]
6
+ # *~
@@ -0,0 +1,5 @@
1
+ 69389e336277bd81f9af75a565cc511eb6fb497f refs/heads/blue
2
+ 0989414c2aa7b529d3c9ede7ca4ccd940c77efe4 refs/heads/email
3
+ 10e9ac58c77bc229d8c59a5b4eb7422916453148 refs/heads/master
4
+ ecbfa229ba5f11c05b18bcc4f7c32b8f25d63f8c refs/heads/topic/green
5
+ ecbfa229ba5f11c05b18bcc4f7c32b8f25d63f8c refs/heads/topic/pink
@@ -0,0 +1,2 @@
1
+ P pack-46f7621b6a6b9b1c22dd15c08d457dfedf76e55f.pack
2
+
@@ -0,0 +1,6 @@
1
+ # pack-refs with: peeled
2
+ 69389e336277bd81f9af75a565cc511eb6fb497f refs/heads/blue
3
+ 0989414c2aa7b529d3c9ede7ca4ccd940c77efe4 refs/heads/email
4
+ 10e9ac58c77bc229d8c59a5b4eb7422916453148 refs/heads/master
5
+ ecbfa229ba5f11c05b18bcc4f7c32b8f25d63f8c refs/heads/topic/green
6
+ ecbfa229ba5f11c05b18bcc4f7c32b8f25d63f8c refs/heads/topic/pink