Skip to content

interactively query for license#1101

Closed
MartinNowak wants to merge 1 commit intodlang:masterfrom
MartinNowak:default_license
Closed

interactively query for license#1101
MartinNowak wants to merge 1 commit intodlang:masterfrom
MartinNowak:default_license

Conversation

@MartinNowak
Copy link
Member

@MartinNowak MartinNowak commented Mar 26, 2017

  • add select input (also for sdl/json)
  • provide common license defaults (choosealicense.com options + Boost)
  • order options by popularity

licenses
Suggestion: https://twitter.com/WebFreak001/status/845731612478332929

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.1%) to 61.527% when pulling d2872b1 on MartinNowak:default_license into 5a9b2f5 on dlang:stable.

@s-ludwig
Copy link
Member

I think this would be a mistake. Choosing a license needs to be a conscious process, and just assuming a license silently is likely to cause bad assumptions at some point (code.dlang.org would display "MIT", while in reality the author chose GPL 3, but never updated the entry, leading to license infringement). Couldn't we instead present a list of known licenses to choose from?

@MartinNowak MartinNowak changed the title change default license to MIT interactively query for license Mar 26, 2017
@MartinNowak
Copy link
Member Author

Puh 😓, done.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.1%) to 61.745% when pulling a802f30 on MartinNowak:default_license into 5a9b2f5 on dlang:stable.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.1%) to 61.745% when pulling 46b88a0 on MartinNowak:default_license into 5a9b2f5 on dlang:stable.

free_choice,
p.license,
"MIT", "BSL-1.0 (Boost)", "public domain", "GPL-3.0", "BSD 3-clause", "BSD", "GPL-2.0", "LGPL-3.0", "APL-2.0 (Apache)", "MPL-2.0 (Mozilla)", "AGPL-3.0", "proprietary"
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there was a .splitter(' ').front at the end and two adjustments ("APL-2.0 (Apache)"->"Apache-2.0", "BSD"->"BSD 2-clause") then this would match exactly what is listed in the package format specification. BTW, the short name of the Apache license according to Wikipedia is "ASL", not sure if we should use that or not.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated, not sure what you mean with .splitter(' ').front.

@s-ludwig
Copy link
Member

That looks really nice, the single-input choice/custom value entry is a good idea. See no issues in the implementation.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.1%) to 61.745% when pulling 5a7cdde on MartinNowak:default_license into 5a9b2f5 on dlang:stable.

@MartinNowak
Copy link
Member Author

Could you please disable coveralls comments under https://coveralls.io/github/dlang/dub/settings? The status API should be enough.

@s-ludwig
Copy link
Member

s-ludwig commented Jul 4, 2017

For some reason this currently fails just for the older frontend versions:

[INFO] Running /home/travis/build/dlang/dub/test/0-init-interactive.sh...
Select a package recipe format
0) sdl   1) json  
#? [1]: Name [0-init-interactive]: Description [A minimal D application.]: Author name [travis]: Select or enter a license (https://choosealicense.com/)
0) MIT                 1) BSL-1.0 (Boost)     2) public domain       3) GPL-3.0             
4) BSD 3-clause        5) BSD 2-clause        6) GPL-2.0             7) LGPL-3.0            
8) Apache-2.0          9) MPL-2.0 (Mozilla)  10) AGPL-3.0           11) proprietary        
? [11]: Copyright string [Copyright © 2017, travis]: Add dependency (leave empty to skip) []: Successfully created an empty project in '/home/travis/build/dlang/dub/0-init-interactive'.
Package successfully created in 0-init-interactive
5c5
< license "pl"
---
> license "gpl"
Contents of generated dub.sdl not as expected.

@MartinNowak
Copy link
Member Author

For some reason this currently fails just for the older frontend versions:

It's apparently because parse!uint ate the first char, even though it wasn't a digit.

@dlang-bot
Copy link
Collaborator

Thanks for your pull request, @MartinNowak!

@MartinNowak
Copy link
Member Author

Fixed and rebased @s-ludwig

@MartinNowak
Copy link
Member Author

MartinNowak commented Jul 5, 2017

Is this a candidate for stable? We're close to a release candidate, might be a bit late.

@s-ludwig
Copy link
Member

s-ludwig commented Jul 6, 2017

Usually, I'd say master, but in this case, if some careful manual testing also shows no issues, the scope is IMO limited enough to make an exception if we want to (I don't particularly mind the small release, but it would help to balance the 1.4.0 and 1.5.0 releases a bit). It's currently still based on master, though.

@MartinNowak MartinNowak changed the base branch from stable to master July 10, 2017 00:33
- add select input (also for sdl/json)
- provide common license defaults (choosealicense.com options + Boost)
- order options by popularity
@MartinNowak
Copy link
Member Author

No need to hurry with this, retargeted to master and fixed 2.069 compat.

@WebFreak001
Copy link
Member

WebFreak001 commented Mar 18, 2020

rebase pls, useful feature!

after rebasing you might need to change your 0-init-interactive.dub.json to

{
	"authors": [
		"author"
	],
	"copyright": "copy",
	"description": "desc",
	"license": "gpl",
	"name": "test"
}

to make the tests pass. Also you need to change the changelog entry to the new format. I would suggest a message like

Dub init now has a select menu for package format and license

When creating a package using `dub init` you are now prompted to select a license for the package.

@MartinNowak
Copy link
Member Author

I don't have time to work on dlang atm., but feel invited to take over this PR @WebFreak001.

@WebFreak001
Copy link
Member

I don't have permissions to write to your branch

@MartinNowak
Copy link
Member Author

Just clone and make a new PR @WebFreak001

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

Comments