license_header 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/license_header/auditor.rb +10 -10
- data/lib/license_header/version.rb +1 -1
- metadata +3 -3
@@ -13,12 +13,12 @@ module LicenseHeader
|
|
13
13
|
# Only :each is required; if the other two are not provided they will be
|
14
14
|
# ignored
|
15
15
|
LANGUAGE_SYNTAX = {
|
16
|
-
:css => { :pre => '/* ', :each => ' * ', :post => '*/', :exts => %w(.css .scss)
|
17
|
-
:erb => { :pre => '<%#', :each => '', :post => '%>', :exts => %w(.erb)
|
18
|
-
:haml => { :pre => '-#', :each => ' ', :exts => %w(.haml)
|
19
|
-
:html => { :pre => '<!--', :each => '', :post => '-->', :exts => %w(.html)
|
20
|
-
:javascript => { :pre => '/* ', :each => ' * ', :post => '*/', :exts => %w(.js .json)
|
21
|
-
:ruby => { :each => '# ', :exts => %w(.rb .rake .coffee) },
|
16
|
+
:css => { :pre => '/* ', :each => ' * ', :post => '*/', :exts => %w(.css .scss) },
|
17
|
+
:erb => { :pre => '<%#', :each => '', :post => '%>', :exts => %w(.erb) },
|
18
|
+
:haml => { :pre => '-#', :each => ' ', :exts => %w(.haml) },
|
19
|
+
:html => { :pre => '<!--', :each => '', :post => '-->', :exts => %w(.html) },
|
20
|
+
:javascript => { :pre => '/* ', :each => ' * ', :post => '*/', :exts => %w(.js .json) },
|
21
|
+
:ruby => { :each => '# ', :exts => %w(.rb .rake .coffee .pp) },
|
22
22
|
}
|
23
23
|
|
24
24
|
class Auditor
|
@@ -59,7 +59,7 @@ module LicenseHeader
|
|
59
59
|
else
|
60
60
|
file_content = read_file(path)
|
61
61
|
header_content = format[:header]
|
62
|
-
index = file_content.find_index { |l| l =~ /--- [E]ND
|
62
|
+
index = file_content.find_index { |l| l =~ /--- [E]ND LICENSE_HEADER BLOCK ---/ }
|
63
63
|
if index.nil?
|
64
64
|
:missing
|
65
65
|
else
|
@@ -92,7 +92,7 @@ module LicenseHeader
|
|
92
92
|
end
|
93
93
|
|
94
94
|
def remove_license!(source_file, format)
|
95
|
-
end_of_license = source_file.find_index { |l| l =~ /--- [E]ND
|
95
|
+
end_of_license = source_file.find_index { |l| l =~ /--- [E]ND LICENSE_HEADER BLOCK ---/ }
|
96
96
|
if end_of_license.nil?
|
97
97
|
return false
|
98
98
|
else
|
@@ -131,9 +131,9 @@ module LicenseHeader
|
|
131
131
|
@headers.each_pair do |lang,syntax|
|
132
132
|
syntax[:header] = []
|
133
133
|
syntax[:header] << syntax[:pre] unless syntax[:pre].nil?
|
134
|
-
syntax[:header] << "#{syntax[:each]}
|
134
|
+
syntax[:header] << "#{syntax[:each]}--- BEGIN LICENSE_HEADER BLOCK ---"
|
135
135
|
syntax[:header] += license_terms.collect {|line| syntax[:each] + line }
|
136
|
-
syntax[:header] << "#{syntax[:each]}
|
136
|
+
syntax[:header] << "#{syntax[:each]}--- #{'E'}ND LICENSE_HEADER BLOCK ---"
|
137
137
|
syntax[:header] << syntax[:post] unless syntax[:post].nil?
|
138
138
|
syntax[:header] << ""
|
139
139
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: license_header
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -88,7 +88,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
88
88
|
version: '0'
|
89
89
|
segments:
|
90
90
|
- 0
|
91
|
-
hash:
|
91
|
+
hash: 3490609554518163732
|
92
92
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
93
|
none: false
|
94
94
|
requirements:
|
@@ -97,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
97
97
|
version: '0'
|
98
98
|
segments:
|
99
99
|
- 0
|
100
|
-
hash:
|
100
|
+
hash: 3490609554518163732
|
101
101
|
requirements: []
|
102
102
|
rubyforge_project:
|
103
103
|
rubygems_version: 1.8.23
|