fxpio / composer-asset-plugin

NPM/Bower Dependency Manager for Composer
MIT License
892 stars 156 forks source link

Question with github repo #84

Closed challgren closed 9 years ago

challgren commented 9 years ago

Is there an example to use a bower package from a github repo? I've tried bower-github-asset/myrepo but I'm getting errors. All the standard bower plugins work fine.

francoispluchino commented 9 years ago

Can you give me your composer.json?

challgren commented 9 years ago
{
    "name":"atx/website",
    "type":"project",
    "description":"ATX website.",
    "config":{
        "vendor-dir":"Vendor",
        "bin-dir":"Vendor/bin"
    },
    "minimum-stability": "dev",
    "require-dev": {
        "phpunit/phpunit": "3.7.*",
        "phpdocumentor/phpdocumentor": "2.*"
    },
    "require":{
        "cakephp/cakephp": "2.6.*",
        "cakedc/migrations":"2.3.*",
        "cakedc/utils":"dev-master",
        "cakephp/debug_kit":"2.2.*@dev",
        "ceeram/clear_cache":"dev-master",
        "dereuromark/cakephp-tools":"dev-master",
        "mjohnson/utility":"dev-master",
        "slywalker/boost_cake": "*",
        "goodby/csv": "*",
        "fxp/composer-asset-plugin": "dev-master",
        "bower-asset/bootstrap": "~3.3.1",
        "bower-asset/bootstrap-toggle": "~2.1.0",
        "bower-asset/DataTables": "~1.10.4",
        "bower-asset/datatables-plugins": "~1.0.1",
        "bower-asset/flot": "~0.8.3",
        "bower-asset/fontawesome": "~4.2.0",
        "bower-asset/gmap3": "~6.0.0",
        "bower-asset/holderjs": "~2.4.1",
        "bower-asset/jquery": "~2.1.3",
        "bower-asset/metisMenu": "~1.1.3",
        "bower-asset/morrisjs": "~0.5.1",
        "bower-asset/datatables-responsive": "1.0.3",
        "bower-github-asset/startbootstrap-sb-admin-2": "1.0.*@dev"
    },
    "extra": {
        "installer-paths" : {
            "public_html/Plugin/{$name}/": ["type:cakephp-plugin"]
        },
        "asset-installer-paths": {
            "bower-asset-library": "public_html/webroot/components"
        },
        "asset-optimize-with-installed-packages": false,
        "asset-ignore-files": {
            "bower-asset/bootstrap": [
                "/.*",
                "_config.yml",
                "CNAME",
                "composer.json",
                "CONTRIBUTING.md",
                "docs",
                "dist/js/npm.js",
                "*.md",
                "less",
                "/fonts",
                "grunt",
                "js",
                "test*",
                "Gruntfile.js",
                "LICENSE",
                "package.json",
                "bower.json"
            ],
            "bower-asset/bootstrap-toggle": [
                "**/.*",
                "node_modules",
                "bower_components",
                "test",
                "tests",
                "css/bootstrap2-*",
                "/doc",
                "js/bootstrap2-*",
                "*.json",
                "Gruntfile.js",
                "*.md",
                "index.html",
                "LICENSE"
            ],
            "bower-asset/datatables": [
                "/.*",
                "examples",
                "media/unit_testing",
                "composer.json",
                "dataTables.jquery.json",
                "package.json",
                "bower.json",
                "Contributing.md",
                "license.txt",
                "*.md",
                "/media/js/jquery.js"
            ],
            "bower-asset/datatables-plugins": [
                "make.sh",
                "*.md",
                "/integration/jqueryui",
                "/integration/foundation"
            ],
            "bower-asset/datatables-responsive": [
                "/*.md",
                "/.*",
                "/*.sh",
                "/*.json",
                "/css/dataTables.responsive.scss",
                "/docs",
                "/examples"
            ],
            "bower-asset/flot": [
                "*.md",
                "/examples",
                ".*",
                "component.json",
                "flot.jquery.json",
                "Makefile",
                "package.json",
                "LICENSE.txt",
                "jquery.js"
            ],
            "bower-asset/fontawesome": [
                ".*",
                "bower.json",
                "*/.*",
                "*.json",
                "src",
                "*.yml",
                "Gemfile",
                "Gemfile.lock",
                "*.md",
                "less",
                "scss"
            ],
            "bower-asset/gmap3": [
                "demo",
                "examples",
                "jquery",
                "src",
                "bower.json",
                "changelog.txt",
                "gulpfile.js",
                "options.js",
                "package.json",
                "README.md",
                "bower.json"
            ],
            "bower-asset/holderjs": [
                "src",
                "test",
                ".*",
                "*.json",
                "*.md",
                "gulpfile.js"
            ],
            "bower-asset/jquery": [
                "**/.*",
                "build",
                "speed",
                "test",
                "*.md",
                "AUTHORS.txt",
                "Gruntfile.js",
                "package.json",
                "bower.json",
                "MIT-LICENSE.txt",
                "/src"
            ],
            "bower-asset/metismenu": [
                "**/.*",
                "node_modules",
                "bower_components",
                "test",
                "tests",
                "/src",
                "*.json",
                "LICENSE",
                "*.md",
                "Gruntfile.js"
            ],
            "bower-asset/mocha": [
                "bin",
                "editors",
                "images",
                "lib",
                "support",
                "test",
                ".gitignore",
                ".npmignore",
                ".travis.yml",
                "component.json",
                "index.js",
                "Makefile",
                "package.json",
                "*.md",
                "bower.json",
                "LICENSE"
            ],
            "bower-asset/morrisjs": [
                "examples",
                "less",
                "lib",
                "spec",
                ".travis.yml",
                "*.json",
                "Gruntfile.js",
                "*.md"
            ],
            "bower-asset/raphael": [
                "eve",
                "**/.*",
                "*.html",
                "*.json",
                "*.markdown",
                "*.md",
                "copy.js",
                "Gruntfile.js",
                "raphael.core.js",
                "raphael.svg.js",
                "raphael.vml.js",
                "reference.js",
                "*.json",
                "license.txt",
                "dev"
            ]
        }
    },
    "scripts": {
        "post-install-cmd": [
            "cd Vendor/bin/ && cake ClearCache.clear_cache -app ../../public_html"
        ],
        "post-update-cmd": [
            "cd Vendor/bin/ && cake ClearCache.clear_cache -app ../../public_html"
        ]
    }
}
francoispluchino commented 9 years ago
  1. The plugin must be installed in global mode (composer global require fxp/composer-asset-plugin:1.0.0@dev)
  2. Your vendor prefix bower-github-asset doest not exist, it must always be bower-asset
  3. Your private repository (not registered in bower.io) must be added in extra.asset-repositories
