Module: Rwm::GemfileDsl
- Defined in:
- lib/rwm/gemfile.rb
Instance Method Summary collapse
Instance Method Details
#rwm_lib(name, **opts) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/rwm/gemfile.rb', line 35 def rwm_lib(name, **opts) name = name.to_s @rwm_resolved ||= Set.new return if @rwm_resolved.include?(name) @rwm_resolved.add(name) Rwm.resolved_libs.add(name) path = File.join(rwm_workspace_root, "libs", name) gem(name, **opts, path: path) # Resolve transitive workspace deps from the target lib's Gemfile target_gemfile = File.join(path, "Gemfile") return unless File.exist?(target_gemfile) scan_transitive_deps(target_gemfile).each { |dep_name| rwm_lib(dep_name) } end |
#rwm_workspace_root ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/rwm/gemfile.rb', line 26 def rwm_workspace_root @rwm_workspace_root ||= begin out, _, status = Open3.capture3("git", "rev-parse", "--show-toplevel") root = status.success? ? out.strip : "" raise "rwm: not inside a git repository" if root.empty? root end end |