repo_manager 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. data/.gemfiles +115 -0
  2. data/.gitattributes +1 -0
  3. data/.gitignore +7 -0
  4. data/.rspec +3 -0
  5. data/.yardopts +11 -0
  6. data/Gemfile +11 -0
  7. data/Gemfile.lock +99 -0
  8. data/Guardfile +63 -0
  9. data/HISTORY.markdown +12 -0
  10. data/LICENSE +20 -0
  11. data/README.markdown +192 -0
  12. data/Rakefile +94 -0
  13. data/TODO.markdown +15 -0
  14. data/VERSION +1 -0
  15. data/bin/repo +151 -0
  16. data/cucumber.yml +28 -0
  17. data/examples/pc_saved_game_backup/.gitignore +2 -0
  18. data/examples/pc_saved_game_backup/INSTALL.markdown +420 -0
  19. data/examples/pc_saved_game_backup/README.markdown +108 -0
  20. data/examples/pc_saved_game_backup/remote/.gitignore +2 -0
  21. data/examples/pc_saved_game_backup/repo_manager/Gemfile +12 -0
  22. data/examples/pc_saved_game_backup/repo_manager/Gemfile.lock +66 -0
  23. data/examples/pc_saved_game_backup/repo_manager/assets/.gitignore +2 -0
  24. data/examples/pc_saved_game_backup/repo_manager/features/support/aruba.rb +15 -0
  25. data/examples/pc_saved_game_backup/repo_manager/features/support/env.rb +11 -0
  26. data/examples/pc_saved_game_backup/repo_manager/features/support/steps.rb +3 -0
  27. data/examples/pc_saved_game_backup/repo_manager/features/tasks/update.feature +144 -0
  28. data/examples/pc_saved_game_backup/repo_manager/global/default/asset.conf +2 -0
  29. data/examples/pc_saved_game_backup/repo_manager/repo.conf +64 -0
  30. data/examples/pc_saved_game_backup/repo_manager/tasks/.gitignore +0 -0
  31. data/examples/pc_saved_game_backup/repo_manager/tasks/remote.rb +57 -0
  32. data/examples/pc_saved_game_backup/repo_manager/tasks/update.rb +65 -0
  33. data/examples/pc_saved_game_backup/saved_games/hearts/save1 +1 -0
  34. data/examples/pc_saved_game_backup/saved_games/hearts/save2 +1 -0
  35. data/examples/pc_saved_game_backup/saved_games/mines/my_profile.ini +1 -0
  36. data/examples/pc_saved_game_backup/saved_games/mines/saves/save1 +1 -0
  37. data/examples/pc_saved_game_backup/saved_games/mines/saves/save2 +1 -0
  38. data/features/actions/git.feature +296 -0
  39. data/features/actions/help.feature +53 -0
  40. data/features/actions/list.feature +624 -0
  41. data/features/actions/path.feature +195 -0
  42. data/features/actions/status.feature +261 -0
  43. data/features/actions/task.feature +127 -0
  44. data/features/assets/configuration.feature +204 -0
  45. data/features/assets/rendering.feature +42 -0
  46. data/features/assets/user_attributes.feature +98 -0
  47. data/features/bin.feature +42 -0
  48. data/features/logger.feature +218 -0
  49. data/features/settings.feature +240 -0
  50. data/features/support/aruba.rb +15 -0
  51. data/features/support/env.rb +11 -0
  52. data/features/support/steps.rb +3 -0
  53. data/features/tasks/add/asset.feature +178 -0
  54. data/features/tasks/generate/init.feature +56 -0
  55. data/lib/repo_manager.rb +36 -0
  56. data/lib/repo_manager/actions.rb +8 -0
  57. data/lib/repo_manager/actions/action_helper.rb +39 -0
  58. data/lib/repo_manager/actions/app_action.rb +30 -0
  59. data/lib/repo_manager/actions/base_action.rb +296 -0
  60. data/lib/repo_manager/actions/git_action.rb +113 -0
  61. data/lib/repo_manager/actions/help_action.rb +52 -0
  62. data/lib/repo_manager/actions/list_action.rb +123 -0
  63. data/lib/repo_manager/actions/path_action.rb +22 -0
  64. data/lib/repo_manager/actions/status_action.rb +192 -0
  65. data/lib/repo_manager/actions/task_action.rb +71 -0
  66. data/lib/repo_manager/app.rb +116 -0
  67. data/lib/repo_manager/assets.rb +3 -0
  68. data/lib/repo_manager/assets/app_asset.rb +15 -0
  69. data/lib/repo_manager/assets/asset_accessors.rb +67 -0
  70. data/lib/repo_manager/assets/asset_configuration.rb +137 -0
  71. data/lib/repo_manager/assets/asset_manager.rb +72 -0
  72. data/lib/repo_manager/assets/base_asset.rb +199 -0
  73. data/lib/repo_manager/assets/repo_asset.rb +30 -0
  74. data/lib/repo_manager/core.rb +2 -0
  75. data/lib/repo_manager/core/array.rb +21 -0
  76. data/lib/repo_manager/core/hash.rb +83 -0
  77. data/lib/repo_manager/errors.rb +10 -0
  78. data/lib/repo_manager/extensions/hash.rb +86 -0
  79. data/lib/repo_manager/git.rb +2 -0
  80. data/lib/repo_manager/git/lib.rb +69 -0
  81. data/lib/repo_manager/git/status.rb +196 -0
  82. data/lib/repo_manager/logger.rb +39 -0
  83. data/lib/repo_manager/settings.rb +98 -0
  84. data/lib/repo_manager/tasks.rb +3 -0
  85. data/lib/repo_manager/tasks/add/asset.rb +213 -0
  86. data/lib/repo_manager/tasks/generate/init.rb +42 -0
  87. data/lib/repo_manager/tasks/generate/templates/config/repo.conf.tt +61 -0
  88. data/lib/repo_manager/tasks/generate/templates/init/assets/.gitignore +0 -0
  89. data/lib/repo_manager/tasks/generate/templates/init/global/default/asset.conf +2 -0
  90. data/lib/repo_manager/tasks/generate/templates/init/tasks/.gitignore +0 -0
  91. data/lib/repo_manager/tasks/task_manager.rb +166 -0
  92. data/lib/repo_manager/tasks/thor_helper.rb +29 -0
  93. data/lib/repo_manager/test/asset_steps.rb +19 -0
  94. data/lib/repo_manager/test/base_steps.rb +152 -0
  95. data/lib/repo_manager/test/repo_api.rb +41 -0
  96. data/lib/repo_manager/test/repo_steps.rb +83 -0
  97. data/lib/repo_manager/test/test_api.rb +88 -0
  98. data/lib/repo_manager/views.rb +2 -0
  99. data/lib/repo_manager/views/app_view.rb +15 -0
  100. data/lib/repo_manager/views/base_view.rb +137 -0
  101. data/lib/repo_manager/views/templates/css/basic.css +26 -0
  102. data/lib/repo_manager/views/templates/default.erb +40 -0
  103. data/lib/repo_manager/views/templates/default.slim +37 -0
  104. data/lib/repo_manager/views/view_helper.rb +55 -0
  105. data/repo_manager.gemspec +75 -0
  106. data/spec/basic_app/actions/action_helper_spec.rb +54 -0
  107. data/spec/basic_app/assets/base_asset_spec.rb +210 -0
  108. data/spec/basic_app/core_spec.rb +78 -0
  109. data/spec/basic_app/settings_spec.rb +64 -0
  110. data/spec/basic_app/views/view_helper_spec.rb +28 -0
  111. data/spec/basic_gem/aruba_helper_spec.rb +33 -0
  112. data/spec/basic_gem/basic_gem_spec.rb +84 -0
  113. data/spec/basic_gem/gemspec_spec.rb +68 -0
  114. data/spec/repo_manager/git_spec.rb +31 -0
  115. data/spec/spec_helper.rb +25 -0
  116. metadata +472 -0
