Debian Codegraph @

Gemfile

raw
1 # THIS FILE IS AUTOGENERATED, DO NOT EDIT
2 require 'yaml'
3 require 'pathname'
4 def source_gems(gem_source, gems)
5 workspace_config_path = File.join(File.dirname(__FILE__), '..', 'Workspace.yaml')
6 workspace = File.file?(workspace_config_path) ? YAML.load_file(workspace_config_path) : {}
7 abort 'Workspace syntax error' unless workspace.is_a?(Hash)
8 gems.each do |gem_args|
9 found = false
10 gem_args = [gem_args] if gem_args.is_a?(String)
11 name = gem_args.first
12 begin gem *(gem_args << {:source => gem_source}); next end if workspace.nil?
13 env = (workspace['environment'] || 'production')
14 ((workspace['common'] || []) + ((workspace['environments'] || {})[env] || [])).each do |source_info|
15 (source_info['gems'] || []).each do |gem_info|
16 next unless name == (gem_info.is_a?(String) ? gem_info : gem_info['name'])
17 if !source_info['url'].nil?
18 gem *(gem_args << {:source => source_info['url']})
19 elsif !source_info['path'].nil?
20 path = gem_info['path'] || name
21 source_path = Pathname(source_info['path']).absolute? ? source_info['path'] : File.join('..', source_info['path'])
22 gem_path = Pathname(path).absolute? ? path : File.join(source_path, path)
23 Dir.chdir(gem_path) { abort "Can't bundle dependency from #{gem_path}" unless system('bundle') }
24 gem *(gem_args << {:path => gem_path})
25 elsif !source_info['git'].nil?
26 gem *(gem_args << {:git => (source_info['git'] + '/' + (gem_info['path'] || name)), :ref => gem_info['ref'],
27 :branch => gem_info['branch'], :tag => gem_info['tag']})
28 else
29 abort "Unknown source type #{source_info.to_s}"
30 end
31 found = true
32 break
33 end
34 break if found
35 end
36 gem *(gem_args << {:source => gem_source}) unless found
37 end
38 end
39
40 require 'yaml'
41 project = YAML.load(File.read(File.join(File.dirname(__FILE__), 'Project.yaml')))
42 deps = project['dependencies'] || {}
43 deps =
44 if deps.is_a?(Hash)
45 deps
46 else
47 {'http://rubygems.org' => deps}
48 end
49 is_gem = project['is_gem'].nil? ? true : project['is_gem']
50 deps.each do |source, gems|
51 source_gems(source, gems.map do |d|
52 if d.is_a?(String)
53 d
54 else
55 if is_gem
56 d['name']
57 else
58 dep_args = [d['name']]
59 dep_args.concat(if d['version'].nil?; []; else d['version'].is_a?(String) ? [d['version']] : d['version'] end)
60 dep_args
61 end
62 end
63 end)
64 end
65 if is_gem
66 source "https://rubygems.org"
67 gemspec :name => project['name'], :path => File.dirname(__FILE__)
68 end