silverstripe / silverstripe-travis-support

Creates a SilverStripe project "around" a module, based on core version constraints and its composer.json definitions
Other
13 stars 16 forks source link

Add support for --prefer-source Composer argument #35

Closed kinglozzer closed 8 years ago

kinglozzer commented 8 years ago

Note: this didn’t actually solve the problem below for me (as --prefer-source failed and fell back to dist, I’m looking into why - I think it may be a caching thing), but I thought this might be worth proposing anyway.

Problem: I have two packages, lets say Package A and Package B. Package A has a tests/TestCase.php, Package B depends on Package A and Package B’s test classes extend Package A’s TestCase:

// ./package-a/tests
class TestCase extends SapphireTest {
}

// ./package-b/tests
class SomeTest extends TestCase {
}

N.b: I’m not sure if this is a strange pattern? Doesn’t seem unreasonable to me...

If Package A has a .gitattributes that excludes the tests directory from exports, then composer install --prefer-dist will not include that directory either, so Package B’s tests will fail as TestCase doesn’t exist.

This PR adds the option to use --prefer-source for Composer installs, which clones the git repo so will include everything (it defaults to the current behaviour of --prefer-dist).

helpfulrobot commented 8 years ago

@kinglozzer, thanks for your PR! By analyzing the blame information on this pull request, I identified @sminnee and @chillu to be potential reviewers

codecov-io commented 8 years ago

Current coverage is 100%

Merging #35 into master will not change coverage

@@           master   #35   diff @@
===================================
  Files           1     1          
  Lines         115   115          
  Methods        12    12          
  Messages        0     0          
  Branches        0     0          
===================================
  Hits          115   115          
  Misses          0     0          
  Partials        0     0          

Powered by Codecov. Last updated by b49a345...17763e3

dhensby commented 8 years ago

This patch seems completely reasonable though i suspect you problem is the prefer-stable setting :/