license-generator 0.0.1 → 0.1.0
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/README.md +15 -16
- data/features/generate_license.feature +14 -0
- data/features/get_help.feature +19 -0
- data/features/list_templates.feature +8 -0
- data/features/step_definitions/license-generator_steps.rb +7 -0
- data/lib/license-generator/app.rb +28 -4
- data/lib/license-generator/version.rb +1 -1
- data/spec/app_spec.rb +19 -5
- data/templates/bsd.erb +2 -2
- metadata +69 -73
- data/features/bsd_license.feature +0 -15
data/README.md
CHANGED
@@ -2,33 +2,32 @@
|
|
2
2
|
|
3
3
|
Generate an open source license for your projects.
|
4
4
|
|
5
|
-
##
|
5
|
+
## Installation
|
6
6
|
|
7
|
-
|
7
|
+
gem install lickjen
|
8
8
|
|
9
|
-
|
10
|
-
anyone named Jennifer.
|
9
|
+
## Usage:
|
11
10
|
|
12
|
-
|
11
|
+
lickjen [license] [options]
|
13
12
|
|
14
|
-
|
13
|
+
Too see the available license templates:
|
15
14
|
|
16
|
-
|
15
|
+
lickjen list
|
17
16
|
|
18
17
|
### Please add some!
|
19
18
|
|
20
19
|
There are a lot. See <http://www.opensource.org/licenses/alphabetical>.
|
21
20
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
8. I will pull it, bump the version number, and add you to the credits for fame and glory.
|
21
|
+
Simply fork, add an ERB template to the `templates` directory, and send me a
|
22
|
+
pull request.
|
23
|
+
|
24
|
+
Since it's ERB you can use ruby to include things like the current date. You
|
25
|
+
can also prompt the user for input like this:
|
26
|
+
|
27
|
+
<%= option(:name) %>
|
30
28
|
|
31
29
|
## Credits
|
32
30
|
|
33
31
|
* Justin Blake <justin@hentzia.com>
|
34
|
-
* Bill Evans (help naming the binary
|
32
|
+
* Bill Evans (help naming the binary and pushing to make it not hard to add
|
33
|
+
templates).
|
@@ -0,0 +1,14 @@
|
|
1
|
+
Feature: Generate a License
|
2
|
+
In order to release my code to the public without worry
|
3
|
+
As an open source developer
|
4
|
+
I want to generate a LICENSE file in my project
|
5
|
+
|
6
|
+
Scenario: Run `lickjen bsd`
|
7
|
+
When I run `lickjen bsd` interactively
|
8
|
+
And I type "Justin Blake"
|
9
|
+
And I type "Hentzia"
|
10
|
+
Then a file named "LICENSE" should exist
|
11
|
+
And the file "LICENSE" should contain a copyright notice for "Justin Blake"
|
12
|
+
And the file "LICENSE" should contain "Neither the name of Hentzia nor the names of its"
|
13
|
+
|
14
|
+
# TODO: add a couple more scenarios when we have more templates
|
@@ -0,0 +1,19 @@
|
|
1
|
+
Feature: Get help
|
2
|
+
In order to use this thing like a pro
|
3
|
+
As a small scared child
|
4
|
+
I want to get help
|
5
|
+
|
6
|
+
Scenario: Run licken with no args
|
7
|
+
When I run `lickjen`
|
8
|
+
Then I should see the generic help output
|
9
|
+
|
10
|
+
@wip
|
11
|
+
Scenario: Run licken help task
|
12
|
+
When I run `lickjen help`
|
13
|
+
Then I should see the generic help output
|
14
|
+
|
15
|
+
@wip
|
16
|
+
Scenario: Run lickjen help task for the list task
|
17
|
+
|
18
|
+
@wip
|
19
|
+
Scenario: Run lickjen help task for the bsd template
|
@@ -0,0 +1,8 @@
|
|
1
|
+
Feature: List templates
|
2
|
+
In order to see the available templates
|
3
|
+
I want to list them like a boss
|
4
|
+
|
5
|
+
Scenario: Run `lickjen list`
|
6
|
+
When I run `lickjen list`
|
7
|
+
Then the output should contain "bsd"
|
8
|
+
# TODO: add a couple more conditions when we have more templates
|
@@ -6,3 +6,10 @@ Then /^the file "([^"]*)" should contain a copyright notice for "([^"]*)"$/ do |
|
|
6
6
|
year = Time.now.year
|
7
7
|
Then "the file \"#{file}\" should contain \"Copyright (c) #{year}, #{name}\""
|
8
8
|
end
|
9
|
+
|
10
|
+
Then /^I should see the generic help output$/ do
|
11
|
+
Then "the output should contain \"lickjen help [TASK]\""
|
12
|
+
Then "the output should contain \"lickjen list\""
|
13
|
+
Then "the output should contain \"lickjen bsd\""
|
14
|
+
# TODO: add more conditions when we have more templates
|
15
|
+
end
|
@@ -9,10 +9,34 @@ module LicenseGenerator
|
|
9
9
|
File.expand_path('../../templates', File.dirname(__FILE__))
|
10
10
|
end
|
11
11
|
|
12
|
-
desc "
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
desc "list", "List available license templates"
|
13
|
+
def list
|
14
|
+
Dir.foreach(self.class.source_root) do |template|
|
15
|
+
say template unless %w(. ..).include?(template)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def method_missing(meth, *args)
|
20
|
+
template "#{meth}.erb", "LICENSE"
|
21
|
+
end
|
22
|
+
|
23
|
+
# Override Thor#help so it can give information about any class and any method.
|
24
|
+
def help(task = nil)
|
25
|
+
super
|
26
|
+
say "Templates:"
|
27
|
+
Dir.foreach(self.class.source_root) do |template|
|
28
|
+
unless %w(. ..).include?(template)
|
29
|
+
template = template.split('.').first
|
30
|
+
say " lickjen #{template}\t# Generate a #{template} template"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
def option(name)
|
37
|
+
@template_options ||= {}
|
38
|
+
@template_options[name] ||= ask("#{name.capitalize}:")
|
39
|
+
@template_options[name]
|
16
40
|
end
|
17
41
|
end
|
18
42
|
end
|
data/spec/app_spec.rb
CHANGED
@@ -5,10 +5,24 @@ describe LicenseGenerator::App do
|
|
5
5
|
@app = LicenseGenerator::App.new
|
6
6
|
end
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
@app.should_receive(:template).with("
|
11
|
-
@app.
|
8
|
+
it "finds template dynamically" do
|
9
|
+
%w(bsd gpl mit).each do |license|
|
10
|
+
@app.should_receive(:template).with("#{license}.erb", "LICENSE")
|
11
|
+
@app.send(license)
|
12
12
|
end
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
|
+
it "can list available templates" do
|
16
|
+
LicenseGenerator::App.stub!(:source_root).and_return("template path")
|
17
|
+
Dir.should_receive(:foreach).with("template path").
|
18
|
+
and_yield(".").
|
19
|
+
and_yield("..").
|
20
|
+
and_yield("bsd").
|
21
|
+
and_yield("gpl")
|
22
|
+
@app.should_receive(:say).with(/bsd/).once
|
23
|
+
@app.should_receive(:say).with(/gpl/).once
|
24
|
+
@app.list
|
25
|
+
end
|
26
|
+
|
27
|
+
it "has proper specs for the help task"
|
28
|
+
end
|
data/templates/bsd.erb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c) <%= Time.now.year %>, <%=
|
1
|
+
Copyright (c) <%= Time.now.year %>, <%= option(:name) %>
|
2
2
|
All rights reserved.
|
3
3
|
|
4
4
|
Redistribution and use in source and binary forms, with or without
|
@@ -9,7 +9,7 @@ modification, are permitted provided that the following conditions are met:
|
|
9
9
|
* Redistributions in binary form must reproduce the above copyright
|
10
10
|
notice, this list of conditions and the following disclaimer in the
|
11
11
|
documentation and/or other materials provided with the distribution.
|
12
|
-
* Neither the name of <%=
|
12
|
+
* Neither the name of <%= option(:organization) %> nor the names of its
|
13
13
|
contributors may be used to endorse or promote products derived from this
|
14
14
|
software without specific prior written permission.
|
15
15
|
|
metadata
CHANGED
@@ -1,83 +1,79 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: license-generator
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
4
5
|
prerelease:
|
5
|
-
version: 0.0.1
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Justin Blake
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
dependencies:
|
16
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-10-03 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
17
15
|
name: thor
|
18
|
-
|
19
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &70227757839720 !ruby/object:Gem::Requirement
|
20
17
|
none: false
|
21
|
-
requirements:
|
22
|
-
- -
|
23
|
-
- !ruby/object:Gem::Version
|
24
|
-
version:
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
25
22
|
type: :runtime
|
26
|
-
version_requirements: *id001
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rake
|
29
23
|
prerelease: false
|
30
|
-
|
24
|
+
version_requirements: *70227757839720
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rake
|
27
|
+
requirement: &70227757809080 !ruby/object:Gem::Requirement
|
31
28
|
none: false
|
32
|
-
requirements:
|
33
|
-
- -
|
34
|
-
- !ruby/object:Gem::Version
|
35
|
-
version:
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
36
33
|
type: :development
|
37
|
-
version_requirements: *id002
|
38
|
-
- !ruby/object:Gem::Dependency
|
39
|
-
name: rspec
|
40
34
|
prerelease: false
|
41
|
-
|
35
|
+
version_requirements: *70227757809080
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rspec
|
38
|
+
requirement: &70227757808360 !ruby/object:Gem::Requirement
|
42
39
|
none: false
|
43
|
-
requirements:
|
44
|
-
- -
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version:
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
47
44
|
type: :development
|
48
|
-
version_requirements: *id003
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
name: cucumber
|
51
45
|
prerelease: false
|
52
|
-
|
46
|
+
version_requirements: *70227757808360
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: cucumber
|
49
|
+
requirement: &70227757807700 !ruby/object:Gem::Requirement
|
53
50
|
none: false
|
54
|
-
requirements:
|
55
|
-
- -
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
version:
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
58
55
|
type: :development
|
59
|
-
version_requirements: *id004
|
60
|
-
- !ruby/object:Gem::Dependency
|
61
|
-
name: aruba
|
62
56
|
prerelease: false
|
63
|
-
|
57
|
+
version_requirements: *70227757807700
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: aruba
|
60
|
+
requirement: &70227757807020 !ruby/object:Gem::Requirement
|
64
61
|
none: false
|
65
|
-
requirements:
|
66
|
-
- -
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version:
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
69
66
|
type: :development
|
70
|
-
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *70227757807020
|
71
69
|
description: Generate an open source license file in your project.
|
72
|
-
email:
|
70
|
+
email:
|
73
71
|
- justin@hentzia.com
|
74
|
-
executables:
|
72
|
+
executables:
|
75
73
|
- lickjen
|
76
74
|
extensions: []
|
77
|
-
|
78
75
|
extra_rdoc_files: []
|
79
|
-
|
80
|
-
files:
|
76
|
+
files:
|
81
77
|
- .gitignore
|
82
78
|
- CHANGELOG.md
|
83
79
|
- Gemfile
|
@@ -85,7 +81,9 @@ files:
|
|
85
81
|
- README.md
|
86
82
|
- Rakefile
|
87
83
|
- bin/lickjen
|
88
|
-
- features/
|
84
|
+
- features/generate_license.feature
|
85
|
+
- features/get_help.feature
|
86
|
+
- features/list_templates.feature
|
89
87
|
- features/step_definitions/debug_steps.rb
|
90
88
|
- features/step_definitions/license-generator_steps.rb
|
91
89
|
- features/support/env.rb
|
@@ -97,36 +95,34 @@ files:
|
|
97
95
|
- spec/app_spec.rb
|
98
96
|
- spec/spec_helper.rb
|
99
97
|
- templates/bsd.erb
|
100
|
-
|
101
|
-
homepage: ""
|
98
|
+
homepage: ''
|
102
99
|
licenses: []
|
103
|
-
|
104
100
|
post_install_message:
|
105
101
|
rdoc_options: []
|
106
|
-
|
107
|
-
require_paths:
|
102
|
+
require_paths:
|
108
103
|
- lib
|
109
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
104
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
110
105
|
none: false
|
111
|
-
requirements:
|
112
|
-
- -
|
113
|
-
- !ruby/object:Gem::Version
|
114
|
-
version:
|
115
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
111
|
none: false
|
117
|
-
requirements:
|
118
|
-
- -
|
119
|
-
- !ruby/object:Gem::Version
|
120
|
-
version:
|
112
|
+
requirements:
|
113
|
+
- - ! '>='
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '0'
|
121
116
|
requirements: []
|
122
|
-
|
123
117
|
rubyforge_project: license-generator
|
124
|
-
rubygems_version: 1.
|
118
|
+
rubygems_version: 1.8.10
|
125
119
|
signing_key:
|
126
120
|
specification_version: 3
|
127
121
|
summary: Open Source License generator
|
128
|
-
test_files:
|
129
|
-
- features/
|
122
|
+
test_files:
|
123
|
+
- features/generate_license.feature
|
124
|
+
- features/get_help.feature
|
125
|
+
- features/list_templates.feature
|
130
126
|
- features/step_definitions/debug_steps.rb
|
131
127
|
- features/step_definitions/license-generator_steps.rb
|
132
128
|
- features/support/env.rb
|
@@ -1,15 +0,0 @@
|
|
1
|
-
Feature: Generate BSD License
|
2
|
-
In order to release my code under the BSD license
|
3
|
-
As an open source developer
|
4
|
-
I want to generate a BSD LICENSE file in my project
|
5
|
-
|
6
|
-
Scenario: Run `lickjen bsd` with no arguments
|
7
|
-
When I successfully run `lickjen bsd`
|
8
|
-
Then the output should contain "No value provided for required options"
|
9
|
-
|
10
|
-
Scenario: Run `lickjen bsd --name='Justin Blake' --organization=Hentzia`
|
11
|
-
When I successfully run `lickjen bsd --name='Justin Blake' --organization=Hentzia`
|
12
|
-
Then the output should say the file "LICENSE" was created
|
13
|
-
And a file named "LICENSE" should exist
|
14
|
-
And the file "LICENSE" should contain a copyright notice for "Justin Blake"
|
15
|
-
And the file "LICENSE" should contain "Neither the name of Hentzia nor the names of its"
|