licenses 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +3 -0
- data/Guardfile +11 -0
- data/LICENSE +20 -0
- data/README.md +82 -0
- data/Rakefile +58 -0
- data/VERSION +1 -0
- data/examples/software.rb +45 -0
- data/lib/licenses.rb +24 -0
- data/lib/licenses/gpl.rb +7 -0
- data/lib/licenses/license.rb +15 -0
- data/lib/licenses/mit.rb +7 -0
- data/licenses.gemspec +47 -0
- data/licenses/MIT.erb +20 -0
- data/spec/licenses/software/_new_spec.rb +77 -0
- data/spec/spec_helper.rb +1 -0
- metadata +205 -0
data/Gemfile
ADDED
data/Guardfile
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
guard 'yard' do
|
2
|
+
watch(%r{app/.+\.rb})
|
3
|
+
watch(%r{lib/.+\.rb})
|
4
|
+
watch(%r{ext/.+\.c})
|
5
|
+
end
|
6
|
+
|
7
|
+
guard 'rspec', cli: '-c -f Fuubar' do
|
8
|
+
watch(%r{^spec/.+_spec\.rb$})
|
9
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
10
|
+
watch('spec/spec_helper.rb') { "spec" }
|
11
|
+
end
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2012 Ryan Scott Lewis <ryan@rynet.us>
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
# License
|
2
|
+
|
3
|
+
Create software licenses easily.
|
4
|
+
|
5
|
+
## Install
|
6
|
+
|
7
|
+
### Bundler: `gem 'license'`
|
8
|
+
|
9
|
+
### RubyGems: `gem install license`
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
### Simple
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
license = License::Software::MIT.new do |l|
|
17
|
+
l.year.start = 2012
|
18
|
+
l.author.name = 'Ryan Scott Lewis'
|
19
|
+
l.author.email = 'ryan@rynet.us'
|
20
|
+
end
|
21
|
+
|
22
|
+
p license.to_s # => "Copyright (c) 2012 Ryan Scott Lewis <ryan@rynet.us>\n\nPermission is hereby granted, free of charge..."
|
23
|
+
```
|
24
|
+
|
25
|
+
### Multiple Authors
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
license = License::Software::MIT.new do |l|
|
29
|
+
l.year.start = 2012
|
30
|
+
l.authors.add name: 'Ryan Scott Lewis', email: 'ryan@rynet.us'
|
31
|
+
l.authors.add name: 'John Doe', email: 'john.doe@example.com'
|
32
|
+
l.authors.add name: 'Snake Pliskin'
|
33
|
+
l.authors.add 'John McClane <john@mcclain.org, jmcclane@gmail.com>'
|
34
|
+
end
|
35
|
+
|
36
|
+
p license.to_s # => "Copyright (c) 2012 Ryan Scott Lewis <ryan@rynet.us>, John Doe <john.doe@example.com>\n\nPermission is hereby granted, free of charge..."
|
37
|
+
p license.authors.first.name # => 'Ryan Scott Lewis'
|
38
|
+
p license.authors.first.email # => 'ryan@rynet.us'
|
39
|
+
p license.authors.last.name # => 'John McClane'
|
40
|
+
p license.authors.last.email # => 'john@mcclain.org'
|
41
|
+
p license.authors.last.emails # => ['john@mcclain.org', 'jmcclane@gmail.com]
|
42
|
+
```
|
43
|
+
|
44
|
+
#### Smart Setters
|
45
|
+
|
46
|
+
```ruby
|
47
|
+
license = License::Software.new do |l|
|
48
|
+
l.type = License::Software::MIT # Set which type of license here instead
|
49
|
+
l.year = '2006-2011' # Will set year.start to 2006 and year.end to 2011
|
50
|
+
l.authors = 'Ryan Scott Lewis<ryan@rynet>, John Doe < john.doe@example.com >'
|
51
|
+
end
|
52
|
+
|
53
|
+
p license.to_s # => "Copyright (c) 2012 Ryan Scott Lewis <ryan@rynet.us>, John Doe <john.doe@example.com>\n\nPermission is hereby granted, free of charge..."
|
54
|
+
```
|
55
|
+
|
56
|
+
#### Advanced usage (preferred method)
|
57
|
+
|
58
|
+
```ruby
|
59
|
+
license = License::Software.new do # Do not pass block variables to enter the scope of the License::Software
|
60
|
+
type MIT
|
61
|
+
year 2012
|
62
|
+
author 'Ryan Scott Lewis <ryan@rynet.us>'
|
63
|
+
end
|
64
|
+
|
65
|
+
p license.to_s # => "Copyright (c) 2012 Ryan Scott Lewis <ryan@rynet.us>\n\nPermission is hereby granted, free of charge..."
|
66
|
+
```
|
67
|
+
|
68
|
+
## Contributing
|
69
|
+
|
70
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
71
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
72
|
+
* Fork the project
|
73
|
+
* Start a feature/bugfix branch
|
74
|
+
* Commit and push until you are happy with your contribution
|
75
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
76
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
77
|
+
|
78
|
+
## Copyright
|
79
|
+
|
80
|
+
Copyright © 2012 Ryan Scott Lewis <ryan@rynet.us>.
|
81
|
+
|
82
|
+
The MIT License (MIT) - See LICENSE for further details.
|
data/Rakefile
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
|
3
|
+
def require_task(path)
|
4
|
+
begin
|
5
|
+
require path
|
6
|
+
|
7
|
+
yield
|
8
|
+
rescue LoadError
|
9
|
+
puts '', "Could not load '#{path}'.", 'Try to `rake gem:spec` and `bundle install` and try again.', ''
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
spec = Gem::Specification.new do |s|
|
14
|
+
|
15
|
+
# Variables
|
16
|
+
s.name = 'licenses'
|
17
|
+
s.author = 'Ryan Scott Lewis'
|
18
|
+
s.email = 'ryan@rynet.us'
|
19
|
+
s.summary = 'Easily generate software license files.'
|
20
|
+
|
21
|
+
# Dependencies
|
22
|
+
s.add_dependency 'version', '~> 1.0.0'
|
23
|
+
s.add_development_dependency 'guard-rspec', '~> 2.1'
|
24
|
+
s.add_development_dependency 'guard-yard', '~> 2.0'
|
25
|
+
s.add_development_dependency 'rb-fsevent', '~> 0.9'
|
26
|
+
s.add_development_dependency 'fuubar', '~> 1.1'
|
27
|
+
s.add_development_dependency 'redcarpet', '~> 2.2.2'
|
28
|
+
s.add_development_dependency 'github-markup', '~> 0.7'
|
29
|
+
|
30
|
+
# Pragmatically set variables
|
31
|
+
s.homepage = "http://github.com/RyanScottLewis/#{s.name}"
|
32
|
+
s.version = Pathname.glob('VERSION*').first.read
|
33
|
+
s.description = Pathname.glob('README*').first.read
|
34
|
+
s.require_paths = ['lib']
|
35
|
+
s.files = `git ls-files`.lines.to_a.collect { |s| s.strip }
|
36
|
+
s.executables = `git ls-files -- bin/*`.lines.to_a.collect { |s| File.basename(s.strip) }
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
desc 'Generate the gemspec defined in this Rakefile'
|
41
|
+
task :gemspec do
|
42
|
+
Pathname.new("#{spec.name}.gemspec").open('w') { |f| f.write(spec.to_ruby) }
|
43
|
+
end
|
44
|
+
|
45
|
+
require_task 'rake/version_task' do
|
46
|
+
Rake::VersionTask.new do |t|
|
47
|
+
t.with_git_tag = true
|
48
|
+
t.with_gemspec = spec
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
require 'rubygems/package_task'
|
53
|
+
Gem::PackageTask.new(spec) do |t|
|
54
|
+
t.need_zip = false
|
55
|
+
t.need_tar = false
|
56
|
+
end
|
57
|
+
|
58
|
+
task :default => :gemspec
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# Simple usage:
|
2
|
+
|
3
|
+
license = Licenses::MIT.new do |l|
|
4
|
+
l.year.start = 2012
|
5
|
+
l.author.name = 'Ryan Scott Lewis'
|
6
|
+
l.author.email = 'ryan@rynet.us'
|
7
|
+
end
|
8
|
+
|
9
|
+
p license.to_s # => "Copyright (c) 2012 Ryan Scott Lewis <ryan@rynet.us>\n\nPermission is hereby granted, free of charge..."
|
10
|
+
|
11
|
+
# Multiple authors:
|
12
|
+
|
13
|
+
license = Licenses::MIT.new do |l|
|
14
|
+
l.year.start = 2012
|
15
|
+
l.authors.add name: 'Ryan Scott Lewis', email: 'ryan@rynet.us'
|
16
|
+
l.authors.add name: 'John Doe', email: 'john.doe@example.com'
|
17
|
+
l.authors.add name: 'Snake Pliskin'
|
18
|
+
l.authors.add 'John McClane <john@mcclain.org, jmcclane@gmail.com>'
|
19
|
+
end
|
20
|
+
|
21
|
+
p license.to_s # => "Copyright (c) 2012 Ryan Scott Lewis <ryan@rynet.us>, John Doe <john.doe@example.com>\n\nPermission is hereby granted, free of charge..."
|
22
|
+
p license.authors.first.name # => 'Ryan Scott Lewis'
|
23
|
+
p license.authors.first.email # => 'ryan@rynet.us'
|
24
|
+
p license.authors.last.name # => 'John McClane'
|
25
|
+
p license.authors.last.email # => 'john@mcclain.org'
|
26
|
+
p license.authors.last.emails # => ['john@mcclain.org', 'jmcclane@gmail.com]
|
27
|
+
|
28
|
+
# Smart setters:
|
29
|
+
|
30
|
+
license = Licenses::MIT.new do |l|
|
31
|
+
# l.type = Licenses::Software::MIT # Set which type of License here instead
|
32
|
+
l.year = '2006-2011' # Will set year.start to 2006 and year.end to 2011
|
33
|
+
l.authors = 'Ryan Scott Lewis<ryan@rynet>, John Doe < john.doe@example.com >'
|
34
|
+
end
|
35
|
+
|
36
|
+
p license.to_s # => "Copyright (c) 2012 Ryan Scott Lewis <ryan@rynet.us>, John Doe <john.doe@example.com>\n\nPermission is hereby granted, free of charge..."
|
37
|
+
|
38
|
+
# Advanced usage (preferred method):
|
39
|
+
|
40
|
+
license = Licenses::MIT.new do # Do not pass block variables to enter the scope of the License::Software
|
41
|
+
year 2012
|
42
|
+
author 'Ryan Scott Lewis <ryan@rynet.us>'
|
43
|
+
end
|
44
|
+
|
45
|
+
p license.to_s # => "Copyright (c) 2012 Ryan Scott Lewis <ryan@rynet.us>\n\nPermission is hereby granted, free of charge..."
|
data/lib/licenses.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'version'
|
2
|
+
|
3
|
+
module Licenses
|
4
|
+
is_versioned
|
5
|
+
|
6
|
+
class << self
|
7
|
+
|
8
|
+
def all
|
9
|
+
@all ||= []
|
10
|
+
end
|
11
|
+
|
12
|
+
def types
|
13
|
+
all.collect(&:type)
|
14
|
+
end
|
15
|
+
|
16
|
+
def names
|
17
|
+
all.collect(&:name)
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
require 'licenses/mit'
|
24
|
+
require 'licenses/gpl'
|
data/lib/licenses/gpl.rb
ADDED
data/lib/licenses/mit.rb
ADDED
data/licenses.gemspec
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = "licenses"
|
5
|
+
s.version = "0.0.1"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Ryan Scott Lewis"]
|
9
|
+
s.date = "2012-11-28"
|
10
|
+
s.description = "# License\n\nCreate software licenses easily.\n\n## Install\n\n### Bundler: `gem 'license'`\n\n### RubyGems: `gem install license`\n\n## Usage\n\n### Simple\n\n```ruby\nlicense = License::Software::MIT.new do |l|\n l.year.start = 2012\n l.author.name = 'Ryan Scott Lewis'\n l.author.email = 'ryan@rynet.us'\nend\n\np license.to_s # => \"Copyright (c) 2012 Ryan Scott Lewis <ryan@rynet.us>\\n\\nPermission is hereby granted, free of charge...\"\n```\n\n### Multiple Authors\n\n```ruby\nlicense = License::Software::MIT.new do |l|\n l.year.start = 2012\n l.authors.add name: 'Ryan Scott Lewis', email: 'ryan@rynet.us'\n l.authors.add name: 'John Doe', email: 'john.doe@example.com'\n l.authors.add name: 'Snake Pliskin'\n l.authors.add 'John McClane <john@mcclain.org, jmcclane@gmail.com>'\nend\n\np license.to_s # => \"Copyright (c) 2012 Ryan Scott Lewis <ryan@rynet.us>, John Doe <john.doe@example.com>\\n\\nPermission is hereby granted, free of charge...\"\np license.authors.first.name # => 'Ryan Scott Lewis'\np license.authors.first.email # => 'ryan@rynet.us'\np license.authors.last.name # => 'John McClane'\np license.authors.last.email # => 'john@mcclain.org'\np license.authors.last.emails # => ['john@mcclain.org', 'jmcclane@gmail.com]\n```\n\n#### Smart Setters\n\n```ruby\nlicense = License::Software.new do |l|\n l.type = License::Software::MIT # Set which type of license here instead\n l.year = '2006-2011' # Will set year.start to 2006 and year.end to 2011\n l.authors = 'Ryan Scott Lewis<ryan@rynet>, John Doe < john.doe@example.com >' \nend\n\np license.to_s # => \"Copyright (c) 2012 Ryan Scott Lewis <ryan@rynet.us>, John Doe <john.doe@example.com>\\n\\nPermission is hereby granted, free of charge...\"\n```\n\n#### Advanced usage (preferred method)\n\n```ruby\nlicense = License::Software.new do # Do not pass block variables to enter the scope of the License::Software\n type MIT\n year 2012\n author 'Ryan Scott Lewis <ryan@rynet.us>'\nend\n\np license.to_s # => \"Copyright (c) 2012 Ryan Scott Lewis <ryan@rynet.us>\\n\\nPermission is hereby granted, free of charge...\"\n```\n\n## Contributing\n\n* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet\n* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it\n* Fork the project\n* Start a feature/bugfix branch\n* Commit and push until you are happy with your contribution\n* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.\n* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.\n\n## Copyright\n\nCopyright \u{a9} 2012 Ryan Scott Lewis <ryan@rynet.us>.\n\nThe MIT License (MIT) - See LICENSE for further details."
|
11
|
+
s.email = "ryan@rynet.us"
|
12
|
+
s.files = ["Gemfile", "Guardfile", "LICENSE", "README.md", "Rakefile", "VERSION", "examples/software.rb", "lib/licenses.rb", "lib/licenses/gpl.rb", "lib/licenses/license.rb", "lib/licenses/mit.rb", "licenses/MIT.erb", "spec/licenses/software/_new_spec.rb", "spec/spec_helper.rb"]
|
13
|
+
s.homepage = "http://github.com/RyanScottLewis/licenses"
|
14
|
+
s.require_paths = ["lib"]
|
15
|
+
s.rubygems_version = "1.8.24"
|
16
|
+
s.summary = "Easily generate software license files."
|
17
|
+
|
18
|
+
if s.respond_to? :specification_version then
|
19
|
+
s.specification_version = 3
|
20
|
+
|
21
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
22
|
+
s.add_runtime_dependency(%q<version>, ["~> 1.0.0"])
|
23
|
+
s.add_development_dependency(%q<guard-rspec>, ["~> 2.1"])
|
24
|
+
s.add_development_dependency(%q<guard-yard>, ["~> 2.0"])
|
25
|
+
s.add_development_dependency(%q<rb-fsevent>, ["~> 0.9"])
|
26
|
+
s.add_development_dependency(%q<fuubar>, ["~> 1.1"])
|
27
|
+
s.add_development_dependency(%q<redcarpet>, ["~> 2.2.2"])
|
28
|
+
s.add_development_dependency(%q<github-markup>, ["~> 0.7"])
|
29
|
+
else
|
30
|
+
s.add_dependency(%q<version>, ["~> 1.0.0"])
|
31
|
+
s.add_dependency(%q<guard-rspec>, ["~> 2.1"])
|
32
|
+
s.add_dependency(%q<guard-yard>, ["~> 2.0"])
|
33
|
+
s.add_dependency(%q<rb-fsevent>, ["~> 0.9"])
|
34
|
+
s.add_dependency(%q<fuubar>, ["~> 1.1"])
|
35
|
+
s.add_dependency(%q<redcarpet>, ["~> 2.2.2"])
|
36
|
+
s.add_dependency(%q<github-markup>, ["~> 0.7"])
|
37
|
+
end
|
38
|
+
else
|
39
|
+
s.add_dependency(%q<version>, ["~> 1.0.0"])
|
40
|
+
s.add_dependency(%q<guard-rspec>, ["~> 2.1"])
|
41
|
+
s.add_dependency(%q<guard-yard>, ["~> 2.0"])
|
42
|
+
s.add_dependency(%q<rb-fsevent>, ["~> 0.9"])
|
43
|
+
s.add_dependency(%q<fuubar>, ["~> 1.1"])
|
44
|
+
s.add_dependency(%q<redcarpet>, ["~> 2.2.2"])
|
45
|
+
s.add_dependency(%q<github-markup>, ["~> 0.7"])
|
46
|
+
end
|
47
|
+
end
|
data/licenses/MIT.erb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) <%= year %> <%= owners %>
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,77 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Licenses::License, '.new' do
|
4
|
+
|
5
|
+
context 'When no arguments are given' do
|
6
|
+
|
7
|
+
end
|
8
|
+
|
9
|
+
context 'When one argument is given' do
|
10
|
+
|
11
|
+
context 'and it is a subclass of Licenses::License' do
|
12
|
+
|
13
|
+
subject { Licenses::License.new(Licenses::MIT) }
|
14
|
+
|
15
|
+
it 'should initialize a new instance of the subclass given' do
|
16
|
+
subject.class.should == Licenses::MIT
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
context 'and it is a Symbol or responds to #to_sym' do
|
22
|
+
|
23
|
+
context 'and it exists as a key within Licenses.keys' do
|
24
|
+
|
25
|
+
subject { Licenses::License.new(:mit) }
|
26
|
+
|
27
|
+
it 'should initialize a new instance of the sublcass mapped to the value within Licenses.keys' do
|
28
|
+
subject.class.should == Licenses::MIT
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
context 'and it doesnt exist as a key within Licenses.keys' do
|
34
|
+
|
35
|
+
it 'should raise Licenses::UnknownLicence' do
|
36
|
+
expect { Licenses::License.new(:foo) }.to raise_error(Licenses::UnknownLicenceError)
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
context 'and it is an Array' do
|
44
|
+
|
45
|
+
it 'should raise Licenses::ArgumentError' do
|
46
|
+
expect { Licenses::License.new([:mit, :gpl]) }.to raise_error(Licenses::ArgumentError)
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
context 'When a block is given' do
|
54
|
+
|
55
|
+
context 'and a block variable is given' do
|
56
|
+
|
57
|
+
it 'should yield the block with the current instance' do
|
58
|
+
|
59
|
+
Licenses::License.new(:mit) { |licence| licence.class.should == Licenses::MIT }
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
context 'and a block variable is not given' do
|
66
|
+
|
67
|
+
it 'should call #instance_eval on the instance with the block' do
|
68
|
+
|
69
|
+
Licenses::License.new(:mit) { self.class.should == Licenses::MIT }
|
70
|
+
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'licenses'
|
metadata
ADDED
@@ -0,0 +1,205 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: licenses
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Ryan Scott Lewis
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-11-28 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: version
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 1.0.0
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.0.0
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: guard-rspec
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '2.1'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '2.1'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: guard-yard
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '2.0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rb-fsevent
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0.9'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0.9'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: fuubar
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ~>
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '1.1'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '1.1'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: redcarpet
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ~>
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: 2.2.2
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ~>
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 2.2.2
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: github-markup
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ~>
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0.7'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ~>
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0.7'
|
126
|
+
description: ! "# License\n\nCreate software licenses easily.\n\n## Install\n\n###
|
127
|
+
Bundler: `gem 'license'`\n\n### RubyGems: `gem install license`\n\n## Usage\n\n###
|
128
|
+
Simple\n\n```ruby\nlicense = License::Software::MIT.new do |l|\n l.year.start =
|
129
|
+
2012\n l.author.name = 'Ryan Scott Lewis'\n l.author.email = 'ryan@rynet.us'\nend\n\np
|
130
|
+
license.to_s # => \"Copyright (c) 2012 Ryan Scott Lewis <ryan@rynet.us>\\n\\nPermission
|
131
|
+
is hereby granted, free of charge...\"\n```\n\n### Multiple Authors\n\n```ruby\nlicense
|
132
|
+
= License::Software::MIT.new do |l|\n l.year.start = 2012\n l.authors.add name:
|
133
|
+
'Ryan Scott Lewis', email: 'ryan@rynet.us'\n l.authors.add name: 'John Doe', email:
|
134
|
+
'john.doe@example.com'\n l.authors.add name: 'Snake Pliskin'\n l.authors.add 'John
|
135
|
+
McClane <john@mcclain.org, jmcclane@gmail.com>'\nend\n\np license.to_s # => \"Copyright
|
136
|
+
(c) 2012 Ryan Scott Lewis <ryan@rynet.us>, John Doe <john.doe@example.com>\\n\\nPermission
|
137
|
+
is hereby granted, free of charge...\"\np license.authors.first.name # => 'Ryan
|
138
|
+
Scott Lewis'\np license.authors.first.email # => 'ryan@rynet.us'\np license.authors.last.name
|
139
|
+
# => 'John McClane'\np license.authors.last.email # => 'john@mcclain.org'\np license.authors.last.emails
|
140
|
+
# => ['john@mcclain.org', 'jmcclane@gmail.com]\n```\n\n#### Smart Setters\n\n```ruby\nlicense
|
141
|
+
= License::Software.new do |l|\n l.type = License::Software::MIT # Set which type
|
142
|
+
of license here instead\n l.year = '2006-2011' # Will set year.start to 2006 and
|
143
|
+
year.end to 2011\n l.authors = 'Ryan Scott Lewis<ryan@rynet>, John Doe < john.doe@example.com
|
144
|
+
\ >' \nend\n\np license.to_s # => \"Copyright (c) 2012 Ryan Scott Lewis <ryan@rynet.us>,
|
145
|
+
John Doe <john.doe@example.com>\\n\\nPermission is hereby granted, free of charge...\"\n```\n\n####
|
146
|
+
Advanced usage (preferred method)\n\n```ruby\nlicense = License::Software.new do
|
147
|
+
# Do not pass block variables to enter the scope of the License::Software\n type
|
148
|
+
MIT\n year 2012\n author 'Ryan Scott Lewis <ryan@rynet.us>'\nend\n\np license.to_s
|
149
|
+
# => \"Copyright (c) 2012 Ryan Scott Lewis <ryan@rynet.us>\\n\\nPermission is hereby
|
150
|
+
granted, free of charge...\"\n```\n\n## Contributing\n\n* Check out the latest master
|
151
|
+
to make sure the feature hasn't been implemented or the bug hasn't been fixed yet\n*
|
152
|
+
Check out the issue tracker to make sure someone already hasn't requested it and/or
|
153
|
+
contributed it\n* Fork the project\n* Start a feature/bugfix branch\n* Commit and
|
154
|
+
push until you are happy with your contribution\n* Make sure to add tests for it.
|
155
|
+
This is important so I don't break it in a future version unintentionally.\n* Please
|
156
|
+
try not to mess with the Rakefile, version, or history. If you want to have your
|
157
|
+
own version, or is otherwise necessary, that is fine, but please isolate to its
|
158
|
+
own commit so I can cherry-pick around it.\n\n## Copyright\n\nCopyright © 2012 Ryan
|
159
|
+
Scott Lewis <ryan@rynet.us>.\n\nThe MIT License (MIT) - See LICENSE for further
|
160
|
+
details."
|
161
|
+
email: ryan@rynet.us
|
162
|
+
executables: []
|
163
|
+
extensions: []
|
164
|
+
extra_rdoc_files: []
|
165
|
+
files:
|
166
|
+
- Gemfile
|
167
|
+
- Guardfile
|
168
|
+
- LICENSE
|
169
|
+
- README.md
|
170
|
+
- Rakefile
|
171
|
+
- VERSION
|
172
|
+
- examples/software.rb
|
173
|
+
- lib/licenses.rb
|
174
|
+
- lib/licenses/gpl.rb
|
175
|
+
- lib/licenses/license.rb
|
176
|
+
- lib/licenses/mit.rb
|
177
|
+
- licenses.gemspec
|
178
|
+
- licenses/MIT.erb
|
179
|
+
- spec/licenses/software/_new_spec.rb
|
180
|
+
- spec/spec_helper.rb
|
181
|
+
homepage: http://github.com/RyanScottLewis/licenses
|
182
|
+
licenses: []
|
183
|
+
post_install_message:
|
184
|
+
rdoc_options: []
|
185
|
+
require_paths:
|
186
|
+
- lib
|
187
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
188
|
+
none: false
|
189
|
+
requirements:
|
190
|
+
- - ! '>='
|
191
|
+
- !ruby/object:Gem::Version
|
192
|
+
version: '0'
|
193
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
194
|
+
none: false
|
195
|
+
requirements:
|
196
|
+
- - ! '>='
|
197
|
+
- !ruby/object:Gem::Version
|
198
|
+
version: '0'
|
199
|
+
requirements: []
|
200
|
+
rubyforge_project:
|
201
|
+
rubygems_version: 1.8.24
|
202
|
+
signing_key:
|
203
|
+
specification_version: 3
|
204
|
+
summary: Easily generate software license files.
|
205
|
+
test_files: []
|