gen-license 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 43a6226171232363c6f0d4b7865c829aed6dcf5cad7b284803f6a5a145ad1664
4
- data.tar.gz: 05c6b9efc5089d4a8343cc1666ddd75dc4eb6ce2c52c264b42e751c798683585
3
+ metadata.gz: d9e75f55052815800c8f676c87058ec01f02be647a56493c42546fae29ffd05a
4
+ data.tar.gz: a78cf4301dc23afb9624c7ef55913b8f14046459ee359cc5f41354b321ac4ba6
5
5
  SHA512:
6
- metadata.gz: 2a605e164402f50152c20f78790b55479d270dc337f3e5101955471fa439f5ecb215fa2a213e4c68ea336f611b64deea6003c56bd414d39470e21816f8531249
7
- data.tar.gz: b973567cfdce5053d7de3c9c9d0380391708659e9fc650d61b6f6548865f3ad047e97ea95a131e8bdc62989d21b58c6d4b181acac3a4cb116f3438644e786e25
6
+ metadata.gz: 0feea8ef11cb645c4687d6ce633baa839fa437c07a7b8032c06bf21a8eac5be236f3f31d7b433e2af0168449bcf701c1730ceef4edfdf43bf2068fcbbca8fb21
7
+ data.tar.gz: c177994e6935c7a7600d86207b34324a1cd718eaba67353ea90ab704f5c0999c5e6d1523936f24750336454d36c31e456127f7430685cc8c0ff864fddf57aae5
data/README.md ADDED
@@ -0,0 +1,27 @@
1
+ # gen-licnese-rb
2
+
3
+ gen-license-rb is a 996.icu license generator implemented in Ruby, this generator is developed to generate various open-source licenses including MIT, Apache, etc. More importantly, the main purpose of this tool is to incorporate those aforesaid licenses into a brand new license: 996.icu, defined by 996.icu.
4
+
5
+ # Install
6
+ ```
7
+ $ gem install gen-license
8
+ ```
9
+
10
+ # Usage
11
+ ```
12
+ # Common LICENSE
13
+ gen-license mit # generate mit LICENSE file in current directory
14
+
15
+ # List LICENSE codes
16
+ gen-license --list
17
+
18
+ # Conmmon LICENSE with 996ICU
19
+ gen-license mit --996icu # generate mit LICENSE with 996ICU zh-cn version
20
+ gen-license mit --996icu en-us # generate mit LICENSE with 996ICU en-us version
21
+ ```
22
+
23
+ ### dev
24
+ ```
25
+ $ gem build gen-license.gemspec
26
+ $ gem install gen-license-0.0.1.gem
27
+ ```
data/bin/gen-license CHANGED
@@ -18,33 +18,22 @@ LICENSES = [
18
18
  "996icu-0.1",
19
19
  ]
20
20
 
21
- LangMap = {
22
- "zh" => "zh-cn",
23
- "zh-cn" => "zh-cn",
24
- "zh-hans" => "zh-cn",
25
- "en" => "en-us",
26
- "en-us" => "en-us",
27
- }
28
-
29
21
  LicenseName = "LICENSE"
30
22
 
31
23
  def printHelp
32
24
  puts <<-EOS
33
- usage: gen-license [-h] [--list] [--996icu [{en-us,zh-cn}]]
34
- [{agpl-3.0,apache-2.0,bsd-2-clause,bsd-3-clause,epl-2.0,gpl-2.0,gpl-3.0,lgpl-2.1,lgpl-3.0,mit,mpl-2.0,unlicenses,996icu-0.1}]
25
+ usage: gen-license [-h] [--list]
26
+ [{agpl-3.0,apache-2.0,bsd-2-clause,bsd-3-clause,epl-2.0,gpl-2.0,gpl-3.0,lgpl-2.1,lgpl-3.0,mit,mpl-2.0,unlicenses}]
35
27
 
36
28
  tools to create license file, support GitHub LICENSE code.
37
29
 
38
30
  positional arguments:
39
- {agpl-3.0,apache-2.0,bsd-2-clause,bsd-3-clause,epl-2.0,gpl-2.0,gpl-3.0,lgpl-2.1,lgpl-3.0,mit,mpl-2.0,unlicenses,996icu-0.1}
31
+ {agpl-3.0,apache-2.0,bsd-2-clause,bsd-3-clause,epl-2.0,gpl-2.0,gpl-3.0,lgpl-2.1,lgpl-3.0,mit,mpl-2.0,unlicenses}
40
32
  LICENSE Code, --list to see
41
33
 
42
34
  optional arguments:
43
35
  -h, --help show this help message and exit
44
36
  --list Show supported LICENSE Codes
