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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fd5d4c735c56ca600006cf9d09e035a9e4e8353a
4
- data.tar.gz: 326db96060c4ed2c554444593b8e7a5d87e3f0a1
3
+ metadata.gz: b6e9e0a78029c3547fdcf8ba7a8724b44dda116e
4
+ data.tar.gz: ba4c8a6f03d20ad6d0989782ad8b9d6284419c0f
5
5
  SHA512:
6
- metadata.gz: 5760d21e360ed761582622d0cc2dd9cb6107ef157c885557b602cb1c556a05e748c0747d2c3174e38fa7259a193beee8365b0cac5097952702747bbf788776e0
7
- data.tar.gz: 7991ed7e2c7c0719b44dbff2625589bfb453b09181b0be7cc1a3d8e310c5c97e7cfcc9c117c87faf943815a068d8f5f2d17e5e91c80a8cac85f814199870b61a
6
+ metadata.gz: d240de357b8215a5ecce64037a6b6178dacd76de73e4c48ee565104fd501894de4ee1e72a0fe1ff8ed33a576103102055010b66c3580004c29e28b44da60bcd3
7
+ data.tar.gz: '007447852ebeed043b911bbaf43baddb44176b60b30293baca0f25d468bd1fc702351760ae2a63cdd5e8f035e2a9e25cc5f6270b39a3d6e4520b4cd40e13ede8'
@@ -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.
@@ -18,7 +18,7 @@ module Sign
18
18
  end
19
19
  end
20
20
 
21
- def get(license)
21
+ def get_license(license)
22
22
  if @@list.has_key?(license.downcase)
23
23
  file_name = "#{license}.txt"
24
24
  File.open("#{license_path}/#{file_name}")
@@ -2,7 +2,7 @@ require "Date"
2
2
 
3
3
  module Sign
4
4
  class Generator
5
- def make(license, name, year)
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
- modified_license = license_template.gsub("[AUTHOR]", name)
14
- modified_license = modified_license.gsub("[YEAR]", year)
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(modified_license)
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(modified_license)
28
+ def create_new_file(new_license)
27
29
  new_file = File.new("LICENSE", "w")
28
- new_file.puts(modified_license)
30
+ new_file.puts(new_license)
29
31
  new_file.close
30
32
  puts "License created \033[91m<3\033[0m"
31
33
  end
@@ -6,17 +6,17 @@ module Sign
6
6
 
7
7
  case argv[0]
8
8
  when "--help"
9
- display_help
9
+ show_help
10
10
  when "--version"
11
- display_version
11
+ show_version
12
12
  when "--list"
13
- display_list
13
+ show_list
14
14
  else
15
15
  create_license(argv)
16
16
  end
17
17
  end
18
18
 
19
- def display_help
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 display_list
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 display_version
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.get(argv[0])
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.make(license, name, year)
52
+ Sign::Generator.new.create(license, name, year)
53
53
  end
54
54
 
55
55
  def parse_argument(arg)
@@ -1,3 +1,3 @@
1
1
  module Sign
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sign
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan Ng