Skip to content
This repository has been archived by the owner on Nov 16, 2021. It is now read-only.

Commit

Permalink
Core media migration alpha1
Browse files Browse the repository at this point in the history
  • Loading branch information
balsama committed Oct 23, 2017
1 parent 43b84c6 commit ffb25ea
Show file tree
Hide file tree
Showing 197 changed files with 1,308 additions and 1,544 deletions.
20 changes: 10 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ php:
- 7.0.22
env:
- VERSION=HEAD
- VERSION=2.2.1-alpha1
- VERSION=2.2.0
- VERSION=2.1.8
- VERSION=2.1.7
- VERSION=2.1.6

addons:
apt:
Expand Down Expand Up @@ -76,24 +76,24 @@ install:
- composer install
# Install Lightning cleanly so that settings.php will be created properly.
- phing install -Ddb.database=drupal -Ddb.user=lightning -Ddb.password=lightning -Ddb.host=127.0.0.1 -Durl=http://127.0.0.1:8080
# Import the fixture, if it exists.
- phing recall -Dversion=$VERSION -Ddb.database=drupal -Ddb.user=lightning -Ddb.password=lightning -Ddb.host=127.0.0.1
- cd docroot
# Execute database updates, if there are any.
- drupal update:execute
# Execute manual updates.
- drupal update:lightning --no-interaction --since=$VERSION
# Restore and update from the previous version.
- robo update $VERSION

before_script:
- drush runserver --default-server=builtin 8080 &>/dev/null &
- jdk_switcher use oraclejdk8
- sleep 5

script:
- composer validate ../composer.json --no-check-all --ansi --no-interaction
- composer validate composer.json --no-check-all --ansi --no-interaction
- cd docroot
- phpunit --configuration ./core --group lightning
- cd ..
- bin/robo test:behat
- bin/robo test:behat -- --stop-on-failure

after_failure:
- cd docroot
- drush watchdog:show --count=100 --severity=Error --extended