challgren commented 9 years ago

1: Yes it is installed globally that line is to remind me on new systems.

2: "it must be always" I'm totally confused

francoispluchino commented 9 years ago

Sorry I am with my smartphone... The browser refresh the page by changing application. Refresh my previous comments.

francoispluchino commented 9 years ago

For 1, prefer the suggest section.

francoispluchino commented 9 years ago

For 3, you can see the doc Usage with VCS repository.

francoispluchino commented 9 years ago

Try bower-asset/startbootstrap-sb-admin-2, and it must be ok, normally.

challgren commented 9 years ago

I have and got errors which is why I was going the github route, the package was just published to bower about 2 hours ago

francoispluchino commented 9 years ago

You have an error with bower-asset/startbootstrap-sb-admin-2?

challgren commented 9 years ago

Yes, let me delete everything and start over. I'm thinking the package list for bower is cached.

francoispluchino commented 9 years ago

I'll test your project when I have a PC, if you do not have the solution by then.

challgren commented 9 years ago

I got it to work had to clear composer cache and delete all the installed composer packages.

francoispluchino commented 9 years ago

Ok, glad to know that everything works now for you.

challgren commented 9 years ago

Now I just have to track down why i have a fontawesome and font-awesome

francoispluchino commented 9 years ago

Your composer.json:

