birr 0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,83 @@
1
+ require 'hashie'
2
+ # loads the workarea into keys/value eg: package/rails => ~/<your_install_file_dir>/package/rails
3
+ class Megam
4
+ class WorkAreaLoader
5
+
6
+ attr_reader :workarea_preconfig # a hash the preconfig mapping eg: you => ~/megam_install/you
7
+ attr_reader :workarea_by_name # a Mash, indexed on name.
8
+ attr_reader :workarea_paths
9
+
10
+ include Enumerable
11
+
12
+ def initialize(*workarea_repo_paths)
13
+ workarea_repo_paths = workarea_repo_paths.flatten
14
+ raise ArgumentError, "You must specify at least one workarea repo path" if workarea_repo_paths.empty?
15
+ @workarea_by_name = Hashie::Mash.new
16
+ @workarea_paths = Hash.new {|h,k| h[k] = []}
17
+ @workarea_preconfig = Hash.new {|h,k| h[k] = []}
18
+ @transferarea_paths = Hash.new {|h,k| h[k] = []}
19
+
20
+ @workarea_repo_paths = workarea_repo_paths.map do |val|
21
+ temp_val = File.join(Megam::WorkArea.workarea_install_directory,val)
22
+ @workarea_preconfig[val] = temp_val
23
+ val = temp_val
24
+ end
25
+ load_workarea_repos
26
+ end
27
+
28
+ def load_workarea_repos
29
+ @workarea_repo_paths.each do |repo_path|
30
+ Dir[File.join(repo_path, "*")].each do |first_level_path|
31
+ load_workarea_repo(File.basename(first_level_path), [repo_path])
32
+ Dir[File.join(first_level_path, "*")].each do |work_repo_path|
33
+ next unless File.directory?(work_repo_path)
34
+ load_workarea_repo(File.basename(work_repo_path), [first_level_path])
35
+ end
36
+ end
37
+ end
38
+ @workarea_by_name
39
+ end
40
+
41
+ def load_workarea_repo(work_repo_name, repo_paths=nil)
42
+ repo_paths ||= @workarea_repo_paths
43
+ work_repo_key = nil
44
+
45
+ repo_paths.each do |repo_path|
46
+ workarea_repo = File.join(repo_path, work_repo_name.to_s)
47
+ next unless File.directory?(workarea_repo) and Dir[File.join(repo_path, "**")].include?(workarea_repo)
48
+ work_repo_key = workarea_repo.dup.gsub(Megam::WorkArea.workarea_install_directory + File::SEPARATOR ,"") #remove the extra slash
49
+ @workarea_paths[work_repo_key] << workarea_repo
50
+ @workarea_by_name[work_repo_key] = workarea_repo
51
+ end
52
+ @workarea_by_name[work_repo_key]
53
+ end
54
+
55
+
56
+ def [](workarea)
57
+ if @workarea_by_name.has_key?(workarea.to_sym) or load_workarea_repo(workarea.to_sym)
58
+ @workarea_by_name[workarea.to_sym]
59
+ else
60
+ raise Exceptions::WorkAreaNotFound, "Cannot find a workarea named #{workarea.to_s}; did you forget to add it in WORKAREA_INSTALL_DIR variable ?"
61
+ end
62
+ end
63
+
64
+ alias :fetch :[]
65
+
66
+ def has_key?(workarea_name)
67
+ not self[workarea_name.to_sym].nil?
68
+ end
69
+
70
+ alias :key? :has_key?
71
+
72
+ def each
73
+ @workarea_by_name.keys.sort { |a,b| a.to_s <=> b.to_s }.each do |cname|
74
+ yield(cname, @workarea_by_name[cname])
75
+ end
76
+ end
77
+
78
+ def workarea_names
79
+ @workarea_by_name.keys.sort
80
+ end
81
+
82
+ end
83
+ end
@@ -0,0 +1,18 @@
1
+ require 'megam/Birr'
2
+ require 'yaml'
3
+
4
+
5
+ describe "RSPEC for Birr help" do
6
+
7
+ it "Birr new" do
8
+ @id = Megam::Birr.new
9
+ @id.run.should raise_error()
10
+ end
11
+
12
+
13
+ it "Birr new" do
14
+ @id = Megam::Birr.new
15
+ @id.run.should raise_error()
16
+ end
17
+
18
+ end
metadata ADDED
@@ -0,0 +1,298 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: birr
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.1'
5
+ platform: ruby
6
+ authors:
7
+ - Kishore
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-03-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: mixlib-config
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: 1.1.2
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: 1.1.2
27
+ - !ruby/object:Gem::Dependency
28
+ name: mixlib-cli
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 1.3.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: 1.3.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: mixlib-log
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: 1.3.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: 1.3.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: mixlib-authentication
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: 1.3.0
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: 1.3.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: mixlib-shellout
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: hashie
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: ruby-progressbar
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: highline
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '>='
116
+ - !ruby/object:Gem::Version
117
+ version: 1.6.9
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '>='
123
+ - !ruby/object:Gem::Version
124
+ version: 1.6.9
125
+ - !ruby/object:Gem::Dependency
126
+ name: rdoc
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - '>='
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: sdoc
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - '>='
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - '>='
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: rake
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - '>='
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - '>='
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: rack
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - '>='
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - '>='
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: rspec_junit_formatter
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - '>='
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - '>='
193
+ - !ruby/object:Gem::Version
194
+ version: '0'
195
+ - !ruby/object:Gem::Dependency
196
+ name: rspec-core
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - '>='
200
+ - !ruby/object:Gem::Version
201
+ version: 2.13.0
202
+ type: :development
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - '>='
207
+ - !ruby/object:Gem::Version
208
+ version: 2.13.0
209
+ - !ruby/object:Gem::Dependency
210
+ name: rspec-expectations
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - '>='
214
+ - !ruby/object:Gem::Version
215
+ version: 2.13.0
216
+ type: :development
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - '>='
221
+ - !ruby/object:Gem::Version
222
+ version: 2.13.0
223
+ - !ruby/object:Gem::Dependency
224
+ name: rspec-mocks
225
+ requirement: !ruby/object:Gem::Requirement
226
+ requirements:
227
+ - - '>='
228
+ - !ruby/object:Gem::Version
229
+ version: 2.13.0
230
+ type: :development
231
+ prerelease: false
232
+ version_requirements: !ruby/object:Gem::Requirement
233
+ requirements:
234
+ - - '>='
235
+ - !ruby/object:Gem::Version
236
+ version: 2.13.0
237
+ description: Command-line tool to setup your work area quickly and easily. Automate
238
+ the repetitive steps that you would use to install. Read http://blog.megam.co/archives/485
239
+ email: nkishore@megam.co.in
240
+ executables:
241
+ - birr
242
+ extensions: []
243
+ extra_rdoc_files:
244
+ - README.md
245
+ - LICENSE
246
+ files:
247
+ - Rakefile
248
+ - LICENSE
249
+ - README.md
250
+ - lib/megam/birr_options.rb
251
+ - lib/megam/version.rb
252
+ - lib/megam/config.rb
253
+ - lib/megam/workarea_loader.rb
254
+ - lib/megam/app.rb
255
+ - lib/megam/workarea.rb
256
+ - lib/megam/transferarea.rb
257
+ - lib/megam/cmd_verb.rb
258
+ - lib/megam/birr.rb
259
+ - lib/megam/core/file_cache.rb
260
+ - lib/megam/core/text.rb
261
+ - lib/megam/core/log.rb
262
+ - lib/megam/core/exceptions.rb
263
+ - lib/megam/install.rb
264
+ - lib/birr.rb
265
+ - spec/dump_spec.rb
266
+ - bin/birr
267
+ homepage: http://github.com/indykish/birr
268
+ licenses:
269
+ - Apache V2
270
+ metadata: {}
271
+ post_install_message: "! The `Birr` gem has been installed. \n! To run it, setup your
272
+ work_area, and run birr -i <workarea>/install.rb.\n! For detail instructions : https://github.com/indykish/Birr.git\n"
273
+ rdoc_options:
274
+ - --line-numbers
275
+ - --inline-source
276
+ - --title
277
+ - Uniquify
278
+ - --main
279
+ - README.rdoc
280
+ require_paths:
281
+ - lib
282
+ required_ruby_version: !ruby/object:Gem::Requirement
283
+ requirements:
284
+ - - '>='
285
+ - !ruby/object:Gem::Version
286
+ version: '0'
287
+ required_rubygems_version: !ruby/object:Gem::Requirement
288
+ requirements:
289
+ - - '>='
290
+ - !ruby/object:Gem::Version
291
+ version: '0'
292
+ requirements: []
293
+ rubyforge_project:
294
+ rubygems_version: 2.0.3
295
+ signing_key:
296
+ specification_version: 4
297
+ summary: A DSL - CLI which eases setting up your workstation from a clean state.
298
+ test_files: []