Custom `grunt deploy`

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Custom `grunt deploy`

Sean P. DeNigris
Administrator
I want to deploy to a different folder. For the.js, I just changed to:
    requirejs: {
            deploy: {
                options: {
                    ...
                    out: "www/the.js"

But I'd also like to copy index.html there. How do I learn more about how to do that? Bear in mind that I only know about js tools from what I've picked up on this list.
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Custom `grunt deploy`

Herby Vojčík


Sean P. DeNigris wrote:

> I want to deploy to a different folder. For the.js, I just changed to:
>      requirejs: {
>              deploy: {
>                  options: {
>                      ...
>                      out: "www/the.js"
>
> But I'd also like to copy index.html there. How do I learn more about how to
> do that? Bear in mind that I only know about js tools from what I've picked
> up on this list.

Copy by hand or look for something like grunt-contrib-copy which will allow you to copy files. Just install it with npm install ... -save-dev and import its tasks similarly to how tasks provided by other modules are imported (see at the start of Gruntfile.js).

I would anyway suggest not to change deploy task (it's the sibling of the devel task), but to add copying those two file into its own task (derived from grunt-contrib-copy module) that copies both the.js and index.html (and possible other files that are not packed in, like fonts), and add that task to defi
nition of "deploy" task itself (what you show is not "deploy" task, which is run when you run `grunt deploy`, it's "requirejs:deploy" task which is part of the whole "deploy" task which is define elsewhere, as a sequence of other subtask. I would add copying as the last step there.


--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Custom `grunt deploy`

Herby Vojčík


Herby Vojčík wrote:

>
>
> Sean P. DeNigris wrote:
>> I want to deploy to a different folder. For the.js, I just changed to:
>> requirejs: {
>> deploy: {
>> options: {
>> ...
>> out: "www/the.js"
>>
>> But I'd also like to copy index.html there. How do I learn more about
>> how to
>> do that? Bear in mind that I only know about js tools from what I've
>> picked
>> up on this list.
>
> Copy by hand or look for something like grunt-contrib-copy which will
> allow you to copy files. Just install it with npm install ... -save-dev
> and import its tasks similarly to how tasks provided by other modules
> are imported (see at the start of Gruntfile.js).

Or maybe copy task in in the base gtunt... I don't know. Maybe if you
google for "how to copy files in grunt" you just find the right answer.

>
> I would anyway suggest not to change deploy task (it's the sibling of
> the devel task), but to add copying those two file into its own task
> (derived from grunt-contrib-copy module) that copies both the.js and
> index.html (and possible other files that are not packed in, like
> fonts), and add that task to defi
> nition of "deploy" task itself (what you show is not "deploy" task,
> which is run when you run `grunt deploy`, it's "requirejs:deploy" task
> which is part of the whole "deploy" task which is define elsewhere, as a
> sequence of other subtask. I would add copying as the last step there.
>
>

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Custom `grunt deploy`

Sean P. DeNigris
Administrator
Herby Vojčík wrote
Maybe if you google for "how to copy files in grunt" you just find the right answer.
There are plugins, but the rationale seems to be that "people prefer declarative build files". Since I apparently am not one of those people, I settled on using grunt-shell to run an arbitrary shell script...

Preparation:
1. `npm install --save-dev load-grunt-tasks` ([per SO](http://stackoverflow.com/questions/28385685/grunt-error-cannot-find-module-load-grunt-tasks))
2. `npm install --save-dev grunt-shell` (https://github.com/sindresorhus/grunt-shell)

In Gruntfile.js:
    require('load-grunt-tasks')(grunt);
...
    grunt.registerTask('deploy-artifacts', ['shell']);
...
    grunt.registerTask('deploy', ['amdconfig:app', 'requirejs:deploy', 'deploy-artifacts']);

    grunt.initConfig({
...
        shell: {
          target: {
            command: './deploy-artifacts.sh'
          }
        },

And ./deploy-artifacts.sh:
  mkdir -p deploy
  cp the.js index.html file3 file4 deploy/
  zip deploy/www.zip the.js index.html file3 file4
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Custom `grunt deploy`

Herby Vojčík
And windows users are screwed.

Well, there is a good rationale on using cross-platform npm modules and not a shell.

Sean P. DeNigris wrote:

> Herby Vojčík wrote
>> Maybe if you google for "how to copy files in grunt" you just find the
>> right answer.
>
> There are plugins, but the rationale seems to be that "people prefer
> declarative build files". Since I apparently am not one of those people, I
> settled on using grunt-shell to run an arbitrary shell script...
>
> Preparation:
> 1. `npm install --save-dev load-grunt-tasks` ([per
> SO](http://stackoverflow.com/questions/28385685/grunt-error-cannot-find-module-load-grunt-tasks))
> 2. `npm install --save-dev grunt-shell`
> (https://github.com/sindresorhus/grunt-shell)
>
> In Gruntfile.js:
>      require('load-grunt-tasks')(grunt);
> ...
>      grunt.registerTask('deploy-artifacts', ['shell']);
> ...
>      grunt.registerTask('deploy', ['amdconfig:app', 'requirejs:deploy',
> 'deploy-artifacts']);
>
>      grunt.initConfig
({

> ...
>          shell: {
>            target: {
>              command: './deploy-artifacts.sh'
>            }
>          },
>
> And ./deploy-artifacts.sh:
>    mkdir -p deploy
>    cp the.js index.html file3 file4 deploy/
>    zip deploy/www.zip the.js index.html file3 file4
>
>
>
> -----
> Cheers,
> Sean
> --
> View this message in context: http://forum.world.st/Custom-grunt-deploy-tp4832694p4832707.html
> Sent from the Amber Smalltalk mailing list archive at Nabble.com.
>

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Custom `grunt deploy`

Sean P. DeNigris
Administrator
Herby Vojčík wrote
And windows users are screwed.
Ah, thanks - good point! Since this is a personal project, I'm okay with that. But I'm glad you pointed it out because I didn't see it...
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Custom `grunt deploy`

Herby Vojčík


Sean P. DeNigris wrote:
> Herby Vojčík wrote
>> And windows users are screwed.
>
> Ah, thanks - good point! Since this is a personal project, I'm okay with
> that. But I'm glad you pointed it out because I didn't see it...

If you do not want to install lots of modules, you can write your own
tasks directly in JS - and it doesn't mean you have to learn async node
fs API (it's not the most friendly one) - for scripting in node
environment you can use shelljs module - most of the "bash"-y automation
tasks you can write directly in .js for node.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Custom `grunt deploy`

Herby Vojčík
In reply to this post by Herby Vojčík


Herby Vojčík wrote:

> And windows users are screwed.
>
> Well, there is a good rationale on using cross-platform npm modules and
> not a shell.
>
> Sean P. DeNigris wrote:
>> Herby Vojčík wrote
>>> Maybe if you google for "how to copy files in grunt" you just find the
>>> right answer.
>>
>> There are plugins, but the rationale seems to be that "people prefer
>> declarative build files". Since I apparently am not one of those
>> people, I
>> settled on using grunt-shell to run an arbitrary shell script...
>>
>> Preparation:
>> 1. `npm install --save-dev load-grunt-tasks` ([per
>> SO](http://stackoverflow.com/questions/28385685/grunt-error-cannot-find-module-load-grunt-tasks))
>>
>> 2. `npm install --save-dev grunt-shell`
>> (https://github.com/sindresorhus/grunt-shell)
>>
>> In Gruntfile.js:
>> require('load-grunt-tasks')(grunt);
>> ...
>> grunt.registerTask('deploy-artifacts', ['shell']);

BTW why this way? Never heard of 'load-grunt-task', smell like some kins
of hack to me. Loading similarly to other modules (loadNpmTasks) doesn't
work? Seems cleaner to me.

>> ...
>> grunt.registerTask('deploy', ['amdconfig:app', 'requirejs:deploy',
>> 'deploy-artifacts']);
>>
>> grunt.initConfig
> ({
>> ...
>> shell: {
>> target: {
>> command: './deploy-artifacts.sh'
>> }
>> },
>>
>> And ./deploy-artifacts.sh:
>> mkdir -p deploy
>> cp the.js index.html file3 file4 deploy/
>> zip deploy/www.zip the.js index.html file3 file4
>>
>>
>>
>> -----
>> Cheers,
>> Sean
>> --
>> View this message in context:
>> http://forum.world.st/Custom-grunt-deploy-tp4832694p4832707.html
>> Sent from the Amber Smalltalk mailing list archive at Nabble.com.
>>
>

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Custom `grunt deploy`

Sean P. DeNigris
Administrator
Herby Vojčík wrote
BTW why this way? Never heard of 'load-grunt-task', smell like some kins
of hack to me. Loading similarly to other modules (loadNpmTasks) doesn't
work? Seems cleaner to me.
IDK. I just copied from the grunt-shell instructions. But `grunt.loadNpmTasks('grunt-shell');` works instead of `require('load-grunt-tasks')(grunt);`
Cheers,
Sean