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

Add support for npm install #454

Closed
rlouapre opened this issue Jun 1, 2015 · 23 comments
Closed

Add support for npm install #454

rlouapre opened this issue Jun 1, 2015 · 23 comments

Comments

@rlouapre
Copy link
Contributor

rlouapre commented Jun 1, 2015

Would it be possible to add package.json in the root project so Roxy could be installed from npm?

MarkLogic Slush generator could then use it with gulp-install task and this code [2] would not be necessary.

[1] - https://docs.npmjs.com/cli/install
[2] - https://github.com/marklogic/slush-marklogic-node/blob/master/slushfile.js#L32-L66

@grtjn
Copy link
Contributor

grtjn commented Jun 4, 2015

I like the idea of making Roxy into an npm package, but the section of slushfile you are referring to only downloads the ml script. The ml new command in the runRoxy part after that will do a git clone to fetch full Roxy, and run the init command on it.

Might be interesting though to consider reengineering ml new and ml upgrade to not use git, or allow npm as a fallback?

@rlouapre
Copy link
Contributor Author

rlouapre commented Jun 4, 2015

I never noticed and used ml new

npm would provide a easier way to install and update Roxy. It will also help to integrate Roxy in Gulp scripts.

@joemfb
Copy link
Contributor

joemfb commented Jun 4, 2015

I like npm quite a bit, but Roxy is almost entirely Ruby. I think it should be published as a gem on rubygems.org

@grtjn
Copy link
Contributor

grtjn commented Jun 4, 2015

Would make a lot of sense for RoxyJS if that ever sees life.. ;-)

@dmcassel
Copy link
Collaborator

dmcassel commented Jun 4, 2015

My group will have some interns this summer. I'm thinking about putting them to work on a Node-based RoxyJS using the Management API.

@joemfb
Copy link
Contributor

joemfb commented Jun 4, 2015

Do you know if there are the plans to include management API methods / bindings with the official node client?

@dmcassel
Copy link
Collaborator

dmcassel commented Jun 4, 2015

From my sources, no concrete plans, but we're open to the official client expanding in that direction. Tickets for discussion would be good before PRs.

@rlouapre
Copy link
Contributor Author

My initial question was just about to ease Roxy install from gulp / javascript.
I end up using download package and the following code:

    var installRoxy = function(answers, cb) {
        var Download = require('download');
        new Download({mode: '755', extract: true, strip: 1})
            .get('https://github.com/marklogic/roxy/releases/download/v' + answers.roxyVersion + '/roxy-' + answers.roxyVersion + '.zip')
            .dest('./roxy')
            .run(
                function() {
                    if (cb) cb();
                }
            );
    };

@grtjn
Copy link
Contributor

grtjn commented Jun 10, 2015

Thnx for sharing!

@grtjn
Copy link
Contributor

grtjn commented Jul 8, 2015

Elegant way to download Roxy by the way, using the release zip, instead of using git clone. It does mean you cannot make use of the dev branch, which often has some nice new extras, but alas.

I agree with Joe though, that it doesn't make too much sense to make an npm package of Roxy. But a Gem doesn't really make much sense either. Roxy is mostly a standalone app.

I would see something in making an mlpm package out of it. @joemfb WDYT? And if you agree, what would we need to do to get this as a package into mlpm registry?

@joemfb
Copy link
Contributor

joemfb commented Jul 8, 2015

I disagree; I think Roxy is or should be a command-line tool for managing apps. And since it's written in Ruby, I think it should be distributed as a gem. (Homebrew could also work, but then what about Windows: nuget?)

That would mean that app_specific.rb, build.properties, and any environment-specific config would live within a Roxy project, but all the Ruby and XQuery libraries would be bundled within the gem. One nice consequence of this would be cleaner, smaller projects.

My view for mlpm is that it should manage packages that are to be evaluated within Marklogic. I think Marklogic-related tools should use language/environment specific distribution mechanisms (npm for js, Rubygems for ruby, pip for python, etc.).

@grtjn
Copy link
Contributor

grtjn commented Jul 8, 2015

Makes sense. So not npm package, nor mlpm package. Still not sure about gem either though. A gem would make perfect sense if Roxy would be a library that you could 'require' from within a different Ruby project. But Roxy is a large mix of things. There is all kinds of stuff in there.

And apart from all that, I see not a lot of gain in packaging Roxy to be honest. Just downloading the zip, or the ml script seems pretty straight-forward already to me..

Anyone else thoughts on this?

@joemfb
Copy link
Contributor

joemfb commented Jul 8, 2015

Like npm packages, ruby gems aren't just for managing dependencies, but also distributing executables:

@grtjn
Copy link
Contributor

grtjn commented Jul 8, 2015

I know, but still..

@rlouapre
Copy link
Contributor Author

rlouapre commented Jul 8, 2015

I did not say that Roxy should be published a npm package. I just suggested to add a package.json

@grtjn
Copy link
Contributor

grtjn commented Jul 8, 2015

Ah, and then just install directly from github! I like your approach of downloading the zip better I think. But if it really helps you...

@rlouapre
Copy link
Contributor Author

rlouapre commented Jul 8, 2015

If package.json was available roxy could be installed like this:
for master branch - npm install marklogic/roxy
for dev branch - npm install marklogic/roxy#dev
any specific version - npm install marklogic/roxy#{tag-name}

@grtjn
Copy link
Contributor

grtjn commented Jul 8, 2015

I'm only thinking, doing npm install would put all roxy files inside node_modules/roxy/, not directly helpful. On the other hand, we could perhaps add an ml.js, that should get linked as ml, and wraps ml.rb like ml.bat and ml sh script does. It would rely on sys-call to Ruby, but would at least make the npm install actually give you something useful.

I also like to take a closer look at the gem stuff..

@rlouapre
Copy link
Contributor Author

rlouapre commented Jul 8, 2015

I came around this issue using cwd parameter [1](with ml) and [2](with ml.rb) here roxy project is in /roxy directory.

Again my idea was to provide better integration with gulp and slush (I am not sure how gem will help in this use case).

[1] - https://github.com/nativelogix/xquerrail2.framework/blob/master/gulpfile.js#L118
[2] - https://github.com/nativelogix/slush-xquerrail/blob/master/templates/app/gulpFile.js#L31

@rlouapre
Copy link
Contributor Author

rlouapre commented Jul 8, 2015

Would it make sense to create a different issue for gem?

@grtjn
Copy link
Contributor

grtjn commented Jul 9, 2015

Yes, with low prio as nobody asked for it yet. :)

grtjn added a commit to grtjn/roxy that referenced this issue Jun 14, 2017
@grtjn
Copy link
Contributor

grtjn commented Jun 14, 2017

Seems to work: npm install grtjn/roxy#454-package-json, but still wondering what the real benefit is. I agree with Joe that a gem distribution makes most sense, and for other uses there is either the option to git clone (like the built-in upgrader and ml new are doing), or you can grab zip or jar from the releases page.

Slush-marklogic-node downloads the ml-script, and lets ml new figure out itself how to get Roxy (e.g. by using git clone currently). Using ml new has the benefit it automatically cleans up and initializes the project along the way, so you get a much better starting point than by just cloning/copying Roxy..

@grtjn
Copy link
Contributor

grtjn commented Jun 14, 2017

I thinking about closing this ticket. Thoughts?

@grtjn grtjn closed this as completed Jun 14, 2017
@grtjn grtjn self-assigned this Jun 14, 2017
@grtjn grtjn added this to the July 2017 milestone Jun 14, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants