sign 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/sign/fetcher.rb +1 -1
- data/lib/sign/generator.rb +8 -6
- data/lib/sign/runner.rb +8 -8
- data/lib/sign/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6e9e0a78029c3547fdcf8ba7a8724b44dda116e
|
4
|
+
data.tar.gz: ba4c8a6f03d20ad6d0989782ad8b9d6284419c0f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d240de357b8215a5ecce64037a6b6178dacd76de73e4c48ee565104fd501894de4ee1e72a0fe1ff8ed33a576103102055010b66c3580004c29e28b44da60bcd3
|
7
|
+
data.tar.gz: '007447852ebeed043b911bbaf43baddb44176b60b30293baca0f25d468bd1fc702351760ae2a63cdd5e8f035e2a9e25cc5f6270b39a3d6e4520b4cd40e13ede8'
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
+
## [1.0.1] - 2017-11-02
|
8
|
+
### Changed
|
9
|
+
- Fix issue where some licenses weren't being fetched.
|
10
|
+
- Overall refactor of code to improve code readability.
|
11
|
+
|
12
|
+
|
7
13
|
## [1.0.0] - 2017-11-02
|
8
14
|
### Added
|
9
15
|
- More licenses.
|
data/lib/sign/fetcher.rb
CHANGED
data/lib/sign/generator.rb
CHANGED
@@ -2,7 +2,7 @@ require "Date"
|
|
2
2
|
|
3
3
|
module Sign
|
4
4
|
class Generator
|
5
|
-
def
|
5
|
+
def create(license, name, year)
|
6
6
|
raise ArgumentError, "#{license} is not available." unless File.readable?(license)
|
7
7
|
|
8
8
|
license_template = File.read(license)
|
@@ -10,11 +10,13 @@ module Sign
|
|
10
10
|
year = get_year if year.nil?
|
11
11
|
|
12
12
|
if placeholders_exist?(license_template)
|
13
|
-
|
14
|
-
|
13
|
+
new_license = license_template.gsub("[AUTHOR]", name)
|
14
|
+
new_license = new_license.gsub("[YEAR]", year)
|
15
|
+
else
|
16
|
+
new_license = license_template
|
15
17
|
end
|
16
18
|
|
17
|
-
create_new_file(
|
19
|
+
create_new_file(new_license)
|
18
20
|
end
|
19
21
|
|
20
22
|
def placeholders_exist?(license_template)
|
@@ -23,9 +25,9 @@ module Sign
|
|
23
25
|
placeholders.any? { |placeholder| license_template.include?(placeholder) }
|
24
26
|
end
|
25
27
|
|
26
|
-
def create_new_file(
|
28
|
+
def create_new_file(new_license)
|
27
29
|
new_file = File.new("LICENSE", "w")
|
28
|
-
new_file.puts(
|
30
|
+
new_file.puts(new_license)
|
29
31
|
new_file.close
|
30
32
|
puts "License created \033[91m<3\033[0m"
|
31
33
|
end
|
data/lib/sign/runner.rb
CHANGED
@@ -6,17 +6,17 @@ module Sign
|
|
6
6
|
|
7
7
|
case argv[0]
|
8
8
|
when "--help"
|
9
|
-
|
9
|
+
show_help
|
10
10
|
when "--version"
|
11
|
-
|
11
|
+
show_version
|
12
12
|
when "--list"
|
13
|
-
|
13
|
+
show_list
|
14
14
|
else
|
15
15
|
create_license(argv)
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
def
|
19
|
+
def show_help
|
20
20
|
puts ""
|
21
21
|
puts " Generate a license for your project in a matter of seconds."
|
22
22
|
puts ""
|
@@ -32,7 +32,7 @@ module Sign
|
|
32
32
|
puts ""
|
33
33
|
end
|
34
34
|
|
35
|
-
def
|
35
|
+
def show_list
|
36
36
|
puts ""
|
37
37
|
puts "List of available licenses:"
|
38
38
|
puts ""
|
@@ -40,16 +40,16 @@ module Sign
|
|
40
40
|
puts ""
|
41
41
|
end
|
42
42
|
|
43
|
-
def
|
43
|
+
def show_version
|
44
44
|
puts "Sign v#{Sign::VERSION}"
|
45
45
|
end
|
46
46
|
|
47
47
|
def create_license(argv)
|
48
|
-
license = Sign::Fetcher.new.
|
48
|
+
license = Sign::Fetcher.new.get_license(argv[0])
|
49
49
|
name = !!argv[1] ? parse_argument(argv[1]) : nil
|
50
50
|
year = !!argv[2] ? parse_argument(argv[2]) : nil
|
51
51
|
|
52
|
-
Sign::Generator.new.
|
52
|
+
Sign::Generator.new.create(license, name, year)
|
53
53
|
end
|
54
54
|
|
55
55
|
def parse_argument(arg)
|
data/lib/sign/version.rb
CHANGED