matrix:
fast_finish: true
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 2.2.1
* Lightning Media has been updated to use the new Core Media entity.
* Fixed a bug where the "Publishing status" checkbox appeared on content edit
forms when it should have been hidden. (GitHub #479)

## 2.2.0
* Lightning has been updated to run on and now requires Drupal Core 8.4.x.

Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ The current version of media includes the following functionality:
CKEditor by pasting the video URL

#### Extending Lightning Media (Contributed Modules)
Drupal community members have contributed several modules which integrate Lightning Media with additional third-party media services. These modules are not packaged with Lightning or maintained by Acquia, but they are stable and you can use them in your Lightning site:
Drupal community members have contributed several modules which integrate
Lightning Media with additional third-party media services. These modules are
not packaged with Lightning or maintained by Acquia, but they are stable and you
can use them in your Lightning site:

* [Facebook](https://www.drupal.org/project/lightning_media_facebook)
* [Imgur](https://www.drupal.org/project/lightning_media_imgur)
Expand Down Expand Up @@ -135,6 +138,8 @@ your environment, but generally you will not need to do this.
can set the image's alt text at upload time, but that text will not be
replicated to the image field. This is due to a limitation of Entity Browser's
API.
* Some of the Lightning contributed media module listed above might not yet be
compatible with the Core Media entity.

### Workflow
* Lightning Workflow is based on Workbench Moderation, which is incompatible
Expand Down
80 changes: 73 additions & 7 deletions RoboFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,97 @@ class RoboFile extends \Robo\Tasks {
* {@inheritdoc}
*/
protected function taskBehat($behat = NULL) {
$behat = $behat ?: 'bin/behat';

return parent::taskBehat($behat)
return parent::taskBehat($behat ?: 'bin/behat')
->config('docroot/sites/default/files/behat.yml')
->option('stop-on-failure')
->option('strict');
}

protected function taskDrupal($command, $console = NULL) {
return $this->taskExec($console ?: '../bin/drupal')
->rawArg($command)
->dir('docroot');
}

protected function taskDrush($command, $drush = NULL) {
return $this->taskExec($drush ?: '../bin/drush')
->rawArg($command)
->dir('docroot');
}

/**
* Updates from a previous version of Lightning.
*
* @param string $version
* The version from which to update.
*
* @see ::restore()
*
* @return \Robo\Contract\TaskInterface|NULL
* The task(s) to run, or NULL if the specified version is invalid.
*/
public function update($version) {
$tasks = $this->restore($version);

if ($tasks) {
$tasks
->addTask(
$this->taskDrush('updatedb')->option('yes')
)
->addTask(
$this->taskDrupal('update:lightning')->option('no-interaction')->option('since', $version)
);
}
return $tasks;
}

/**
* Restores a database dump of a previous version of Lightning.
*
* @param string $version
* The semantic version from which to restore, e.g. 2.1.7. A dump of this
* version must exist in the tests/fixtures directory, named like
* $version.sql.bz2.
*
* @return \Robo\Contract\TaskInterface|NULL
* The task(s) to run, or NULL if the fixture does not exist.
*/
public function restore($version) {
$fixture = "tests/fixtures/$version.sql";

if (file_exists("$fixture.bz2")) {
return $this->collectionBuilder()
->addTask(
$this->taskExec('bunzip2')->arg("$fixture.bz2")->option('keep')->option('force')
)
->addTask(
$this->taskDrupal('database:restore')->option('file', "../$fixture")
)
->completion(
$this->taskFilesystemStack()->remove($fixture)
);
}
else {
$this->say("$version fixture does not exist.");
}
}

/**
* Run Behat tests.
*
* To run all tests, simply run 'test:behat'. To run a specific feature, you
* can pass its path, relative to the tests/features directory:
*
* test:behat -- media/image.feature
* test:behat media/image.feature
*
* You can omit the .feature extension. This example runs
* tests/features/workflow/diff.feature:
*
* test:behat -- workflow/diff
* test:behat workflow/diff
*
* This also works with a directory of features. This example runs everything
* in tests/features/media:
*
* test:behat -- media
* test:behat media
*
* Any command-line options after the initial -- will be passed unmodified to
* Behat. So you can filter tests by tags, like normal:
Expand Down
2 changes: 2 additions & 0 deletions UPDATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ to follow the instructions for updating from Beta 1 to Beta 2, then from Beta 2
to Beta 3, in that order.

### 2.2.0 to 2.2.1
* Prior to running database updates, you will need to rebuild Drupal's caches in
order for the Media update to run properly.
* Visit *Structure > Content types*. For each moderated content type, click
"Manage form display", then drag the "Publishing status" field into the
"Disabled" section and press "Save".
Expand Down
2 changes: 1 addition & 1 deletion build-lightning.make
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ includes[] = drupal-org-core.make
projects[lightning][type] = profile
projects[lightning][download][type] = git
projects[lightning][download][branch] = 8.x-2.x
projects[lightning][download][tag] = 8.x-2.21-dev
projects[lightning][download][tag] = 8.x-2.21-alpha1
32 changes: 0 additions & 32 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -188,18 +188,6 @@
<phingcall target="reset-db" />
</target>

<!-- Destroys the installed code base. -->
<target name="destroy">
<delete failonerror="true" includeemptydirs="true">
<fileset dir="." defaultexcludes="false">
<include name="bin/**" />
<include name="${docroot}/**" />
<include name="node_modules/**" />
<include name="vendor/**" />
</fileset>
</delete>
</target>

<!-- Generates a database snapshot from the current code base. -->
<target name="memorize" depends="env">
<phingcall target="reset-db" />
Expand All @@ -208,26 +196,6 @@
<exec command="${bzip2} --force ${fixture}" />
</target>

<!-- Imports an existing database snapshot. -->
<target name="recall" depends="env">
<if>
<!-- Check if the fixture exists and exit gracefully if it doesn't. -->
<available property="fixture_exists" file="${fixture}.bz2" />
<then>
<!-- Import the fixture into a clean database to prevent table collisions. -->
<phingcall target="reset-db" />
<!-- Inflate and execute the fixture. -->
<exec command="${bunzip2} --keep ${fixture}.bz2" />
<pdosqlexec url="${db.type}:host=${db.host};dbname=${db.database}" userid="${db.user}" password="${db.password}" src="${fixture}" />
<!-- Delete the inflated fixture. -->
<delete file="${fixture}" />
</then>
<else>
<echo message="${version} fixture does not exist." />
</else>
</if>
</target>

<!-- Empties the database by dropping and recreating it. -->
<target name="reset-db">
<!-- pdosqlexec requires an SQL file to execute. -->
Expand Down
37 changes: 26 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"jakoch/phantomjs-installer": "1.9.8",
"composer/composer": "^1.4",
"grasmash/yaml-cli": "^1.0",
"consolidation/robo": "^1.1"
"consolidation/robo": "^1.1",
"drupal/media_entity_generic": "1.x-dev"
},
"bin": [
"lightning-subprofile"
Expand Down Expand Up @@ -59,7 +60,8 @@
"package": "Acquia\\Lightning\\Composer\\Package::execute",
"release-version": "Acquia\\Lightning\\Composer\\ReleaseVersion::execute",
"verify-patched-constraints": "Acquia\\Lightning\\Composer\\PatchedConstraint::execute",
"enable-asset-packagist": "Acquia\\Lightning\\Composer\\AssetPackagist::execute"
"enable-asset-packagist": "Acquia\\Lightning\\Composer\\AssetPackagist::execute",
"nuke": "rm -r -f bin docroot vendor"
},
"extra": {
"installer-types": [
Expand Down Expand Up @@ -98,7 +100,11 @@
"2869592 - Disabled update module shouldn't produce a status report warning":
"https://www.drupal.org/files/issues/2869592-remove-update-warning-7.patch",
"2885441 - EntityReferenceAutocompleteWidget should define its size setting as an integer":
"https://www.drupal.org/files/issues/2885441-2.patch"
"https://www.drupal.org/files/issues/2885441-2.patch",
"2883813 - Move File/Image media type into Standard once Media is stable":
"https://www.drupal.org/files/issues/2883813-27.patch",
"2877383 - Add action support to Media module":
"https://www.drupal.org/files/issues/2877383-23.patch"
},
"drupal/entity_embed": {
"2832504 - Send the CKEditor instance ID to the embed.preview route":
Expand Down Expand Up @@ -133,6 +139,14 @@
"drupal/crop": {
"2904514 - Crop API causes an error when adding a media bundle":
"https://www.drupal.org/files/issues/2904514-2.patch"
},
"drupal/media_entity_instagram": {
"2917454 - Field formatter test is broken":
"https://www.drupal.org/files/issues/2917454-2.patch"
},
"drupal/media_entity": {
"2918166 - Media Entity should uninstall itself after migration to core Media is complete":
"https://www.drupal.org/files/issues/2918166-2.patch"
}
}
},
Expand All @@ -141,10 +155,9 @@
"drupal/core": "~8.4.0",
"drupal/embed": "^1.0",
"drupal/entity_embed": "1.0.0-beta2",
"drupal/media_entity": "^1.0",
"drupal/media_entity_instagram": "^1.0",
"drupal/media_entity_twitter": "^1.3",
"drupal/media_entity_image": "^1.0",
"drupal/media_entity": "2.x-dev#c564fc4d02a37f0f49710aa74c1e7fae50a8bf30",
"drupal/media_entity_instagram": "2.0.0-alpha1",
"drupal/media_entity_twitter": "2.0.0-alpha2",
"drupal/ctools": "^3.0",
"drupal/panels": "4.2.0",
"drupal/panelizer": "4.0.0",
Expand All @@ -158,10 +171,9 @@
"drupal/token": "^1.0",
"drupal-composer/drupal-scaffold": "^2.0.0",
"drupal/pathauto": "^1.0",
"drupal/entity_browser": "1.3.0",
"drupal/entity_browser": "2.0.0-alpha1",
"drupal/views_infinite_scroll": "^1.1",
"drupal/media_entity_document": "^1.0",
"drupal/video_embed_field": "^1.0",
"drupal/video_embed_field": "2.0.0-alpha1",
"drupal/contact_storage": "^1.0",
"drupal/diff": "^1.0",
"drupal/entity_block": "1.0.0-alpha2",
Expand All @@ -174,7 +186,10 @@
"bower-asset/dropzone": "^5.1",
"drupal/crop": "1.2.0",
"drupal/image_widget_crop": "^2.0",
"bower-asset/cropper": "^2.3"
"bower-asset/cropper": "^2.3",
"drupal/media_entity_document": "^1.0",
"drupal/media_entity_image": "^1.0"

},
"autoload": {
"psr-4": {
Expand Down
Loading

0 comments on commit ffb25ea

Please sign in to comment.