Skip to content

Commit

Permalink
Entwicklerumgebung
Browse files Browse the repository at this point in the history
  • Loading branch information
Dernerd committed Feb 10, 2024
1 parent c3849d5 commit cf6fc6e
Show file tree
Hide file tree
Showing 61 changed files with 5,095 additions and 167 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.DS_Store
node_modules
releases
25 changes: 25 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
language: php

notifications:
email:
on_success: never
on_failure: change

php:
- 5.3
- 5.6

env:
- WP_VERSION=latest WP_MULTISITE=0
- WP_VERSION=3.3 WP_MULTISITE=0
- WP_VERSION=3.3.1 WP_MULTISITE=0

matrix:
include:
- php: 5.3
env: WP_VERSION=latest WP_MULTISITE=1

before_script:
- bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION

script: phpunit
230 changes: 230 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,230 @@
/*global require*/

/**
* When grunt command does not execute try these steps:
*
* - delete folder 'node_modules' and run command in console:
* $ npm install
*
* - Run test-command in console, to find syntax errors in script:
* $ grunt hello
*/

module.exports = function( grunt ) {

require( 'time-grunt' )(grunt);

require( 'load-grunt-tasks' )(grunt);

var buildTime = new Date().toISOString();

var conf = {

js_folder: 'js/',

css_folder: 'css/',

translation: {
ignore_files: [
'node_modules/.*',
'(^.php)', // Ignore non-php files.
'releases/.*' // Temp release files.
],
pot_dir: 'languages/', // With trailing slash.
textdomain: 'eab',
},

plugin_branches: {
include_files: [
'**',
'!**/css/src/**',
'!**/css/sass/**',
'!**/js/src/**',
'!**/js/vendor/**',
'!**/img/src/**',
'!**/node_modules/**',
'!**/tests/**',
'!**/releases/*.zip',
'!releases/*.zip',
'!**/release/**',
'!**/Gruntfile.js',
'!**/package.json',
'!**/build/**',
'!**/bin/**',
'!**/src/**',
'!app/assets/css/src/**',
'!app/assets/js/src/**',
'!app/assets/js/vendor/**',
'!app/assets/img/src/**',
'!node_modules/**',
'!.sass-cache/**',
'!releases/**',
'!Gruntfile.js',
'!package.json',
'!phpunit.xml.dist',
'!README.md',
'!readme.txt',
'!build/**',
'!tests/**',
'!.git/**',
'!.git',
'!**/.svn/**',
'!.log'
]
},

plugin_dir: 'events-and-bookings/',
plugin_file: 'events-and-bookings.php'

};

grunt.initConfig( {

pkg: grunt.file.readJSON( 'package.json' ),

uglify: {
all: {
files: [{
expand: true,
src: ['*.js', '!*.min.js'],
cwd: conf.js_folder,
dest: conf.js_folder,
ext: '.min.js',
extDot: 'last'
}],
options: {
banner: '/*! <%= pkg.title %> - v<%= pkg.version %>\n' +
' * <%= pkg.homepage %>\n' +
' * Copyright (c) <%= grunt.template.today("yyyy") %>;' +
' * Licensed GPLv2+' +
' */\n',
mangle: {
except: ['jQuery']
}
}
}
},

autoprefixer: {
options: {
browsers: ['last 2 version', 'ie 8', 'ie 9'],
diff: false
},
single_file: {
files: [{
expand: true,
src: ['*.css', '!*.min.css'],
cwd: conf.css_folder,
dest: conf.css_folder,
ext: '.css',
extDot: 'last'
}]
}
},

compass: {
options: {
},
server: {
options: {
debugInfo: true
}
}
},

cssmin: {
options: {
banner: '/*! <%= pkg.title %> - v<%= pkg.version %>\n' +
' * <%= pkg.homepage %>\n' +
' * Copyright (c) <%= grunt.template.today("yyyy") %>;' +
' * Licensed GPLv2+' +
' */\n'
},
minify: {
expand: true,
src: ['*.css', '!*.min.css'],
cwd: conf.css_folder,
dest: conf.css_folder,
ext: '.min.css',
extDot: 'last'
}
},

clean: {
temp: {
src: [
'**/*.tmp',
'**/.afpDeleted*',
'**/.DS_Store'
],
dot: true,
filter: 'isFile'
}
},

copy: {
files: {
src: conf.plugin_branches.include_files,
dest: 'releases/<%= pkg.name %>-<%= pkg.version %>/'
}
},

compress: {
files: {
options: {
mode: 'zip',
archive: './releases/<%= pkg.name %>-<%= pkg.version %>.zip'
},
expand: true,
cwd: 'releases/<%= pkg.name %>-<%= pkg.version %>/',
src: [ '**/*' ],
dest: conf.plugin_dir
}
},

makepot: {
target: {
options: {
cwd: '',
domainPath: conf.translation.pot_dir,
exclude: conf.translation.ignore_files,
mainFile: conf.plugin_file,
potFilename: conf.translation.textdomain + '.pot',
potHeaders: {
poedit: true, // Includes common Poedit headers.
'x-poedit-keywordslist': true // Include a list of all possible gettext functions.
},
type: 'wp-plugin' // wp-plugin or wp-theme
}
}
},

} );

grunt.registerTask( 'hello', 'Test if grunt is working', function() {
grunt.log.subhead( 'Hi there :)' );
grunt.log.writeln( 'Looks like grunt is installed!' );
});

grunt.registerTask( 'build', 'Run all tasks.', function(target) {
var build = [], i, branch;

// Run the default tasks (js/css/php validation).
grunt.task.run( 'default' );

// Generate all translation files (same for pro and free).
grunt.task.run( 'makepot' );

grunt.task.run( 'clean' );

grunt.task.run( 'copy' );
grunt.task.run( 'compress' );
});

// Development tasks.
grunt.registerTask( 'default', ['clean:temp', 'uglify', 'autoprefixer', 'cssmin'] );

grunt.task.run( 'clear' );
grunt.util.linefeed = '\n';

}
89 changes: 89 additions & 0 deletions docs/Dev-README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# README