45
- --996icu [{en-us,zh-cn}]
46
- Expand LICENSE with 996ICU LICENSE, Choose a language
47
- vesion or default zh-cn
48
37
  EOS
49
38
  end
50
39
 
@@ -53,7 +42,7 @@ def printLicenses
53
42
  end
54
43
 
55
44
  def printCodeError(code)
56
- puts "error: argument code: invalid choice: '#{code}' (choose from 'agpl-3.0', 'apache-2.0', 'bsd-2-clause', 'bsd-3-clause', 'epl-2.0', 'gpl-2.0', 'gpl-3.0', 'lgpl-2.1', 'lgpl-3.0', 'mit', 'mpl-2.0', 'unlicenses', '996icu-0.1')"
45
+ puts "error: argument code: invalid choice: '#{code}' (choose from 'agpl-3.0', 'apache-2.0', 'bsd-2-clause', 'bsd-3-clause', 'epl-2.0', 'gpl-2.0', 'gpl-3.0', 'lgpl-2.1', 'lgpl-3.0', 'mit', 'mpl-2.0', 'unlicenses')"
57
46
  end
58
47
 
59
48
  def printResult(code)
@@ -72,13 +61,23 @@ def parse
72
61
  opt = OptionParser.new
73
62
  argvLength = ARGV.length
74
63
  code = ARGV[0]
75
- lang = ARGV[2]
76
64
 
77
65
  if argvLength == 0
78
66
  printHelp
67
+ exit
68
+ end
69
+
70
+ if code == '-h'
71
+ printHelp
72
+ exit
79
73
  end
80
74
 
81
- if code && ARGV.length == 1
75
+ if code == '--list'
76
+ printLicenses
77
+ exit
78
+ end
79
+
80
+ if code
82
81
  if LICENSES.include?(code)
83
82
  s = readTemplate("#{code}")
84
83
  writeLicense(s)
@@ -86,47 +85,7 @@ def parse
86
85
  else
87
86
  printCodeError(code)
88
87
  end
89
- end
90
-
91
- opt.on('-h') {|v|
92
- if v == true
93
- printHelp
94
- end
95
- }
96
-
97
- opt.on('--list') {|v|
98
- if v == true
99
- if ARGV.length == 0
100
- printLicenses
101
- else
102
- printHelp
103
- end
104
- end
105
- }
106
-
107
- opt.on('--996icu') {|v|
108
- if v == true &&
109
- if LICENSES.include?(code)
110
- langCode = "zh-cn"
111
- if LangMap.has_key?(lang)
112
- langCode = LangMap[lang]
113
- end
114
- t = readTemplate("996.icu.template.#{langCode}")
115
- s = readTemplate("#{code}")
116
- t.gsub!(/{other}/, code)
117
- t.gsub!(/{content}/, s)
118
- writeLicense(t)
119
- printResult(code + " (996icu #{langCode})")
120
- else
121
- printCodeError(code)
122
- end
123
- end
124
- }
125
-
126
- begin
127
- opt.parse!(ARGV)
128
- rescue OptionParser::InvalidOption => e
129
- printHelp
88
+ exit
130
89
  end
131
90
 
132
91
  end
data/gen-license.gemspec CHANGED
@@ -1,6 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'gen-license'
3
- s.version = '0.0.1'
3
+ s.version = '0.0.2'
4
+ s.licenses = ['MIT']
4
5
  s.date = '2019-04-14'
5
6
  s.summary = 'Generate LICENSE Files'
6
7
  s.description = 'Generate LICENSE Files'
@@ -8,5 +9,5 @@ Gem::Specification.new do |s|
8
9
  s.email = 'dongrify@gmail.com'
9
10
  s.homepage = 'https://github.com/dongri/gen-license'
10
11
  s.files = `git ls-files`.split($\)
11
- s.executables = s.files.grep(%r{^bin/gen-license}) { |f| File.basename(f) }
12
+ s.executables = s.files.grep(%r{^bin}) { |f| File.basename(f) }
12
13
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gen-license
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dongri Jin
@@ -17,13 +17,9 @@ executables:
17
17
  extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
- - LICENSE
21
- - bin/LICENSE
20
+ - README.md
22
21
  - bin/gen-license
23
22
  - gen-license.gemspec
24
- - licenses/996.icu.template.en-us.txt
25
- - licenses/996.icu.template.zh-cn.txt
26
- - licenses/996icu-0.1.txt
27
23
  - licenses/agpl-3.0.txt
28
24
  - licenses/apache-2.0.txt
29
25
  - licenses/bsd-2-clause.txt
@@ -37,7 +33,8 @@ files:
37
33
  - licenses/mpl-2.0.txt
