linemanjs / heroku-buildpack-lineman-ruby

Heroku's Ruby Buildpack for Cedar
MIT License
0 stars 3 forks source link

Add control to the files that are copied into the Ruby project public folder #2

Closed asakin closed 10 years ago

asakin commented 10 years ago

Added two configuration items to lineman.json

{"linemanApps":
[
    {
        "location": "front_end",
        "installToPath": "public",
        "filesToMove": ["js/*.js", "css/*.css", "img/*.*", "*.html"],
        "createDirectories": true
    }
]}

filesToMove contains a list of paths for files that need to be moved into the target folder. createDirectories tells the compiler to create the target directories if they don't exist.

This allows to manage images and html assets in lineman as well.

Thanks, Ariel Sakin

theotherzach commented 10 years ago

Nice!

The readme gives the impression that the filesToMove is optional, but won't this error out if that key isn't in the config?

asakin commented 10 years ago

Thanks!

The parameters are in fact optional. The lines

filesToMove = app.fetch("filesToMove", ["js/*.js", "css/*.css"])
createDirectories = app.fetch("createDirectories", false)

defaults both parameters to the old behaviour if they are not found by the fetch function.

Ariel

jasonkarns commented 10 years ago

As discussed with @theotherzach earlier (and posting here for permanence!) I think the default for filesToMove ought to be everything under dist/. IMO, lineman should be concerned with creating a dist directory that is ready for deployment as-is. The desired folder structure for deployment ought to be created by lineman itself. In this manner, deployment simply becomes a matter of deciding where a lineman-built-application should be deployed. (as opposed to which pieces.)

asakin commented 10 years ago

Thanks @jasonkarns, I agree with your approach. What do you think about the following solution:

Thanks, Ariel

jasonkarns commented 10 years ago

filesToMove to be called artifacts or filesToDeploy and have a default value of "*"

I like filesToDeploy

createDirectories to be removed and be always true, assuming that whatever you chose to deploy is lineman's problem (do you think it should be optional? I think there's nothing wrong with it just being always true)

agreed. Lineman shouldn't be creating directories that aren't wanted/needed in prod

overwriteExistingFiles to be added with default true, allowing someone to have files in his public folder that are not overwritten by the lineman app (for example, a different index.html)

agreed

The move should be recursive and not fail when a directory is already there (and overwrite files as needed)

agreed

I'm quite agreeable today, it seems.

searls commented 10 years ago

Agree with the sentiment, jason

On Jul 30, 2013, at 1:28 AM, Jason Karns notifications@github.com wrote:

As discussed with @theotherzach earlier (and posting here for permanence!) I think the default for filesToMove ought to be everything under dist/. IMO, lineman should be concerned with creating a dist directory that is ready for deployment as-is. The desired folder structure for deployment ought to be created by lineman itself. In this manner, deployment simply becomes a matter of deciding where a lineman-built-application should be deployed. (as opposed to which pieces.)

\ Reply to this email directly or view it on GitHub.

asakin commented 10 years ago

Hi, I updated the code. Let me know what you think

Thanks! Ariel

theotherzach commented 10 years ago

Great! Let me do a dry run deploy against this code for the app we have in production. Once that looks good, I'll merge it in.

theotherzach commented 10 years ago

I'm having some trouble with this build pack. Here is my config:

{
  "linemanApps": [
    {
      "type": "file",
      "location": "frontend",
      "installToPath": "lib/app/public",
      "filesToMove" : ["js/*.js", "css/*.css"]
    }
  ]
}

And I get this error:

mv: cannot move `/tmp/build_8gcdtjjkkmcm/frontend/dist/css' to `lib/app/public/./css': Directory not empty
mv: cannot move `/tmp/build_8gcdtjjkkmcm/frontend/dist/js' to `lib/app/public/./js': Directory not empty
theotherzach commented 10 years ago

Problem was on my end.

Looks good and thanks for the hard work!

theotherzach commented 10 years ago

@asakin If you were not aware (and I was not until recently) you can ignore files on a per project basis via the .git/info/exclude file.

jasonkarns commented 10 years ago

Also, for system-wide ignores, you can configure via ~/.gitconfig

asakin commented 10 years ago

Thanks, I'll do that!