diff --git a/.travis.yml b/.travis.yml index 9bcf7bc..20a49ec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ matrix: allow_failures: - php: hhvm -install: travis_retry composer install --no-interaction --prefer-source +install: travis_retry composer install --no-interaction -script: vendor/bin/phpunit +script: make test diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..0a4c633 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,74 @@ +# CHANGELOG + +## next release + +* Added test coverage for version 5.2 of both Lumen and Laravel. + +## 3.0.3 - 2015-09-18 + +* Added support for configuring credentials with environmental variables, a ini + file at `~/.aws/credentials`, or with Ec2 instance profiles instead of + requiring their inclusion in the `aws.php` config file. + +## 3.0.3 - 2015-08-10 + +* Removed usage of a dev dependency + +## 3.0.1 - 2015-08-05 + +* Provide version information to SDK user agent + +## 3.0.0 - 2015-06-10 + +* Service provider is now compatible with Laravel 5.1 and Version 3 of the AWS + SDK for PHP. + +## 2.0.1 - 2015-06-10 + +* Service provider is now compatible with Lumen + +## 2.0.0 - 2015-03-12 + +* Updated the service provider to work with Laravel 5. + +## 1.1.2 - 2015-02-13 + +* Added alias to support DI from container. + +## 1.1.1 - 2014-05-12 + +* Updated default module config file to make it more compatible with environment + credentials + +## 1.1.0 - 2013-09-03 + +* Added package-level config that can be published with Artisan +* Updated config loading logic to support package-level config +* Updated config loading logic to support AWS SDK for PHP config files via the + `config_file` key +* Updated code, tests, and the README to support the config refactoring +* This module is now following [semver](http://semver.org/) + +## 1.0.4 - 2013-06-20 + +* Added support for the AWS facade +* Updated `composer.json` to require only specific components of Laravel +* Updated `composer.json` to require version 2.2+ of the AWS SDK for PHP + +## 1.0.3 - 2013-04-25 + +* Update Composer dependencies to work with newer version of the AWS SDK for PHP + and Laravel + +## 1.0.2 - 2013-03-11 + +* Fixed an issue with config retrieval + +## 1.0.1 - 2013-03-07 + +* Improved usage instructions in the README +* Fixed logic for retrieving Laravel version + +## 1.0.0 - 2013-02-13 + +* Initial release. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..327cf0f --- /dev/null +++ b/Makefile @@ -0,0 +1,41 @@ +test: test-laravel test-lumen + +test-laravel: + composer require laravel/framework + vendor/bin/phpunit + make uninstall-laravel + +test-lumen: + composer require laravel/lumen-framework + vendor/bin/phpunit + make uninstall-lumen + +uninstall-illuminate: + rm -rf vendor/laravel + rm -rf vendor/illuminate + +uninstall-laravel: uninstall-illuminate + composer remove laravel/framework + +uninstall-lumen: uninstall-illuminate + composer remove laravel/lumen-framework + +# Ensures that the TAG variable was passed to the make command +check-tag: + $(if $(TAG),,$(error TAG is not defined. Pass via "make tag TAG=4.2.1")) + +# Creates a release but does not push it. This task updates the changelog +# with the TAG environment variable, replaces the VERSION constant, ensures +# that the source is still valid after updating, commits the changelog and +# updated VERSION constant, creates an annotated git tag using chag, and +# prints out a diff of the last commit. +tag: check-tag test + @echo Tagging $(TAG) + chag update $(TAG) + sed -i '' -e "s/VERSION = '.*'/VERSION = '$(TAG)'/" src/AwsServiceProvider.php + php -l src/AwsBundle.php + git commit -a -m '$(TAG) release' + chag tag + @echo "Release has been created. Push using 'make release'" + @echo "Changes made in the release commit" + git diff HEAD~1 HEAD diff --git a/composer.json b/composer.json index 5f4e83d..35d20ee 100644 --- a/composer.json +++ b/composer.json @@ -17,8 +17,11 @@ "illuminate/support": "~5.1" }, "require-dev": { - "laravel/framework": "~5.1", - "phpunit/phpunit": "~4.0" + "phpunit/phpunit": "~4.0|~5.0" + }, + "suggest": { + "laravel/framework": "To test the Laravel bindings", + "laravel/lumen-framework": "To test the Lumen bindings" }, "autoload": { "psr-4": { "Aws\\Laravel\\": "src/" } diff --git a/src/AwsServiceProvider.php b/src/AwsServiceProvider.php index 1eb8e73..3167d17 100644 --- a/src/AwsServiceProvider.php +++ b/src/AwsServiceProvider.php @@ -1,7 +1,9 @@ app instanceof LaravelApplication && $this->app->runningInConsole()) { $this->publishes([$source => config_path('aws.php')]); + } elseif ($this->app instanceof LumenApplication) { + $this->app->configure('aws'); } $this->mergeConfigFrom($source, 'aws'); @@ -41,7 +45,8 @@ public function boot() public function register() { $this->app->singleton('aws', function ($app) { - $config = $app['config']->get('aws'); + $config = $app->make('config')->get('aws'); + return new Sdk($config); }); diff --git a/tests/AwsServiceProviderTest.php b/tests/AwsServiceProviderTest.php index 2216f4d..3686345 100644 --- a/tests/AwsServiceProviderTest.php +++ b/tests/AwsServiceProviderTest.php @@ -2,10 +2,9 @@ use Aws\Laravel\AwsFacade as AWS; use Aws\Laravel\AwsServiceProvider; -use Illuminate\Config\Repository; -use Illuminate\Foundation\Application; +use Illuminate\Container\Container; -class AwsServiceProviderTest extends \PHPUnit_Framework_TestCase +abstract class AwsServiceProviderTest extends \PHPUnit_Framework_TestCase { public function testFacadeCanBeResolvedToServiceInstance() @@ -61,24 +60,16 @@ public function testVersionInformationIsProvidedToSdkUserAgent() } /** - * @return Application + * @return Container */ - private function setupApplication() - { - // Create the application such that the config is loaded. - $app = new Application(); - $app->setBasePath(sys_get_temp_dir()); - $app->instance('config', new Repository()); - - return $app; - } + abstract protected function setupApplication(); /** - * @param Application $app + * @param Container $app * * @return AwsServiceProvider */ - private function setupServiceProvider(Application $app) + private function setupServiceProvider(Container $app) { // Create and register the provider. $provider = new AwsServiceProvider($app); @@ -87,5 +78,4 @@ private function setupServiceProvider(Application $app) return $provider; } - } diff --git a/tests/LaravelAwsServiceProviderTest.php b/tests/LaravelAwsServiceProviderTest.php new file mode 100644 index 0000000..85f24d6 --- /dev/null +++ b/tests/LaravelAwsServiceProviderTest.php @@ -0,0 +1,26 @@ +markTestSkipped(); + } + + parent::setUp(); + } + + protected function setupApplication() + { + // Create the application such that the config is loaded. + $app = new Application(); + $app->setBasePath(sys_get_temp_dir()); + $app->instance('config', new Repository()); + + return $app; + } +} diff --git a/tests/LumenAwsServiceProviderTest.php b/tests/LumenAwsServiceProviderTest.php new file mode 100644 index 0000000..ff301c4 --- /dev/null +++ b/tests/LumenAwsServiceProviderTest.php @@ -0,0 +1,26 @@ +markTestSkipped(); + } + + parent::setUp(); + } + + protected function setupApplication() + { + // Create the application such that the config is loaded. + $app = new Application(sys_get_temp_dir()); + $app->instance('config', new Repository()); + + return $app; + } +}