38
34
  - licenses/unlicenses.txt
39
35
  homepage: https://github.com/dongri/gen-license
40
- licenses: []
36
+ licenses:
37
+ - MIT
41
38
  metadata: {}
42
39
  post_install_message:
43
40
  rdoc_options: []
data/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) [year] [fullname]
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
data/bin/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) [year] [fullname]
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,31 +0,0 @@
1
- Copyright © 2019 <copyright holders>
2
- The 996ICU License (996ICU)
3
-
4
- 996ICU License is an extented license for {other}.
5
- This license extended {other}, and {other} will be declared at the foot of this license.
6
-
7
- Individual who seeks authorization must fulfill the following obligations:
8
-
9
- 1. Including this authorization file in any of its copies and important parts of the software.
10
-
11
- Organization that seeks authorization must fulfill the following obligations:
12
-
13
- 1. Including this authorization file in any of its copies and important parts of the software.
14
- 2. Not forcing any employee or temporary worker to work in excess of the legal maximum working time in any form or by any means, including but not limited to: orders, threats, implications, etc.
15
- 3. Not retaliating against any employee or temporary worker without participating in labor in excess of the legal maximum working time in any form or by any means, including but not limited to: mental assaults, personal injuries, illegal deductions of due remuneration, illegal dismissals, etc.
16
- 4. Paying economic compensation at no lower than the standards stipulated by local laws and regulations, when organizing employees or temporary workers to work overtime.
17
- 5. This organization is not in the blacklist[^1] as stipulated in the agreement.
18
-
19
- If the authorized individual or organization fails to fulfill any of the above obligations, the authorization will be withdrawn.
20
-
21
- The undefined behavior of this license is handled by {other}. The part of {other} that conflicts with this agreement is handled in accordance with this agreement.
22
-
23
-
24
- * Discussion https://github.com/996icu/996.ICU/pull/15642
25
- * 996 from https://feathub.com/LinXueyuanStdio/996.ICU
26
- * [^1]: blacklist https://github.com/996icu/996.ICU/blob/master/blacklist/blacklist.md
27
-
28
- {other}
29
- --------------------------------------------------------------------------------
30
-
31
- {content}
@@ -1,33 +0,0 @@
1
- Copyright © 2019 <copyright holders>
2
- The 996ICU License (996ICU)
3
-
4
- 996ICU License 是一个关于 {other} 的扩展协议.
5
- 此协议扩展了 {other}, {other} 将在本协议文本末尾声明.
6
-
7
- 要求得到授权的个人履行以下义务:
8
-
9
- 1. 将此授权文件包含在其任何副本以及软件的重要部分中.
10
-
11
- 要求得到授权的组织履行以下义务:
12
-
13
- 1. 将此授权文件包含在其任何副本以及软件的重要部分中.
14
- 2. 不以任何形式或手段强迫其雇佣员工或临时劳动者进行超过当地法定最长劳动时间的劳动,
15
- 包括但不限于: 命令, 威胁, 暗示等.
16
- 3. 不以任何形式报复不参与超过法定最长劳动时间的劳动的雇佣员工或临时劳动者,
17
- 包括但不限于: 辱骂等精神攻击, 殴打等人身伤害以及非法开除等.
18
- 4. 组织其雇佣员工或临时劳动者进行超时劳动时,按不低于当地法规标准支付经济补偿.
19
- 5. 此组织不在协议规定的黑名单中.
20
-
21
- 如果获得授权的个人或组织未能履行以上义务任意一条, 则授权将被收回.
22
-
23
- 此协议未定义的行为, 按 {other} 协议处理.
24
- {other} 与本协议冲突的部分, 按本协议处理.
25
-
26
- https://github.com/996icu/996.ICU/pull/15642
27
- 996 from https://feathub.com/LinXueyuanStdio/996.ICU
28
- 黑名单: https://github.com/996icu/996.ICU/blob/master/blacklist/blacklist.md
29
-
30
- {other}
31
- --------------------------------------------------------------------------------
32
-
33
- {content}
@@ -1,13 +0,0 @@
1
- The 996ICU License (996ICU)
2
- Version 0.1, March 2019
3
-
4
- PACKAGE is distributed under LICENSE with the following restriction:
5
-
6
- The above license is only granted to entities that act in concordance
7
- with local labor laws. In addition, the following requirements must be
8
- observed:
9
-
10
- * The licencee must not, explicitly or implicitly, request or schedule
11
- their employees to work more than 45 hours in any single week.
12
- * The licencee must not, explicitly or implicitly, request or schedule
13
- their employees to be at work consecutively for 10 hours.