Skip to content

Commit 26e477e

Browse files
author
Rafael Grigorian
committed
Fixed GH-6
1 parent e051f18 commit 26e477e

File tree

5 files changed

+1603
-1235
lines changed

5 files changed

+1603
-1235
lines changed

Gruntfile.js

Lines changed: 0 additions & 132 deletions
This file was deleted.

gulpfile.js

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
const gulp = require ("gulp")
2+
const gzip = require ("gulp-gzip")
3+
const magepack = require ("gulp-magepack")
4+
const replace = require ("gulp-replace")
5+
const tar = require ("gulp-tar")
6+
const fs = require ("fs")
7+
const fse = require ("fs-extra")
8+
9+
const PACKAGE_NAMESPACE = require ("./package.json").namespace
10+
const PACKAGE_VERSION = require ("./package.json").version
11+
12+
const SOURCE_DIR = "src"
13+
const BUILD_DIR = "build"
14+
const STAGING_DIR = "public_html"
15+
const PACKAGE_DIR = "dist"
16+
17+
gulp.task ( "init", [], ( callback ) => {
18+
let mkdirNotExists = ( name ) => {
19+
if ( !fs.existsSync ( name ) ) {
20+
fs.mkdirSync ( name )
21+
}
22+
}
23+
mkdirNotExists ( BUILD_DIR )
24+
mkdirNotExists ( PACKAGE_DIR )
25+
mkdirNotExists ( STAGING_DIR )
26+
callback ()
27+
})
28+
29+
gulp.task ( "clean", [], ( callback ) => {
30+
let unlinkExists = ( name ) => {
31+
if ( fs.existsSync ( name ) ) {
32+
fse.removeSync ( name )
33+
}
34+
}
35+
unlinkExists ( BUILD_DIR )
36+
unlinkExists ( PACKAGE_DIR )
37+
callback ()
38+
})
39+
40+
gulp.task ( "bump", [], ( callback ) => {
41+
return gulp.src ( SOURCE_DIR + "/**/*" )
42+
.pipe ( replace ( /(^.*\*\s+@version\s+)(.+$)/gm, "$1" + PACKAGE_VERSION ) )
43+
.pipe ( gulp.dest ( SOURCE_DIR ) )
44+
.on ( "done", callback )
45+
})
46+
47+
gulp.task ( "build", [ "init" ], ( callback ) => {
48+
return gulp.src ( SOURCE_DIR + "/**/*" )
49+
.pipe ( gulp.dest ( BUILD_DIR ) )
50+
.on ( "done", callback )
51+
})
52+
53+
gulp.task ( "deploy", ["build"], ( callback ) => {
54+
return gulp.src ( BUILD_DIR + "/**/*" )
55+
.pipe ( gulp.dest ( STAGING_DIR ) )
56+
.on ( "done", callback )
57+
})
58+
59+
gulp.task ( "watch", ["deploy"], () => {
60+
return gulp.watch ( SOURCE_DIR + "/**/*", ["deploy"] )
61+
})
62+
63+
gulp.task ( "package", [ "clean", "bump", "build" ], ( callback ) => {
64+
let options = {
65+
"template": "package.xml",
66+
"output": "package.xml",
67+
"version": PACKAGE_VERSION
68+
}
69+
gulp.src ( BUILD_DIR + "/**/*" )
70+
.pipe ( magepack ( options ) )
71+
.pipe ( tar (`${PACKAGE_NAMESPACE}-${PACKAGE_VERSION}`) )
72+
.pipe ( gzip ({ extension: "tgz" }) )
73+
.pipe ( gulp.dest ( PACKAGE_DIR ) )
74+
.on ( "done", callback )
75+
})

package.json

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"version": "1.1.1",
33
"name": "magento-twofactor",
4-
"description": "Two-factor authorization for Magento 1.x",
4+
"description": "User based 2FA enablement for admin users in Magento 1.x",
55
"author": "Rafael Grigorian",
66
"company": "JetRails®",
77
"license": "MIT",
@@ -11,13 +11,11 @@
1111
"url": "https://github.com/jetrails/magento-twofactor.git"
1212
},
1313
"devDependencies": {
14-
"grunt": "^1.0.1",
15-
"grunt-contrib-clean": "^1.0.0",
16-
"grunt-contrib-compress": "^1.3.0",
17-
"grunt-contrib-watch": "^1.0.0",
18-
"grunt-git": "^1.0.0",
19-
"grunt-mkdir": "^1.0.0",
20-
"grunt-replace": "^1.0.1",
21-
"grunt-rsync": "^1.0.1"
14+
"fs-extra": "^7.0.0",
15+
"gulp": "^3.9.1",
16+
"gulp-gzip": "^1.4.2",
17+
"gulp-magepack": "^1.0.3",
18+
"gulp-replace": "^1.0.0",
19+
"gulp-tar": "^2.1.0"
2220
}
2321
}

0 commit comments

Comments
 (0)