repo_manager 0.7.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 (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,42 @@
1
+ @announce
2
+ Feature: Options via a command line interface (CLI)
3
+
4
+ The application should accept options on the command line. These options
5
+ should override hard coded defaults
6
+
7
+ Background: Empty configuration file so that we don't read global config locations
8
+ Given an empty file named "repo.conf"
9
+
10
+ Scenario: Version info
11
+ When I run `repo --version`
12
+ Then the exit status should be 0
13
+ And the output should match /repo_manager, version ([\d]+\.[\d]+\.[\d]+$)/
14
+
15
+ Scenario: Help
16
+ When I run `repo --help`
17
+ Then the exit status should be 0
18
+ And the output should match:
19
+ """
20
+ .*
21
+ Usage: .*
22
+ """
23
+
24
+ Scenario: Invalid option
25
+ When I run `repo --non-existing-option`
26
+ Then the exit status should be 1
27
+ And the output should match:
28
+ """
29
+ ^.* invalid option: --non-existing-option
30
+ ^.* --help for more information
31
+
32
+ """
33
+
34
+ Scenario: Invalid action
35
+ When I run `repo non-existing-action`
36
+ Then the exit status should be 1
37
+ And the output should match:
38
+ """
39
+ ^.* invalid action: non-existing-action
40
+ ^.* --help for more information
41
+
42
+ """
@@ -0,0 +1,218 @@
1
+ @announce
2
+ Feature: Logging to console and log files
3
+
4
+ The application outputs warnings and error messages on the console by
5
+ default. These same messages can be optionally logged to file.
6
+
7
+ Logging configuration is handled in the YAML config file. There are no
8
+ command line modifiers.
9
+
10
+ Configuration Notes:
11
+
12
+ Log levels can be one of: debug, info, warn, error, or fatal
13
+
14
+ All logging configuration is under the key "logging". Configuration
15
+ specified will overwrite the hard-coded defaults.
16
+
17
+ See the orginal test fixture here:
18
+ https://github.com/TwP/logging/blob/master/data/logging.yaml
19
+
20
+ Scenario: Debug output to console via the "--verbose" switch
21
+ Given a file named "repo.conf" with:
22
+ """
23
+ ---
24
+ """
25
+ When I run `repo help --verbose`
26
+ Then the output should contain:
27
+ """
28
+ DEBUG
29
+ """
30
+
31
+ Scenario: No debug output to console without the "--verbose" switch
32
+ Given a file named "repo.conf" with:
33
+ """
34
+ ---
35
+ """
36
+ When I run `repo help`
37
+ Then the output should not contain:
38
+ """
39
+ DEBUG
40
+ """
41
+
42
+ Scenario: No debug output to console using a config file that only specifies a
43
+ logger type of File
44
+ Given a file named "repo.conf" with:
45
+ """
46
+ ---
47
+ options:
48
+ color: true
49
+ logging:
50
+ loggers:
51
+ - name : root
52
+ appenders:
53
+ - logfile
54
+ appenders:
55
+ - type : File
56
+ name : logfile
57
+ level : debug
58
+ truncate : true
59
+ filename : 'temp.log'
60
+ layout:
61
+ type : Pattern
62
+ pattern : '[%d] %l %c : %m\n'
63
+ """
64
+ When I run `repo help`
65
+ Then the output should not contain:
66
+ """
67
+ DEBUG
68
+ """
69
+ And the file "temp.log" should contain:
70
+ """
71
+ DEBUG
72
+ """
73
+
74
+ Scenario: Overriding root level 'info' with '--verbose' to turn on 'debug' level
75
+ Given a file named "repo.conf" with:
76
+ """
77
+ ---
78
+ options:
79
+ color: true
80
+ logging:
81
+ loggers:
82
+ - name : root
83
+ appenders:
84
+ - logfile
85
+ appenders:
86
+ - type : File
87
+ name : logfile
88
+ level : info
89
+ truncate : true
90
+ filename : 'temp.log'
91
+ layout:
92
+ type : Pattern
93
+ pattern : '[%d] %l %c : %m\n'
94
+ """
95
+ When I run `repo help --verbose`
96
+ Then the output should not contain:
97
+ """
98
+ DEBUG
99
+ """
100
+ And the file "temp.log" should contain:
101
+ """
102
+ DEBUG
103
+ """
104
+
105
+
106
+ Scenario: Override default STDOUT appender level with a config file
107
+ Given a file named "repo.conf" with:
108
+ """
109
+ ---
110
+ logging:
111
+ loggers:
112
+ - name : root
113
+ appenders:
114
+ - logfile
115
+ - stdout
116
+ appenders:
117
+ - type : Stdout
118
+ name : stdout
119
+ level : debug
120
+ layout:
121
+ type : Pattern
122
+ pattern : '[%d] %l %c : %m\n'
123
+ color_scheme: default
124
+ - type : File
125
+ name : logfile
126
+ level : info
127
+ truncate : true
128
+ filename : 'temp.log'
129
+ layout:
130
+ type : Pattern
131
+ pattern : '[%d] %l %c : %m\n'
132
+ """
133
+ When I run `repo help`
134
+ Then the output should contain:
135
+ """
136
+ DEBUG
137
+ """
138
+ And the file "temp.log" should not contain:
139
+ """
140
+ DEBUG
141
+ """
142
+
143
+ Scenario: Stdout can be set to a different level than logfile
144
+ Given a file named "repo.conf" with:
145
+ """
146
+ ---
147
+ logging:
148
+ loggers:
149
+ - name : root
150
+ appenders:
151
+ - logfile
152
+ - stdout
153
+ appenders:
154
+ - type : Stdout
155
+ name : stdout
156
+ level : info
157
+ layout:
158
+ type : Pattern
159
+ pattern : '[%d] %l %c : %m\n'
160
+ color_scheme: default
161
+ - type : File
162
+ name : logfile
163
+ level : debug
164
+ truncate : true
165
+ filename : 'temp.log'
166
+ layout:
167
+ type : Pattern
168
+ pattern : '[%d] %l %c : %m\n'
169
+ """
170
+ When I run `repo help`
171
+ Then the output should not contain:
172
+ """
173
+ DEBUG
174
+ """
175
+ And the file "temp.log" should contain:
176
+ """
177
+ DEBUG
178
+ """
179
+
180
+ Scenario: Override default STDOUT appender level with a config file for debug output
181
+ Given a file named "repo.conf" with:
182
+ """
183
+ ---
184
+ logging:
185
+ loggers:
186
+ - name : root
187
+ appenders:
188
+ - logfile
189
+ - stdout
190
+ appenders:
191
+ - type : Stdout
192
+ name : stdout
193
+ level : info
194
+ layout:
195
+ type : Pattern
196
+ pattern : '[%d] %l %c : %m\n'
197
+ color_scheme: default
198
+ - type : File
199
+ name : logfile
200
+ level : info
201
+ truncate : true
202
+ filename : 'temp.log'
203
+ layout:
204
+ type : Pattern
205
+ pattern : '[%d] %l %c : %m\n'
206
+ """
207
+ When I run `repo help --verbose`
208
+ Then the output should contain:
209
+ """
210
+ DEBUG
211
+ """
212
+ And the file "temp.log" should contain:
213
+ """
214
+ DEBUG
215
+ """
216
+
217
+ @wip
218
+ Scenario: Logging to file with the truncate option
@@ -0,0 +1,240 @@
1
+ @announce
2
+ Feature: Configuration via YAML
3
+
4
+ The application should process configuration options via YAML. These options
5
+ should override hard coded defaults but not command line options.
6
+
7
+ Config files are read from multiple locations in order of priority. Once a
8
+ config file is found, all other config files are ignored.
9
+
10
+
11
+ Config file priority:
12
+
13
+ ./repo.conf
14
+ ./.repo.conf
15
+ ./repo_manager/repo.conf
16
+ ./.repo_manager/repo.conf
17
+ ~/.repo.conf
18
+ ~/repo.conf
19
+ ~/repo_manager/repo.conf
20
+ ~/.repo_manager/repo.conf
21
+
22
+ All command line options can be read from the config file from the "options:"
23
+ block. The "options" block is optional.
24
+
25
+ NOTE: All file system testing is done via the Aruba gem. The home folder
26
+ config file is stubbed to prevent testing contamination in case it exists.
27
+
28
+
29
+ Scenario: Specified config file exists
30
+ Given an empty file named "config.conf"
31
+ When I run `repo list --verbose --config config.conf`
32
+ Then the output should contain:
33
+ """
34
+ config file: config.conf
35
+ """
36
+
37
+ Scenario: Specified config file option but not given on command line
38
+ When I run `repo list --verbose --config`
39
+ Then the exit status should be 1
40
+ And the output should contain:
41
+ """
42
+ missing argument: --config
43
+ """
44
+
45
+ Scenario: Specified config file not found
46
+ When I run `repo path --verbose --config=config.conf`
47
+ Then the exit status should be 1
48
+ And the output should contain:
49
+ """
50
+ config file not found
51
+ """
52
+
53
+ Scenario: Ignoring the config file with the "--no-config" option
54
+ Given a file named "repo.conf" with:
55
+ """
56
+ ---
57
+ options:
58
+ color: true
59
+ """
60
+ When I run `repo list --verbose`
61
+ Then its output should contain:
62
+ """
63
+ :color=>true
64
+ """
65
+ When I run `repo list --verbose --no-config`
66
+ Then its output should contain:
67
+ """
68
+ :color=>"AUTO"
69
+ """
70
+ And its output should not contain:
71
+ """
72
+ :color=>true
73
+ """
74
+
75
+ Scenario: Reading options from specified config file, ignoring the
76
+ default config file
77
+ Given a file named "repo.conf" with:
78
+ """
79
+ ---
80
+ options:
81
+ color: true
82
+ """
83
+ And a file named "no_color.conf" with:
84
+ """
85
+ ---
86
+ options:
87
+ color: false
88
+ """
89
+ When I run `repo list --verbose --config no_color.conf`
90
+ Then the output should contain:
91
+ """
92
+ :color=>false
93
+ """
94
+ And the output should not contain:
95
+ """
96
+ :color=>true
97
+ """
98
+
99
+ Scenario: Reading options from specified config file, ignoring the
100
+ default config file with override on command line
101
+ Given a file named "repo.conf" with:
102
+ """
103
+ ---
104
+ options:
105
+ color: true
106
+ """
107
+ And a file named "no_color.conf" with:
108
+ """
109
+ ---
110
+ options:
111
+ color: false
112
+ """
113
+ When I run `repo list --verbose --config no_color.conf --color`
114
+ Then the output should contain:
115
+ """
116
+ :color=>"AUTO"
117
+ """
118
+ And the output should not contain:
119
+ """
120
+ :color=>false
121
+ """
122
+ And the output should not contain:
123
+ """
124
+ :color=>true
125
+ """
126
+
127
+ Scenario: Reading options from config file with negative override on command line
128
+ And a file named "with_color.conf" with:
129
+ """
130
+ ---
131
+ options:
132
+ color: true
133
+ """
134
+ When I run `repo list --verbose --config with_color.conf --no-color`
135
+ Then the output should contain:
136
+ """
137
+ :color=>false
138
+ """
139
+
140
+ Scenario: Negative override on command line with alternative spelling '--no-coloring'
141
+ And a file named "with_color.conf" with:
142
+ """
143
+ ---
144
+ options:
145
+ color: true
146
+ """
147
+ When I run `repo list --verbose --config with_color.conf --no-coloring`
148
+ Then the output should contain:
149
+ """
150
+ :color=>false
151
+ """
152
+
153
+ Scenario: Reading text options from config file
154
+ Given a file named "with_always_color.conf" with:
155
+ """
156
+ ---
157
+ options:
158
+ color: ALWAYS
159
+ """
160
+ When I run `repo list --verbose --config with_always_color.conf`
161
+ Then the output should contain:
162
+ """
163
+ :color=>"ALWAYS"
164
+ """
165
+
166
+ Scenario: Processing ERB
167
+ Given a file named "erb.conf" with:
168
+ """
169
+ ---
170
+ options:
171
+ color: <%= "ALWAYS" %>
172
+ """
173
+ When I run `repo list --verbose --config erb.conf`
174
+ Then the output should contain:
175
+ """
176
+ :color=>"ALWAYS"
177
+ """
178
+
179
+ Scenario: Reading default valid config files ordered by priority
180
+ Given a file named "repo.conf" with:
181
+ """
182
+ ---
183
+ user_var: user1
184
+ """
185
+ And a file named ".repo.conf" with:
186
+ """
187
+ ---
188
+ user_var: user2
189
+ """
190
+ And a file named "repo_manager/repo.conf" with:
191
+ """
192
+ ---
193
+ user_var: user3
194
+ """
195
+ When I run `repo list list=NAME --verbose`
196
+ Then the output should contain:
197
+ """
198
+ :user_var=>"user1"
199
+ """
200
+ And the output should not contain:
201
+ """
202
+ :user_var=>"user2"
203
+ """
204
+ And the output should not contain:
205
+ """
206
+ :user_var=>"user3"
207
+ """
208
+
209
+ Scenario: Reading default config file '.repo.conf'
210
+ Given a file named ".repo.conf" with:
211
+ """
212
+ ---
213
+ user_var: user2
214
+ """
215
+ And a file named "repo_manager/repo.conf" with:
216
+ """
217
+ ---
218
+ user_var: user3
219
+ """
220
+ When I run `repo list list=NAME --verbose`
221
+ Then the output should contain:
222
+ """
223
+ :user_var=>"user2"
224
+ """
225
+ And the output should not contain:
226
+ """
227
+ :user_var=>"user3"
228
+ """
229
+
230
+ Scenario: Reading default config file 'repo_manager/repo.conf
231
+ Given a file named "repo_manager/repo.conf" with:
232
+ """
233
+ ---
234
+ user_var: user3
235
+ """
236
+ When I run `repo list list=NAME --verbose`
237
+ Then the output should contain:
238
+ """
239
+ :user_var=>"user3"
240
+ """