@@ -0,0 +1,195 @@
1
+ @announce
2
+ Feature: Listing repo path information
3
+
4
+ Show the repository path defined in the config file to stdout so that it can
5
+ be used for scripting.
6
+
7
+ The 'path' action is an alias for the 'list' action with the 'list=path' option
8
+
9
+ Example: chdir to the path of the repo named "my_repo_name"
10
+
11
+ cd $(repo path my_repo_name)
12
+ cd $(repo path my_repo_name)
13
+
14
+ Example: chdir to the path of the repo named "my_repo_name"
15
+
16
+ cd $(repo path --filter=my_repo_name)
17
+
18
+ Example: chdir to the path of the repo named "my_repo_name" using a Bash
19
+ function. This handles repo paths that contain spaces.
20
+
21
+ vim ~/.bashrc
22
+
23
+ function rcd(){ cd "$(repo --match=ONE --no-color path $@)"; }
24
+
25
+ usage:
26
+
27
+ rcd my_repo_n
28
+
29
+ Example: repo versions of Bash's pushd and popd
30
+
31
+ vim ~/.bashrc
32
+
33
+ function rpushd(){ pushd "$(repo path --match=ONE --no-color $@)"; }
34
+ alias rpopd="popd"
35
+
36
+ usage:
37
+
38
+ rpushd my
39
+
40
+
41
+ Example: enable bash repo name completion for the repo, rcd, and rpushd commands
42
+
43
+ vim ~/.bashrc
44
+
45
+ function _repo_names()
46
+ {
47
+ local cur opts
48
+ COMPREPLY=()
49
+ cur="${COMP_WORDS[COMP_CWORD]}"
50
+ opts=`repo list --list=name --no-color`
51
+
52
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
53
+ return 0
54
+ }
55
+ complete -F _repo_names rcd rpushd repo
56
+
57
+
58
+ Background: A valid config file
59
+ Given a file named ".repo_manager/repo.conf" with:
60
+ """
61
+ ---
62
+ folders:
63
+ assets : app_assets
64
+ """
65
+ And the folder ".repo_manager/app_assets" with the following asset configurations:
66
+ | name | path |
67
+ | test1 | test_path_1 |
68
+ | test2 | test_path_2 |
69
+
70
+ Scenario: Show path using 'path' as alias for 'list --list=path'
71
+ When I run `repo path`
72
+ Then the exit status should be 0
73
+ And the output should match:
74
+ """
75
+ .+/test_path_1$
76
+ .+/test_path_2$
77
+ """
78
+
79
+ Scenario: Show path using list action directly
80
+ When I run `repo list --list=path`
81
+ Then the exit status should be 0
82
+ And the output should match:
83
+ """
84
+ .+/test_path_1$
85
+ .+/test_path_2$
86
+ """
87
+
88
+ Scenario: Show path only using liberal regex filter
89
+ When I run `repo list --list=path --filter=test --no-verbose`
90
+ Then the exit status should be 0
91
+ And the output should match:
92
+ """
93
+ .+/test_path_1$
94
+ .+/test_path_2$
95
+ """
96
+
97
+ Scenario: Show path only using with restrictive regex filter
98
+ When I run `repo list --list=path --filter=test$ --no-verbose`
99
+ Then the exit status should be 0
100
+ And the output should not contain:
101
+ """
102
+ test_path_1
103
+ """
104
+
105
+ Scenario: Show path only using an exact string filter '--match mode=EXACT'
106
+ When I run `repo list --list=path --filter=test --no-verbose --match=EXACT`
107
+ Then the exit status should be 0
108
+ And the output should not contain:
109
+ """
110
+ test_path_1
111
+ """
112
+ When I run `repo list --list=path --filter=t.st --no-verbose --match=EXACT`
113
+ Then the exit status should be 0
114
+ And the output should not contain:
115
+ """
116
+ test_path_1
117
+ """
118
+ When I run `repo list --list=path --filter=est1 --no-verbose --match=EXACT`
119
+ Then the exit status should be 0
120
+ And the output should not contain:
121
+ """
122
+ test_path_1
123
+ """
124
+ When I run `repo list --list=path --filter=test1 --no-verbose --match=EXACT`
125
+ Then the exit status should be 0
126
+ And the output should match:
127
+ """
128
+ .+/test_path_1$
129
+ """
130
+
131
+ Scenario: Show path only using with character placeholder regex filter
132
+ When I run `repo list --list=path --filter=t.st1 --no-verbose`
133
+ Then the exit status should be 0
134
+ And the output should match:
135
+ """
136
+ .+/test_path_1$
137
+ """
138
+ And the output should not contain:
139
+ """
140
+ test_path_2
141
+ """
142
+
143
+ Scenario: Show path only using --match mode=ALL
144
+ When I run `repo list --list=path --filter=test --match ALL`
145
+ Then the exit status should be 0
146
+ And the output should match:
147
+ """
148
+ .+/test_path_1$
149
+ .+/test_path_2$
150
+ """
151
+
152
+ Scenario: Show path only using --match mode=FIRST
153
+ When I run `repo list --list=path --filter=test --match=FIRST --no-verbose`
154
+ Then the exit status should be 0
155
+ And the output should match:
156
+ """
157
+ .+/test_path_1$
158
+ """
159
+ And the output should not contain:
160
+ """
161
+ test_path_2
162
+ """
163
+
164
+ Scenario: Show path only using --match mode=ONE
165
+ When I run `repo list --list=path --filter=test --match=ONE`
166
+ Then the exit status should be 1
167
+
168
+ Scenario: Show path only using multiple delimited filters. Regex allowed on
169
+ each filter separately. Switch style: --filter
170
+ When I run `repo list --list=path --filter=test1,t...2,t...3`
171
+ Then the exit status should be 0
172
+ And the output should match:
173
+ """
174
+ .+/test_path_1$
175
+ .+/test_path_2$
176
+ """
177
+
178
+ Scenario: Show path only using multiple delimited filters. Regex allowed on
179
+ each filter separately. Switch style: --repos
180
+ When I run `repo list --list=path --repos=test1,t...2,t...3`
181
+ Then the exit status should be 0
182
+ And the output should match:
183
+ """
184
+ .+/test_path_1$
185
+ .+/test_path_2$
186
+ """
187
+
188
+ Scenario: Show path only using multiple args instead of filter switch
189
+ When I run `repo list --list=path test1 t...2 t...3`
190
+ Then the exit status should be 0
191
+ And the output should match:
192
+ """
193
+ .+/test_path_1$
194
+ .+/test_path_2$
195
+ """
@@ -0,0 +1,261 @@
1
+ @announce
2
+ Feature: Listing repo path information
3
+
4
+ Show the repository status to stdout
5
+
6
+ Example usage:
7
+
8
+ repo status
9
+ repo status --short
10
+ repo status repo1 --unmodified DOTS
11
+ repo status repo1 repo2 --unmodified DOTS
12
+
13
+ Equivalent filtering:
14
+
15
+ repo status --filter=test2 --unmodified DOTS
16
+ repo status test2 --unmodified DOTS"
17
+
18
+ Background: A valid config file
19
+ Given a file named "repo_manager/repo.conf" with:
20
+ """
21
+ ---
22
+ options:
23
+ color : AUTO
24
+ folders:
25
+ assets : assets
26
+ """
27
+ And the folder "repo_manager/assets" with the following asset configurations:
28
+ | name | path |
29
+ | test1 | test_path_1 |
30
+ | test2 | test_path_2 |
31
+ And a repo in folder "test_path_1" with the following:
32
+ | filename | status | content |
33
+ | .gitignore | C | |
34
+ And a repo in folder "test_path_2" with the following:
35
+ | filename | status | content |
36
+ | .gitignore | C | |
37
+
38
+
39
+ Scenario: No uncommitted changes, default output
40
+ When I run `repo status`
41
+ Then the exit status should be 0
42
+ And its output should contain:
43
+ """
44
+ no modified repositories, all working folders are clean
45
+ """
46
+
47
+ Scenario: No repos configured or no repos match filter
48
+ When I run `repo status --filter=garbage`
49
+ Then the exit status should be 0
50
+ And its output should contain:
51
+ """
52
+ no repositories found
53
+ """
54
+ And its output should not contain:
55
+ """
56
+ no modified repositories, all working folders are clean
57
+ """
58
+
59
+ Scenario: No uncommitted changes, using dots to show progress, one dot per file
60
+ When I run `repo status --unmodified=DOTS`
61
+ Then its output should contain:
62
+ """
63
+ ..
64
+ no modified repositories, all working folders are clean
65
+ """
66
+ When I run `repo status`
67
+ Then its output should contain:
68
+ """
69
+ no modified repositories, all working folders are clean
70
+ """
71
+ And its output should not contain:
72
+ """
73
+ ..
74
+ """
75
+
76
+ Scenario: Uncommittable changes don't show
77
+ Given a repo in folder "test_path_1" with the following:
78
+ | filename | status | content |
79
+ | test_file3.txt | C | hi file3 |
80
+ When I run `touch test_path_1/test_file3.txt`
81
+ And I run `repo status`
82
+ Then the exit status should be 0
83
+ Then the output should contain:
84
+ """
85
+ no modified repositories, all working folders are clean
86
+ """
87
+
88
+ Scenario: Invalid repo
89
+ Given the folder "repo_manager/assets" with the following asset configurations:
90
+ | name | path |
91
+ | bad_repo| not_a_repo |
92
+ And a directory named "not_a_repo"
93
+ When I run `repo status test1 test2 bad_repo --unmodified DOTS --no-verbose`
94
+ Then the exit status should be 2
95
+ And the normalized output should contain:
96
+ """
97
+ I bad_repo: ./not_a_repo [not a valid repo]
98
+ """
99
+ And the normalized output should not contain:
100
+ """
101
+ I bad_repo: ./not_a_repo [not a valid repo]
102
+ I bad_repo: ./not_a_repo [not a valid repo]
103
+ """
104
+
105
+ Scenario: Missing repo folder
106
+ Given the folder "repo_manager/assets" with the following asset configurations:
107
+ | name | path |
108
+ | bad_repo| not_a_repo |
109
+ When I run `repo status --filter=bad_repo --unmodified DOTS --no-verbose`
110
+ Then the exit status should be 1
111
+ And the normalized output should contain:
112
+ """
113
+ X bad_repo: ./not_a_repo [no such path]
114
+ """
115
+ And the normalized output should not contain:
116
+ """
117
+ X bad_repo: ./not_a_repo [no such path]
118
+ X bad_repo: ./not_a_repo [no such path]
119
+ """
120
+
121
+ Scenario: One uncommitted change
122
+ Given a repo in folder "test_path_1" with the following:
123
+ | filename | status | content |
124
+ | .gitignore | M | tmp/* |
125
+ When I run `repo status`
126
+ Then the exit status should be 4
127
+ And the normalized output should contain:
128
+ """
129
+ M test1
130
+ modified: .gitignore
131
+ """
132
+
133
+ Scenario: One uncommitted change, don't show individual files
134
+ Given a repo in folder "test_path_1" with the following:
135
+ | filename | status | content |
136
+ | .gitignore | M | tmp/* |
137
+ When I run `repo status --short --unmodified=DOTS`
138
+ And the normalized output should contain:
139
+ """
140
+ M test1
141
+ .
142
+ """
143
+
144
+ Scenario: One new file added
145
+ Given a repo in folder "test_path_2" with the following:
146
+ | filename | status | content |
147
+ | new_file2.txt | A | hello new file2 |
148
+ When I run `repo status --unmodified=DOTS`
149
+ Then the exit status should be 8
150
+ And the normalized output should contain:
151
+ """
152
+ .
153
+ A test2
154
+ added: new_file2.txt
155
+ """
156
+ And the output should not contain:
157
+ """
158
+ no modified repositories, all working folders are clean
159
+ """
160
+
161
+ Scenario: One existing file added to the index
162
+ Given a repo in folder "test_path_2" with the following:
163
+ | filename | status | content |
164
+ | .gitignore | A | new_stff |
165
+ When I run `repo status --unmodified=DOTS`
166
+ Then the exit status should be 8
167
+ And the normalized output should contain:
168
+ """
169
+ .
170
+ A test2
171
+ added: .gitignore
172
+ """
173
+
174
+ Scenario: One deleted file
175
+ Given a repo in folder "test_path_1" with the following:
176
+ | filename | status |
177
+ | .gitignore | D |
178
+ When I run `repo status --unmodified=DOTS`
179
+ Then the exit status should be 16
180
+ And the normalized output should contain:
181
+ """
182
+ D test1
183
+ deleted: .gitignore
184
+ .
185
+ """
186
+
187
+ Scenario: Two untracked files
188
+ Given a repo in folder "test_path_1" with the following:
189
+ | filename | status | content |
190
+ | new_file1.txt | ? | hello new file1 |
191
+ | new_file2.txt | ? | hello new file2 |
192
+ When I run `repo status --unmodified=DOTS`
193
+ Then the exit status should be 32
194
+ And the normalized output should contain:
195
+ """
196
+ ? test1
197
+ untracked: new_file1.txt
198
+ untracked: new_file2.txt
199
+ .
200
+ """
201
+
202
+ Scenario: One uncommitted change, two untracked files, one added, and one deleted file
203
+ Given a repo in folder "test_path_1" with the following:
204
+ | filename | status | content |
205
+ | deleted_file.txt | D | hello deleted file |
206
+ And a repo in folder "test_path_1" with the following:
207
+ | filename | status | content |
208
+ | added_file.txt | A | hello added file |
209
+ | .gitignore | M | tmp/* |
210
+ | new_file1.txt | ? | hello new file1 |
211
+ | new_file2.txt | ? | hello new file2 |
212
+ When I run `repo status --unmodified=DOTS`
213
+ Then the exit status should be 60
214
+ And the normalized output should contain:
215
+ """
216
+ M?AD test1
217
+ modified: .gitignore
218
+ untracked: new_file1.txt
219
+ untracked: new_file2.txt
220
+ added: added_file.txt
221
+ deleted: deleted_file.txt
222
+ .
223
+ """
224
+
225
+ Scenario: Two untracked files, one is gitignored
226
+ Given a repo in folder "test_path_1" with the following:
227
+ | filename | status | content |
228
+ | .gitignore | DC | new_file2.txt |
229
+ | new_file1.txt | ? | hello new file1 |
230
+ | new_file2.txt | ? | hello new file2 |
231
+ When I run `repo status --unmodified=DOTS`
232
+ Then the exit status should be 32
233
+ And the normalized output should contain:
234
+ """
235
+ ? test1
236
+ untracked: new_file1.txt
237
+ .
238
+ """
239
+
240
+ Scenario: Folders with spaces in path
241
+ Given a file named "repo1.conf" with:
242
+ """
243
+ ---
244
+ folders:
245
+ assets : repo1_assets
246
+ """
247
+ Given a repo in folder "test 1/test path 1" with the following:
248
+ | filename | status | content |
249
+ | .gitignore | CM | tmp/* |
250
+ And the folder "repo1_assets" with the following asset configurations:
251
+ | name | path |
252
+ | test1 | test 1/test path 1 |
253
+ | test2 | test_path_2 |
254
+ When I run `repo status --unmodified=DOTS --config=repo1.conf`
255
+ Then the exit status should be 4
256
+ And the normalized output should contain:
257
+ """
258
+ M test1
259
+ modified: .gitignore
260
+ .
261
+ """