jamesdbloom / grunt-debian-package

Grunt plugin to create a Debian package, allowing JavaScript applications to be easily integrated into a Debian or Ubuntu based continuous delivery pipeline.
https://www.npmjs.org/package/grunt-debian-package
Apache License 2.0
31 stars 24 forks source link

multiple 'src' #2

Closed ghost closed 10 years ago

ghost commented 10 years ago

Hello,

I can't seem to use :

        files: [
            {
             src: [ 
                'build/cache/linux64/0.9.2/nw.pak',
                'build/cache/linux64/0.9.2/nw',
                'build/cache/linux64/0.9.2/libffmpegsumo.so'
             ],
             dest: 'foo/nw/'
            },
            {
             expand: true,
             cwd: 'src/',
             src: '**',
             dest: 'foo/src/'
            }
        ]

Output is :

Running "debian_package:files" (debian_package) task
Verifying property debian_package.files exists in config...OK
Warning: Object #<Object> has no method 'indexOf' Use --force to continue.
jamesdbloom commented 10 years ago

I've tested you configuration but I can't yet see a problem. Can you tell me which version are you using? Also can you also please add the output you get when you run grunt with --verbose.

ghost commented 10 years ago

The output in OP is with --verbose. It seems to have trouble understanding 2 brackets separated with a comma. You are able to use them ?

I'm on 0.1.7 installed through "npm install" as a dependencie in my main folder.

ghost commented 10 years ago

I was able to build a deb if I use only 1 par of brackets, not two. But I'd like to install my program in /opt and a desktop file in /usr/share/applications

I could work things out if I could get access to a postinstall script, I think.

jamesbloomnektan commented 10 years ago

Let me take a look at this issue in more detail, I did copy the syntax you used and it seemed to work but the first src didn't actually match local files as I used your exact syntax build/cache/linux64/0.9.2/.... I'll try again with something more realistic later today...

In general I believe postinstall scripts are considered bast practice for things like that. This is because when you query the package for example using

dpkg -c prefix-package_name-postfix-2.0.0-1.deb

or

dpkg -L prefix-package_name-postfix

you don't see the extra file install during the postinstall script.

If required I can also add support for scripts such as postinstall.

ghost commented 10 years ago

A more accurate representation of what I want to do :

debian_package: {
    options: {
    maintainer: {
        name: "App Team",
        email: "mail@mail.com"
    },
    name: "app-name", //dpkg doesn't accept uppercase, space or underscore
    long_description: "BLABLABLABLABLABLA.",
    },
    files: 
        {
            src: [
                'build/test.sh',
                'build/test2.sh',
            ], 
            dest: '/opt/app-name/'
        },
        {
            src: 'dist/app-name.desktop', 
            dest: '/usr/share/app-name.desktop'
        }
}
jamesdbloom commented 10 years ago

Which version are you running as I can't see to reproduce the error you are having, can you double check you are running 0.1.8 ?

ghost commented 10 years ago

I was on 1.7 but I switched to my own bash script now^^

jamesdbloom commented 10 years ago

I don't quite understand why you are having an issue because I specifically have tests that cover the following two scenarios:

files: [
    {
        src: 'tasks/debian_package.js',
        dest: '/var/www/tasks/debian_package.js'
    }
]

and

files: [
    {
        expand: true,
        cwd: 'tasks',
        src: [
            '**/*.js'
        ],
        dest: '/var/www/tasks'
    },
    {
        src: [
            'tests/custom_options/packaging/debian/changelog',
            'tests/custom_options/packaging/debian/control'
        ],
        dest: '/var/www/'
    }
]

Which covers all the examples you specified?

jamesdbloom commented 10 years ago

I guess you noticed in the last example you provided the [ and ] where missing from the files: section?

jamesdbloom commented 10 years ago

I'm going to close the issue as there as there are tests that cover these scenarios and I can't reproduce this, please let me know if you still have problems and I can re-open the issue.

ghost commented 10 years ago

okay that was simply that. Thanks, idk how I did not saw that... Stupid me x)

ghost commented 10 years ago

I know this issue is closed, but thought I'd provide some more info that may be helpful for anyone running into this. I think the problem OP was having was that they needed an extra level in the hierarchy, this should do the trick:

debian_package: {                                                               
    dist: {                                                                  
        options: {                                                              
        maintainer: {                                                           
            name: "App Team",                                                   
            email: "mail@mail.com"                                              
        },                                                                      
        name: "app-name", //dpkg doesn't accept uppercase, space or underscore  
        long_description: "BLABLABLABLABLABLA.",                                
        },                                                                      
        files: [                                                                
            {                                                                   
                src: [                                                          
                    'build/test.sh',                                            
                    'build/test2.sh',                                           
                ],                                                              
                dest: '/opt/app-name/'                                          
            },                                                                  
            {                                                                   
                src: 'dist/app-name.desktop',                                   
                dest: '/usr/share/app-name.desktop'                             
            }                                                                   
        ]                                                                       
    }                                                                           
}

grunt debian_package:dist would then run the task. (https://github.com/alexluke/grunt-haml-php/issues/5 had similar problem)