"bower-asset/fontawesome": "~4.2.0",
challgren commented 9 years ago

Ok so now I'm getting

Chris@CHRIS-DESKY /d/SVN/atx (master)
$ composer install
Loading composer repositories with package information
Installing dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested package bower-asset/startbootstrap-sb-admin-2 could not be found in any ve

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability
   see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more detail

Read <http://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.

my composer is now

{
    "name":"atx/website",
    "type":"project",
    "description":"ATX website.",
    "config":{
        "vendor-dir":"Vendor",
        "bin-dir":"Vendor/bin"
    },
    "require-dev": {
        "phpunit/phpunit": "3.7.*",
        "phpdocumentor/phpdocumentor": "2.*"
    },
    "require":{
        "cakephp/cakephp": "2.6.*",
        "cakedc/migrations":"2.3.*",
        "cakedc/utils":"dev-master",
        "cakephp/debug_kit":"2.2.*@dev",
        "ceeram/clear_cache":"dev-master",
        "dereuromark/cakephp-tools":"dev-master",
        "mjohnson/utility":"dev-master",
        "slywalker/boost_cake": "*",
        "goodby/csv": "*",
        "bower-asset/gmap3": "~6.0.0",
        "bower-asset/startbootstrap-sb-admin-2": "1.0.*@dev"
    },
    "suggest": {
        "fxp/composer-asset-plugin": "Allows the file to run correctly"
    },
    "extra": {
        "installer-paths" : {
            "public_html/Plugin/{$name}/": ["type:cakephp-plugin"]
        },
        "asset-installer-paths": {
            "bower-asset-library": "public_html/webroot/components"
        },
        "asset-optimize-with-installed-packages": false,
        "asset-ignore-files": {
            "bower-asset/bootstrap": [
                "/.*",
                "_config.yml",
                "CNAME",
                "composer.json",
                "CONTRIBUTING.md",
                "docs",
                "dist/js/npm.js",
                "*.md",
                "less",
                "/fonts",
                "grunt",
                "js",
                "test*",
                "Gruntfile.js",
                "LICENSE",
                "package.json",
                "bower.json"
            ],
            "bower-asset/bootstrap-toggle": [
                "**/.*",
                "node_modules",
                "bower_components",
                "test",
                "tests",
                "css/bootstrap2-*",
                "/doc",
                "js/bootstrap2-*",
                "*.json",
                "Gruntfile.js",
                "*.md",
                "index.html",
                "LICENSE"
            ],
            "bower-asset/datatables": [
                "/.*",
                "examples",
                "media/unit_testing",
                "composer.json",
                "dataTables.jquery.json",
                "package.json",
                "bower.json",
                "Contributing.md",
                "license.txt",
                "*.md",
                "/media/js/jquery.js"
            ],
            "bower-asset/datatables-plugins": [
                "make.sh",
                "*.md",
                "/integration/jqueryui",
                "/integration/foundation"
            ],
            "bower-asset/datatables-responsive": [
                "/*.md",
                "/.*",
                "/*.sh",
                "/*.json",
                "/css/dataTables.responsive.scss",
                "/docs",
                "/examples"
            ],
            "bower-asset/flot": [
                "*.md",
                "/examples",
                ".*",
                "component.json",
                "flot.jquery.json",
                "Makefile",
                "package.json",
                "LICENSE.txt",
                "jquery.js"
            ],
            "bower-asset/font-awesome": [
                ".*",
                "bower.json",
                "*/.*",
                "*.json",
                "src",
                "*.yml",
                "Gemfile",
                "Gemfile.lock",
                "*.md",
                "less",
                "scss"
            ],
            "bower-asset/startbootstrap-sb-admin-2": [
                "bower.json",
                "LICENSE",
                "*.md",
                "pages",
                "less"
            ],
            "bower-asset/gmap3": [
                "demo",
                "examples",
                "jquery",
                "src",
                "bower.json",
                "changelog.txt",
                "gulpfile.js",
                "options.js",
                "package.json",
                "README.md",
                "bower.json"
            ],
            "bower-asset/holderjs": [
                "src",
                "test",
                ".*",
                "*.json",
                "*.md",
                "gulpfile.js"
            ],
            "bower-asset/jquery": [
                "**/.*",
                "build",
                "speed",
                "test",
                "*.md",
                "AUTHORS.txt",
                "Gruntfile.js",
                "package.json",
                "bower.json",
                "MIT-LICENSE.txt",
                "/src"
            ],
            "bower-asset/metismenu": [
                "**/.*",
                "node_modules",
                "bower_components",
                "test",
                "tests",
                "/src",
                "*.json",
                "LICENSE",
                "*.md",
                "Gruntfile.js"
            ],
            "bower-asset/mocha": [
                "bin",
                "editors",
                "images",
                "lib",
                "support",
                "test",
                ".gitignore",
                ".npmignore",
                ".travis.yml",
                "component.json",
                "index.js",
                "Makefile",
                "package.json",
                "*.md",
                "bower.json",
                "LICENSE"
            ],
            "bower-asset/morrisjs": [
                "examples",
                "less",
                "lib",
                "spec",
                ".travis.yml",
                "*.json",
                "Gruntfile.js",
                "*.md"
            ],
            "bower-asset/raphael": [
                "eve",
                "**/.*",
                "*.html",
                "*.json",
                "*.markdown",
                "*.md",
                "copy.js",
                "Gruntfile.js",
                "raphael.core.js",
                "raphael.svg.js",
                "raphael.vml.js",
                "reference.js",
                "*.json",
                "license.txt",
                "dev"
            ]
        }
    },
    "scripts": {
        "post-install-cmd": [
            "cd Vendor/bin/ && cake ClearCache.clear_cache -app ../../public_html"
        ],
        "post-update-cmd": [
            "cd Vendor/bin/ && cake ClearCache.clear_cache -app ../../public_html"
        ]
    }
}
francoispluchino commented 9 years ago

