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,127 @@
1
+ @announce
2
+ Feature: Invoke external tasks, normally Thor tasks.
3
+
4
+ Tasks can be defined by the app and placed in lib/tasks or tasks can be
5
+ defined by the user and placed in the user tasks folder.
6
+
7
+ Examples
8
+
9
+ repo task test:init /to/some/folder
10
+
11
+ Task action is not required
12
+
13
+ repo test:init /to/some/folder
14
+
15
+ Add user tasks by specifying folders.tasks in the master config file
16
+ and add Thor tasks. See background scenario.
17
+
18
+ Background: A master configuration file
19
+ Given a file named "repo.conf" with:
20
+ """
21
+ ---
22
+ options:
23
+ color : true
24
+ folders:
25
+ assets : repo_manager/assets
26
+ tasks : repo_manager/tasks
27
+ """
28
+ And an empty file named "output/.gitignore"
29
+ And a file named "repo_manager/tasks/test.rb" with:
30
+ """
31
+ module RepoManager
32
+ class Test < Thor
33
+ namespace :test
34
+
35
+ desc "init", "a test init task"
36
+ def init(path)
37
+ say path
38
+ return 0
39
+ end
40
+
41
+ end
42
+ end
43
+ """
44
+ And a file named "repo_manager/tasks/test.thor" with:
45
+ """
46
+ module RepoManager
47
+ class TestB < Thor
48
+
49
+ desc "hello", "a test hello task"
50
+ def hello(message)
51
+ say message
52
+ return 0
53
+ end
54
+
55
+ end
56
+ end
57
+ """
58
+
59
+ Scenario: Listings available tasks from gem and user task locations
60
+ When I run `repo task -T --verbose`
61
+ Then the exit status should be 0
62
+ And the output should not contain:
63
+ """
64
+ thor generate:configs FOLDER
65
+ """
66
+ And the output should contain:
67
+ """
68
+ repo test:init
69
+ """
70
+ And the output should contain:
71
+ """
72
+ repo repo_manager:test_b:hello
73
+ """
74
+
75
+ Scenario: Listings available tasks without the 'task' action
76
+ When I run `repo -T`
77
+ Then the exit status should be 0
78
+ And the output should contain:
79
+ """
80
+ repo test:init
81
+ """
82
+
83
+ Scenario: Show help for a given task
84
+ When I run `repo task help test:init`
85
+ Then the exit status should be 0
86
+ Then the output should contain:
87
+ """
88
+ Usage:
89
+ repo test:init
90
+
91
+ a test init task
92
+ """
93
+
94
+ Scenario: Show help for a given task without the 'task' action
95
+ When I run `repo help test:init`
96
+ Then the exit status should be 0
97
+ Then the output should contain:
98
+ """
99
+ Usage:
100
+ repo test:init
101
+
102
+ a test init task
103
+ """
104
+
105
+ Scenario: Successful task run without the 'repo_manager:' namespace
106
+ When I run `repo task test:init my_path`
107
+ Then the exit status should be 0
108
+ Then the output should contain:
109
+ """
110
+ my_path
111
+ """
112
+
113
+ Scenario: Successful task run without the 'task' action
114
+ When I run `repo test:init my_path`
115
+ Then the exit status should be 0
116
+ Then the output should contain:
117
+ """
118
+ my_path
119
+ """
120
+
121
+ Scenario: Successful task run with the 'repo_manager:' namespace
122
+ When I run `repo task repo_manager:test_b:hello my_message`
123
+ Then the exit status should be 0
124
+ Then the output should contain:
125
+ """
126
+ my_message
127
+ """
@@ -0,0 +1,204 @@
1
+ @announce
2
+ Feature: Asset configuration
3
+
4
+ The application should process and manage asset configuration via YAML.
5
+
6
+ A list of assets can be found by globbing '*/' in the data folder to return a
7
+ list of folder names.
8
+
9
+ For each asset in the data folder, initialize an array of assets by passing
10
+ in the user asset config filename and a hash of options
11
+
12
+ Example general settings repo.conf
13
+
14
+ ---
15
+ options:
16
+ color : true
17
+ user:
18
+ my_str : "user defined string"
19
+ my_int : 12345
20
+ folders:
21
+ assets : data
22
+
23
+ Example with parent: config/data/assets/asset1/asset.conf:
24
+
25
+ ---
26
+ parent : ../../global/assets/asset1
27
+ acquired : 01/01/2011
28
+ launched : 01/01/2011
29
+
30
+ Example without parent: config/data/assets/asset1/asset.conf:
31
+
32
+ ---
33
+ acquired : 01/01/2011
34
+ launched : 01/01/2011
35
+
36
+ Scenario: Specify assets folder explicity
37
+ Given a file named "repo.conf" with:
38
+ """
39
+ ---
40
+ folders:
41
+ assets : data/app_assets
42
+ """
43
+ And a file named "data/app_assets/asset1/asset.conf" with:
44
+ """
45
+ ---
46
+ path: user_path
47
+ """
48
+ When I run `repo list --type=app_asset`
49
+ Then the exit status should be 0
50
+ And its output should not match /^WARN/
51
+ Then the output should contain:
52
+ """
53
+ path: user_path
54
+ """
55
+
56
+ Scenario: Specify assets folder explicity using a subfolder for the config file
57
+ Given a file named "repo_manager/repo.conf" with:
58
+ """
59
+ ---
60
+ folders:
61
+ assets : data/app_assets
62
+ """
63
+ And a file named "repo_manager/data/app_assets/asset1/asset.conf" with:
64
+ """
65
+ ---
66
+ path: user_path
67
+ """
68
+ When I run `repo list --type=app_asset`
69
+ Then the exit status should be 0
70
+ And its output should not match /^WARN/
71
+ Then the output should contain:
72
+ """
73
+ path: user_path
74
+ """
75
+
76
+ Scenario: Assets folder determined by convention, relative to config file, by convention the folder name is 'assets'
77
+ Given a file named "repo.conf" with:
78
+ """
79
+ ---
80
+ options:
81
+ color : AUTO
82
+ """
83
+ And a file named "assets/asset1/asset.conf" with:
84
+ """
85
+ ---
86
+ path: user_path
87
+ """
88
+ When I run `repo list --type=app_asset`
89
+ Then the exit status should be 0
90
+ And its output should not match /^WARN/
91
+ Then the output should contain:
92
+ """
93
+ path: user_path
94
+ """
95
+
96
+ Scenario: Config file is located in a subfolder
97
+ Given a file named "repo_manager/repo.conf" with:
98
+ """
99
+ ---
100
+ options:
101
+ color : AUTO
102
+ """
103
+ And a file named "repo_manager/assets/asset1/asset.conf" with:
104
+ """
105
+ ---
106
+ path: user_path
107
+ """
108
+ When I run `repo list --type=app_asset`
109
+ Then the exit status should be 0
110
+ And its output should not match /^WARN/
111
+ Then the output should contain:
112
+ """
113
+ path: user_path
114
+ """
115
+
116
+ Scenario: Parent configuration fills in missing items with ERB evaluation
117
+ Given a file named "repo.conf" with:
118
+ """
119
+ ---
120
+ folders:
121
+ assets : data/app_assets
122
+ """
123
+ And the folder "global/app_assets" with the following asset configurations:
124
+ | name | path | icon |
125
+ | default | set_by_parent | based_on_<%= name %>.png |
126
+ And the folder "data/app_assets" with the following asset configurations:
127
+ | name | parent | binary |
128
+ | asset1 | ../../global/app_assets/default | path_to/bin.exe |
129
+ When I run `repo list --type=app_asset`
130
+ Then the exit status should be 0
131
+ And its output should not match /^WARN/
132
+ And the output should contain:
133
+ """
134
+ path: set_by_parent
135
+ """
136
+ And the output should contain:
137
+ """
138
+ icon: based_on_asset1.png
139
+ """
140
+
141
+ Scenario: User configuration file overrides global configuration file
142
+ Given a file named "repo.conf" with:
143
+ """
144
+ ---
145
+ folders:
146
+ assets : data/app_assets
147
+ """
148
+ And the folder "global/app_assets" with the following asset configurations:
149
+ | name | path |
150
+ | default | set_by_parent |
151
+ And the folder "data/app_assets" with the following asset configurations:
152
+ | name | path | parent | binary |
153
+ | asset1 | set_by_user | ../../global/app_assets/default | path_to/bin.exe |
154
+ When I run `repo list --type=app_asset`
155
+ Then the exit status should be 0
156
+ And its output should not match /^WARN/
157
+ And the output should contain:
158
+ """
159
+ path: set_by_user
160
+ """
161
+ And the output should not contain:
162
+ """
163
+ path: set_by_parent
164
+ """
165
+
166
+ Scenario: Parent configuration missing
167
+ Given a file named "repo.conf" with:
168
+ """
169
+ ---
170
+ folders:
171
+ assets : data/app_assets
172
+ """
173
+ And the folder "data/app_assets" with the following asset configurations:
174
+ | name | parent | path |
175
+ | asset1 | ../../global/app_assets/default | path_to/bin.exe |
176
+ When I run `repo list --type=app_asset`
177
+ Then the exit status should be 0
178
+ And its output should not match /^WARN/
179
+ And the output should contain:
180
+ """
181
+ path: path_to/bin.exe
182
+ """
183
+
184
+ Scenario: Parent configuration blank
185
+ Given a file named "repo.conf" with:
186
+ """
187
+ ---
188
+ folders:
189
+ assets : assets
190
+ """
191
+ And the folder "assets" with the following asset configurations:
192
+ | name | parent | path |
193
+ | asset1 | ../global/default | path_to/bin.exe |
194
+ And a file named "global/default/asset.conf" with:
195
+ """
196
+ ---
197
+ """
198
+ When I run `repo list --verbose --type=app_asset`
199
+ Then the exit status should be 0
200
+ And its output should not match /^WARN/
201
+ And its output should contain:
202
+ """
203
+ path: path_to/bin.exe
204
+ """
@@ -0,0 +1,42 @@
1
+ @announce
2
+ Feature: Asset template rendering
3
+
4
+ Assets should render Mustache variables. When listing to STDOUT without a
5
+ template, the raw attribute will be shown.
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: Render templates to STDOUT
11
+ Given a file named "test.erb" with:
12
+ """
13
+ <% require 'repo_manager/actions/action_helper' -%>
14
+ <% extend RepoManager::ActionHelper -%>
15
+
16
+ <% for item in items do -%>
17
+ <%= item.name %>:
18
+ ---
19
+ path: <%= relative_path(item.path) %>
20
+ <% end -%>
21
+ """
22
+ And a file named "assets/asset1/asset.conf" with:
23
+ """
24
+ ---
25
+ path: folder/{{name}}/another_folder
26
+ """
27
+ When I run `repo list --type=app_asset`
28
+ Then the exit status should be 0
29
+ And its output should contain:
30
+ """
31
+ path: folder/{{name}}/another_folder
32
+ """
33
+ When I run `repo list --template=test.erb --type=app_asset`
34
+ Then the exit status should be 0
35
+ And its output should not contain:
36
+ """
37
+ path: folder/{{name}}/another_folder
38
+ """
39
+ And its output should contain:
40
+ """
41
+ path: ./folder/asset1/another_folder
42
+ """
@@ -0,0 +1,98 @@
1
+ @announce
2
+ Feature: Create user defined attributes
3
+
4
+ The user can create an array of attribute names that will
5
+ be converted into read/write accessors at instantiation. This
6
+ allows using user defined attributes via Mustache tags in user
7
+ defined tasks.
8
+
9
+ Example defining user attributes
10
+
11
+ ---
12
+ user_attributes:
13
+ - my_folder
14
+ my_folder: folder name
15
+ path: folder/{{my_folder}}/another_folder
16
+
17
+ For simple variable replacement, there is no need to predefine the
18
+ Mustache tags variables.
19
+
20
+ Example ad hoc user attributes
21
+
22
+ ---
23
+ my_folder: folder name
24
+ path: folder/{{my_folder}}/another_folder
25
+
26
+ Background: Master config file and ERB template
27
+ Given a file named "repo.conf" with:
28
+ """
29
+ ---
30
+ folders:
31
+ assets : assets
32
+ """
33
+ And a file named "test.erb" with:
34
+ """
35
+ <% require 'repo_manager/actions/action_helper' -%>
36
+ <% extend RepoManager::ActionHelper -%>
37
+
38
+ <% for item in items do -%>
39
+ <%= item.name %>:
40
+ ---
41
+ path: <%= relative_path(item.path) %>
42
+ <% end -%>
43
+ """
44
+
45
+ Scenario: Using user attributes with pre-defined read/write accessors
46
+ Given a file named "global/assets/default/asset.conf" with:
47
+ """
48
+ ---
49
+ user_attributes:
50
+ - my_folder
51
+ """
52
+ And a file named "assets/asset1/asset.conf" with:
53
+ """
54
+ ---
55
+ parent: ../global/assets/default
56
+ my_folder: folder name
57
+ path: folder/{{my_folder}}/another_folder
58
+ """
59
+ When I run `repo list --type=app_asset --verbose`
60
+ Then the exit status should be 0
61
+ And its output should contain:
62
+ """
63
+ path: folder/{{my_folder}}/another_folder
64
+ """
65
+ When I run `repo list --template=test.erb --type=app_asset --verbose`
66
+ Then the exit status should be 0
67
+ And its output should not contain:
68
+ """
69
+ path: folder/{{my_folder}}/another_folder
70
+ """
71
+ And its output should contain:
72
+ """
73
+ path: ./folder/folder name/another_folder
74
+ """
75
+
76
+ Scenario: Using user attributes with ad hoc template variable expansion
77
+ Given a file named "assets/asset1/asset.conf" with:
78
+ """
79
+ ---
80
+ my_folder: folder name
81
+ path: folder/{{my_folder}}/another_folder
82
+ """
83
+ When I run `repo list --type=app_asset --verbose`
84
+ Then the exit status should be 0
85
+ And its output should contain:
86
+ """
87
+ path: folder/{{my_folder}}/another_folder
88
+ """
89
+ When I run `repo list --template=test.erb --type=app_asset --verbose`
90
+ Then the exit status should be 0
91
+ And its output should not contain:
92
+ """
93
+ path: folder/{{my_folder}}/another_folder
94
+ """
95
+ And its output should contain:
96
+ """
97
+ path: ./folder/folder name/another_folder
98
+ """