Class: BundleHack::GemCloner
- Inherits:
-
Object
- Object
- BundleHack::GemCloner
- Defined in:
- lib/bundle_hack/gem_cloner.rb
Instance Method Summary collapse
- #clone ⇒ Object
-
#initialize(gem, root_path) ⇒ GemCloner
constructor
A new instance of GemCloner.
Constructor Details
#initialize(gem, root_path) ⇒ GemCloner
Returns a new instance of GemCloner.
5 6 7 8 |
# File 'lib/bundle_hack/gem_cloner.rb', line 5 def initialize(gem, root_path) @gem = gem @root_path = root_path end |
Instance Method Details
#clone ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/bundle_hack/gem_cloner.rb', line 10 def clone hack_dir = @root_path.join(HACK_DIR) FileUtils.mkdir_p(hack_dir) # Sadly there is no `FileUtils.cp_R` so we copy and rename instead FileUtils.cp_r(@gem.path, hack_dir) FileUtils.mv(hack_dir.join(@gem.full_name), hack_dir.join(@gem.name)) end |