Strange! I'll test your project when I have a PC.

challgren commented 9 years ago

It worked once! I'm gonna keep messing with it.

challgren commented 9 years ago

If I run bower info startbootstrap-sb-admin-2 it returns

C:\Users\Chris>bower info startbootstrap-sb-admin-2
bower startbootstrap-sb-admin-2#*           cached git://github.com/IronSummitMedia/startbootstrap-sb-admin-2.git#1.0.3
bower startbootstrap-sb-admin-2#*         validate 1.0.3 against git://github.com/IronSummitMedia/startbootstrap-sb-admin-2.git#*

{
  name: 'startbootstrap-sb-admin-2',
  version: '1.0.3',
  homepage: 'http://startbootstrap.com/template-overviews/sb-admin-2/',
  authors: [
    'David Miller'
  ],
  description: 'A free, open source, Bootstrap admin theme created by Start Bootstrap',
...

I had to add

"extra": {
        ...
        "asset-repositories": [
            {
                "type": "bower-github",
                "url": "git://github.com/IronSummitMedia/startbootstrap-sb-admin-2.git",
                "name": "bower-asset/startbootstrap-sb-admin-2"
            }
        ],
        ...
francoispluchino commented 9 years ago

For the moment, override the configuration of asset repository (that you have already done). I'll look at why the plugin search the asset startbootstrap-sb-admin and not startbootstrap-sb-admin-2.

francoispluchino commented 9 years ago

Fixed by 233150d0dcba1b1fef44c922b0abce43ccc356c0.

challgren commented 9 years ago

Thanks I'll test it shortly! I'm glad I submitted an issue or I would still be beating myself up with this issue.

challgren commented 9 years ago

Sweet it works!! I removed the asset-repositories and it works perfect!