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

Commit

Permalink
Improve force-update-if-package-json task
Browse files Browse the repository at this point in the history
  • Loading branch information
cdujeu committed Oct 8, 2016
1 parent a811398 commit 7d47408
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 14 deletions.
11 changes: 8 additions & 3 deletions core/src/plugins/gui.ajax/Gruntfile.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -237,18 +237,23 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-run'); grunt.loadNpmTasks('grunt-run');
grunt.loadNpmTasks('grunt-contrib-cssmin'); grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('assemble-less'); grunt.loadNpmTasks('assemble-less');
grunt.registerTask('default', [ grunt.registerTask('type:js', [
'babel:dist', 'babel:dist',
'uglify:js', 'uglify:js',
'babel:materialui', 'babel:materialui',
// 'run:materialui',
'env:build', 'env:build',
'browserify', 'browserify',
'env:dev', 'env:dev',
'uglify:nodejs', 'uglify:nodejs',
'babel:pydio', 'babel:pydio'
]);
grunt.registerTask('type:css', [
'cssmin' 'cssmin'
]); ]);
grunt.registerTask('default', [
'type:js',
'type:css'
]);
grunt.registerTask('build-core', [ grunt.registerTask('build-core', [
'babel:dist', 'babel:dist',
'uglify:js' 'uglify:js'
Expand Down
65 changes: 54 additions & 11 deletions dist/phing/build-pydio.xml
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -544,9 +544,11 @@
<if> <if>
<not><equals arg1="${js_source_path}" arg2="__NOT_FOUND__"/></not> <not><equals arg1="${js_source_path}" arg2="__NOT_FOUND__"/></not>
<then> <then>
<property name="has-js-path" value="true"/>
<if> <if>
<available type="dir" file="${upgrade_export}/plugins/${plugin}/${js_source_path}"/> <available type="dir" file="${upgrade_export}/plugins/${plugin}/${js_source_path}"/>
<then> <then>
<property name="js-required" value="true"/>
<copy todir="${upgrade_export}/plugins/${plugin}/${js_source_path}"> <copy todir="${upgrade_export}/plugins/${plugin}/${js_source_path}">
<fileset dir="${local_repository_root}/plugins/${plugin}/${js_source_path}" defaultexcludes="false"> <fileset dir="${local_repository_root}/plugins/${plugin}/${js_source_path}" defaultexcludes="false">
<include name="*/**"/> <include name="*/**"/>
Expand All @@ -559,9 +561,11 @@
<if> <if>
<not><equals arg1="${css_source_path}" arg2="__NOT_FOUND__"/></not> <not><equals arg1="${css_source_path}" arg2="__NOT_FOUND__"/></not>
<then> <then>
<property name="has-css-path" value="true"/>
<if> <if>
<available type="dir" file="${upgrade_export}/plugins/${plugin}/${css_source_path}"/> <available type="dir" file="${upgrade_export}/plugins/${plugin}/${css_source_path}"/>
<then> <then>
<property name="css-required" value="true"/>
<copy todir="${upgrade_export}/plugins/${plugin}/${css_source_path}"> <copy todir="${upgrade_export}/plugins/${plugin}/${css_source_path}">
<fileset dir="${local_repository_root}/plugins/${plugin}/${css_source_path}" defaultexcludes="false"> <fileset dir="${local_repository_root}/plugins/${plugin}/${css_source_path}" defaultexcludes="false">
<include name="*/**"/> <include name="*/**"/>
Expand All @@ -571,16 +575,46 @@
</if> </if>
</then> </then>
</if> </if>
<echo message="REBUILD JS FOR PLUGIN ${plugin}"/> <if>
<copy todir="${upgrade_export}/plugins/${plugin}"> <or>
<fileset dir="${local_repository_root}/plugins/${plugin}"> <available property="js-required"/>
<include name="Gruntfile.js"/> <available property="css-required"/>
<include name="package.json"/> </or>
</fileset> <then>
</copy> <echo message="REBUILDING JS FOR PLUGIN ${plugin}"/>
<phingcall target="grunt"> <copy todir="${upgrade_export}/plugins/${plugin}">
<property name="plugin_abs_dir" override="true" value="${upgrade_export}/plugins/${plugin}"/> <fileset dir="${local_repository_root}/plugins/${plugin}">
</phingcall> <include name="Gruntfile.js"/>
<include name="package.json"/>
</fileset>
</copy>

<property name="grunt-target" value=""/>
<if>
<and>
<available property="js-required"/>
<available property="has-css-path"/>
<not><available property="css-required"/></not>
</and>
<then>
<property name="grunt-target" value="type:js"/>
</then>
<elseif>
<available property="css-required"/>
<available property="has-js-path"/>
<not><available property="js-required"/></not>
<then>
<property name="grunt-target" value="type:css"/>
</then>
</elseif>
</if>

<phingcall target="grunt">
<property name="plugin_abs_dir" override="true" value="${upgrade_export}/plugins/${plugin}"/>
<property name="grunt_target" value="${grunt-target}"/>
</phingcall>
</then>
</if>
</then> </then>
</if> </if>
<!-- Looking for Composer.json File --> <!-- Looking for Composer.json File -->
Expand Down Expand Up @@ -610,12 +644,21 @@
</target> </target>


<target name="grunt"> <target name="grunt">
<if>
<available property="grunt_target"/>
<then>
<property name="command" value="grunt ${grunt_target}"/>
</then>
<else>
<property name="command" value="grunt"/>
</else>
</if>
<if> <if>
<available file="${plugin_abs_dir}/package.json"/> <available file="${plugin_abs_dir}/package.json"/>
<then> <then>
<!-- BUILD JAVASCRIPT --> <!-- BUILD JAVASCRIPT -->
<exec command="npm install" dir="${plugin_abs_dir}" passthru="true"/> <exec command="npm install" dir="${plugin_abs_dir}" passthru="true"/>
<exec command="grunt" dir="${plugin_abs_dir}" passthru="true"/> <exec command="${command}" dir="${plugin_abs_dir}" passthru="true"/>
<delete dir="${plugin_abs_dir}/node_modules"/> <delete dir="${plugin_abs_dir}/node_modules"/>
</then> </then>
</if> </if>
Expand Down

0 comments on commit 7d47408

Please sign in to comment.