Categories: None [Edit]
licenses
# License
Create software licenses easily.
## Install
### Bundler: `gem 'license'`
### RubyGems: `gem install license`
## Usage
### Simple
```ruby
license = License::Software::MIT.new do |l|
l.year.start = 2012
l.author.name = 'Ryan Scott Lewis'
l.author.email = '[email protected]'
end
p license.to_s # => "Copyright (c) 2012 Ryan Scott Lewis \n\nPermission is hereby granted, free of charge..."
```
### Multiple Authors
```ruby
license = License::Software::MIT.new do |l|
l.year.start = 2012
l.authors.add name: 'Ryan Scott Lewis', email: '[email protected]'
l.authors.add name: 'John Doe', email: '[email protected]'
l.authors.add name: 'Snake Pliskin'
l.authors.add 'John McClane '
end
p license.to_s # => "Copyright (c) 2012 Ryan Scott Lewis , John Doe \n\nPermission is hereby granted, free of charge..."
p license.authors.first.name # => 'Ryan Scott Lewis'
p license.authors.first.email # => '[email protected]'
p license.authors.last.name # => 'John McClane'
p license.authors.last.email # => '[email protected]'
p license.authors.last.emails # => ['[email protected]', '[email protected]]
```
#### Smart Setters
```ruby
license = License::Software.new do |l|
l.type = License::Software::MIT # Set which type of license here instead
l.year = '2006-2011' # Will set year.start to 2006 and year.end to 2011
l.authors = 'Ryan Scott Lewis, John Doe < [email protected] >'
end
p license.to_s # => "Copyright (c) 2012 Ryan Scott Lewis , John Doe \n\nPermission is hereby granted, free of charge..."
```
#### Advanced usage (preferred method)
```ruby
license = License::Software.new do # Do not pass block variables to enter the scope of the License::Software
type MIT
year 2012
author 'Ryan Scott Lewis '
end
p license.to_s # => "Copyright (c) 2012 Ryan Scott Lewis \n\nPermission is hereby granted, free of charge..."
```
##...
Total
Ranking: 132,199 of 183,107
Downloads: 4,211
Daily
Ranking: 53,556 of 183,092
Downloads: 1
Downloads Trends
Ranking Trends
Num of Versions Trends
Popular Versions (Major)
Popular Versions (Major.Minor)
Depended by
Rank | Downloads | Name |
---|---|---|
159,458 | 2,767 | Cebu |
Depends on
Rank | Downloads | Name |
---|---|---|
88 | 381,901,392 | rb-fsevent |
389 | 93,982,532 | guard-rspec |
392 | 93,021,715 | redcarpet |
708 | 60,245,256 | fuubar |
1,135 | 30,057,223 | github-markup |
4,053 | 1,872,302 | version |
7,013 | 503,083 | guard-yard |
Owners
# | Gravatar | Handle |
---|---|---|
1 | RyanScottLewis |