*Similar structure as: Membership 2, Popup, Custom Sidebars, CoursePress*

The **only** development branch for Events+ is `master`. This branch ultimately is responsible for creating the production branches that are finally published.


**Remember:** `master` is the ONLY branch that should be edited and forked!

-----

# DEVELOPMENT

As mentioned above: Only directly edit the branch `master`. Other branches should be only updated via grunt tasks (see section "Automation" below).

Important: Do not let your IDE change the **source order** of the code. Fixing up formatting is fine, but moving code blocks around is not! It will confuse grunt and produce problems.

-----

# AUTOMATION

See notes below on how to correctly set up and use grunt.

Many tasks as well as basic quality control are done via grunt. Below is a list of supported tasks.

**Important**: Before making a pull-request to the master branch always run the task `grunt` - this ensures that all .php, .js and .css files are validated and existing unit tests pass. If an problems are reported then fix those problems before submitting the pull request.

### Grunt Task Runner

**ALWAYS** use Grunt to build the production branches. Use the following commands:

Category | Command | Action
---------| ------- | ------
**Build** | `grunt` | Run all default tasks: js, css. **Run this task before submitting a pull-request**.
Build | `grunt build` | Runs all default tasks + lang, builds production version.


### Set up grunt

#### 1. npm

First install node.js from: <http://nodejs.org/>

```
#!bash
# Test it:
$ npm -v
# Install it system wide (optional but recommended):
$ npm install -g npm
```

#### 2. grunt

Install grunt by running this command in command line:

```
#!bash
# Install grunt:
$ npm install -g grunt-cli
```

#### 3. Setup project

In command line switch to the `events-and-bookings` plugin folder. Run this command to set up grunt for the Events+ plugin:

```
#!bash
# Install automation tools for M2:
$ cd <path-to-wordpress>/wp-content/plugins/events-and-bookings
$ npm install
# Test it:
$ grunt hello
```


# RELEASE

### 1. Build the release version

1.) Switch to `development` branch.

2.) Make sure the version number in **main plugin file** is correct and that the version in file `pacakge.json` matches the plugin version. (in package.json you have x.y.z format, so "1.2.3.4" becomes "1.2.34" here)

3.) Then run `grunt build` This will create a .zip archive of the release files.

4.) Only in `development` branch: There is a folder called `release/` which contains the release files as .zip archive.

Loading

0 comments on commit cf6fc6e

Please sign in to comment.