grapethor 0.2.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.
Files changed (92) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +8 -0
  3. data/.travis.yml +22 -0
  4. data/CHANGELOG.md +13 -0
  5. data/CODE_OF_CONDUCT.md +76 -0
  6. data/Gemfile +3 -0
  7. data/Gemfile.lock +53 -0
  8. data/LICENSE +19 -0
  9. data/README.md +165 -0
  10. data/Rakefile +9 -0
  11. data/_config.yml +1 -0
  12. data/bin/console +14 -0
  13. data/bin/setup +8 -0
  14. data/exe/grapethor +5 -0
  15. data/grapethor.gemspec +47 -0
  16. data/lib/grapethor.rb +10 -0
  17. data/lib/grapethor/generators/api.rb +78 -0
  18. data/lib/grapethor/generators/cli.rb +35 -0
  19. data/lib/grapethor/generators/endpoint.rb +168 -0
  20. data/lib/grapethor/generators/new.rb +161 -0
  21. data/lib/grapethor/generators/resource.rb +89 -0
  22. data/lib/grapethor/templates/api/api/%api_version%/base.rb.tt +19 -0
  23. data/lib/grapethor/templates/api_minitest/test/support/api_%api_version%_test_case.rb.tt +12 -0
  24. data/lib/grapethor/templates/api_rspec/.gitkeep +0 -0
  25. data/lib/grapethor/templates/docker/Dockerfile.tt +18 -0
  26. data/lib/grapethor/templates/docker/docker-compose.yml.tt +43 -0
  27. data/lib/grapethor/templates/endpoint.rb.erb +14 -0
  28. data/lib/grapethor/templates/endpoint/api/%api_version%/%end_resource_plural%.rb.tt +14 -0
  29. data/lib/grapethor/templates/endpoint_minitest.rb.erb +13 -0
  30. data/lib/grapethor/templates/endpoint_minitest/test/api/%api_version%/%end_resource_plural%_test.rb.tt +14 -0
  31. data/lib/grapethor/templates/endpoint_rspec.rb.erb +11 -0
  32. data/lib/grapethor/templates/endpoint_rspec/spec/api/%api_version%/%end_resource_plural%_spec.rb.tt +12 -0
  33. data/lib/grapethor/templates/license/apache2/LICENSE.tt +13 -0
  34. data/lib/grapethor/templates/license/cddl1/LICENSE.tt +316 -0
  35. data/lib/grapethor/templates/license/epl1/LICENSE.tt +200 -0
  36. data/lib/grapethor/templates/license/freebsd/LICENSE.tt +22 -0
  37. data/lib/grapethor/templates/license/gpl2/LICENSE.tt +17 -0
  38. data/lib/grapethor/templates/license/gpl3/LICENSE.tt +16 -0
  39. data/lib/grapethor/templates/license/mit/LICENSE.tt +19 -0
  40. data/lib/grapethor/templates/license/mpl2/LICENSE.tt +5 -0
  41. data/lib/grapethor/templates/license/newbsd/LICENSE.tt +26 -0
  42. data/lib/grapethor/templates/minitest/lib/tasks/test.rake +14 -0
  43. data/lib/grapethor/templates/minitest/test/support/reporters.rb +11 -0
  44. data/lib/grapethor/templates/minitest/test/support/test_case.rb +18 -0
  45. data/lib/grapethor/templates/minitest/test/test_helper.rb +12 -0
  46. data/lib/grapethor/templates/mysql/config/database.yml.tt +33 -0
  47. data/lib/grapethor/templates/new/.gitignore +7 -0
  48. data/lib/grapethor/templates/new/.grapethor.yml.tt +13 -0
  49. data/lib/grapethor/templates/new/Gemfile.tt +44 -0
  50. data/lib/grapethor/templates/new/README.md.tt +138 -0
  51. data/lib/grapethor/templates/new/Rakefile.tt +30 -0
  52. data/lib/grapethor/templates/new/api/base.rb.tt +19 -0
  53. data/lib/grapethor/templates/new/app/exceptions/not_found_error.rb +1 -0
  54. data/lib/grapethor/templates/new/bin/console +13 -0
  55. data/lib/grapethor/templates/new/bin/server.tt +14 -0
  56. data/lib/grapethor/templates/new/bin/setup.tt +8 -0
  57. data/lib/grapethor/templates/new/config.ru.tt +19 -0
  58. data/lib/grapethor/templates/new/config/application.rb.tt +18 -0
  59. data/lib/grapethor/templates/new/config/boot.rb +2 -0
  60. data/lib/grapethor/templates/new/config/environment.rb +3 -0
  61. data/lib/grapethor/templates/new/db/seeds.rb +7 -0
  62. data/lib/grapethor/templates/new/lib/tasks/routes.rake +8 -0
  63. data/lib/grapethor/templates/postgresql/config/database.yml.tt +38 -0
  64. data/lib/grapethor/templates/resource/api/%api_version%/%res_name_plural%.rb.tt +95 -0
  65. data/lib/grapethor/templates/resource/api/entities/%res_name%.rb.tt +10 -0
  66. data/lib/grapethor/templates/resource/app/models/%res_name%.rb.tt +6 -0
  67. data/lib/grapethor/templates/resource/db/migrations/%res_migration%.rb.tt +10 -0
  68. data/lib/grapethor/templates/resource_minitest/test/api/%api_version%/%res_name_plural%_test.rb.tt +82 -0
  69. data/lib/grapethor/templates/resource_minitest/test/fixtures/%res_name_plural%.yml.tt +9 -0
  70. data/lib/grapethor/templates/resource_minitest/test/models/%res_name%_test.rb.tt +17 -0
  71. data/lib/grapethor/templates/resource_rspec/spec/api/%api_version%/%res_name_plural%_spec.rb.tt +91 -0
  72. data/lib/grapethor/templates/resource_rspec/spec/factories/%res_name_plural%.rb.tt +7 -0
  73. data/lib/grapethor/templates/resource_rspec/spec/models/%res_name%_spec.rb.tt +9 -0
  74. data/lib/grapethor/templates/rspec/.rspec +1 -0
  75. data/lib/grapethor/templates/rspec/lib/tasks/spec.rake +4 -0
  76. data/lib/grapethor/templates/rspec/spec/spec_helper.rb +24 -0
  77. data/lib/grapethor/templates/sqlite/config/database.yml.tt +22 -0
  78. data/lib/grapethor/templates/swagger/swagger-ui/favicon-16x16.png +0 -0
  79. data/lib/grapethor/templates/swagger/swagger-ui/favicon-32x32.png +0 -0
  80. data/lib/grapethor/templates/swagger/swagger-ui/index.html.tt +60 -0
  81. data/lib/grapethor/templates/swagger/swagger-ui/oauth2-redirect.html +67 -0
  82. data/lib/grapethor/templates/swagger/swagger-ui/swagger-ui-bundle.js +93 -0
  83. data/lib/grapethor/templates/swagger/swagger-ui/swagger-ui-bundle.js.map +1 -0
  84. data/lib/grapethor/templates/swagger/swagger-ui/swagger-ui-standalone-preset.js +14 -0
  85. data/lib/grapethor/templates/swagger/swagger-ui/swagger-ui-standalone-preset.js.map +1 -0
  86. data/lib/grapethor/templates/swagger/swagger-ui/swagger-ui.css +3 -0
  87. data/lib/grapethor/templates/swagger/swagger-ui/swagger-ui.css.map +1 -0
  88. data/lib/grapethor/templates/swagger/swagger-ui/swagger-ui.js +9 -0
  89. data/lib/grapethor/templates/swagger/swagger-ui/swagger-ui.js.map +1 -0
  90. data/lib/grapethor/utils/utils.rb +116 -0
  91. data/lib/grapethor/version.rb +3 -0
  92. metadata +235 -0
@@ -0,0 +1,89 @@
1
+ require 'thor/group'
2
+ require 'active_support/inflector'
3
+
4
+ module Grapethor
5
+ class Resource < Thor::Group
6
+ include Thor::Actions
7
+ include Grapethor::Utils
8
+
9
+ attr_reader :api_version,
10
+ :app_path,
11
+ :res_name,
12
+ :res_attrs,
13
+ :res_desc
14
+
15
+ namespace :resource
16
+
17
+ def self.exit_on_failure?
18
+ true
19
+ end
20
+
21
+ def self.source_root
22
+ File.join(__dir__, '..')
23
+ end
24
+
25
+
26
+ argument :name, type: :string,
27
+ desc: "Resource name"
28
+
29
+
30
+ class_option :path, aliases: '-p',
31
+ type: :string,
32
+ default: '.',
33
+ desc: 'Relative path to application directory'
34
+
35
+ class_option :version, aliases: '-v',
36
+ type: :string,
37
+ default: 'v1',
38
+ desc: 'API version tag'
39
+
40
+ class_option :attrs, aliases: '-a',
41
+ type: :hash,
42
+ default: {},
43
+ desc: "Model attributes (use proper types for specific ORM)",
44
+ banner: "ATTRIBUTE:TYPE"
45
+
46
+
47
+ def parse_args_and_opts
48
+ @res_name = name.downcase.singularize
49
+ @res_attrs = options[:attrs].delete_if { |k, v| k == 'id' }.map { |k, v| [k, v.downcase] }.to_h
50
+ @api_version = options[:version].downcase
51
+ @app_path = options[:path]
52
+ end
53
+
54
+
55
+ def validate_target_api
56
+ unless api_version_exists?
57
+ alert "API version '#{api_version}' does not exist!"
58
+ exit
59
+ end
60
+ end
61
+
62
+
63
+ def create_resource
64
+ report("Creating new resource...") do
65
+ directory "templates/resource", "#{app_path}"
66
+ directory "templates/resource_#{app_test_framework}", "#{app_path}"
67
+
68
+ insert_into_file "#{app_path}/api/#{api_version}/base.rb",
69
+ "\s\s\s\smount API#{api_version}::#{res_name.classify.pluralize}\n",
70
+ before: "\s\s\s\s# mount API#{api_version}::<ResourceOrEndpointClass>\n"
71
+ end
72
+ end
73
+
74
+
75
+ private
76
+
77
+ def api_version_exists?
78
+ Dir.exist?("#{app_path}/api/#{api_version}")
79
+ end
80
+
81
+ def res_migration
82
+ "#{Time.now.strftime("%Y%m%d%H%M%S")}_create_#{res_name.pluralize}"
83
+ end
84
+
85
+ def res_name_plural
86
+ res_name.pluralize
87
+ end
88
+ end
89
+ end
@@ -0,0 +1,19 @@
1
+ module API<%= api_version %>
2
+ class Base < Grape::API
3
+ format :json
4
+ version '<%= api_version %>', using: :path
5
+
6
+ # mount API<%= api_version %>::<ResourceOrEndpointClass>
7
+
8
+ <% if app_swagger? -%>
9
+ add_swagger_documentation \
10
+ base_path: '/<%= app_prefix %>',
11
+ info: {
12
+ title: '<%= app_name %> <%= api_version %>',
13
+ description: '<%= app_name %> <%= api_version %> - generated with Grapethor'
14
+ }
15
+ <% end -%>
16
+
17
+ end
18
+ end
19
+
@@ -0,0 +1,12 @@
1
+ require_relative './test_case'
2
+
3
+ class API<%= api_version %>TestCase < TestCase
4
+ include Rack::Test::Methods
5
+
6
+ def app
7
+ API<%= api_version %>::Base
8
+ end
9
+ end
10
+
11
+
12
+
File without changes
@@ -0,0 +1,18 @@
1
+ FROM ruby:<%= app_ruby %>
2
+
3
+ RUN apt-get update -qq \
4
+ && apt-get install -y build-essential libpq-dev nodejs \
5
+ && gem install bundler
6
+
7
+ ENV <%= app_name.upcase %>_HOME /<%= app_name %>
8
+ RUN mkdir $<%= app_name.upcase %>_HOME
9
+ WORKDIR $<%= app_name.upcase %>_HOME
10
+
11
+ ADD Gemfile* $<%= app_name.upcase %>_HOME/
12
+ RUN bundle install
13
+
14
+ ADD . $<%= app_name.upcase %>_HOME/
15
+
16
+ EXPOSE 3000
17
+
18
+ CMD ["rackup", "--host", "0.0.0.0", "-p", "3000"]
@@ -0,0 +1,43 @@
1
+ version: '3'
2
+ services:
3
+ app:
4
+ build: .
5
+ ports:
6
+ - "9292:9292"
7
+ volumes:
8
+ - .:/<%= app_name.downcase %>
9
+ command: bundle exec rackup -p 9292 --host 0.0.0.0
10
+ depends_on:
11
+ - db
12
+
13
+ db:
14
+ <% case app_db -%>
15
+ <% when 'sqlite' -%>
16
+ image: nouchka/sqlite3:latest
17
+ stdin_open: true
18
+ tty: true
19
+ volumes:
20
+ - dbdata:/root/db/
21
+ <% when 'postgresql' -%>
22
+ image: postgres
23
+ restart: always
24
+ ports:
25
+ - "5432:5432"
26
+ volumes:
27
+ - dbdata:/var/lib/postgresql/data
28
+ <% when 'mysql' -%>
29
+ image: mysql
30
+ restart: always
31
+ command: --default-authentication-plugin=mysql_native_password
32
+ environment:
33
+ DB: <%= app_name.downcase %>_production
34
+ DB_USER: <%= app_name.downcase %>
35
+ DB_PASSWORD: <%= app_name.downcase %>
36
+ DB_HOST: db
37
+ ports:
38
+ - '3306:3306'
39
+ volumes:
40
+ - dbdata:/var/lib/mysql
41
+ <% end -%>
42
+ volumes:
43
+ dbdata:
@@ -0,0 +1,14 @@
1
+ # <%= end_method %> <%= api_version %>/<%= end_resource.pluralize %>/<%= request_path %>
2
+ desc '<%= end_desc %>'
3
+ <% unless end_query_with_params.empty? -%>
4
+ params do
5
+ <% end_query_with_params.each do |name, type| -%>
6
+ requires :<%= name %>, type: <%= param_to_type(type) %>
7
+ <% end -%>
8
+ end
9
+ <% end -%>
10
+ <%= end_method.downcase %> '<%= request_path %>' do
11
+ { status: "TODO" }
12
+ end
13
+ <% %>
14
+
@@ -0,0 +1,14 @@
1
+ module API<%= api_version %>
2
+ class <%= end_resource.classify.pluralize %> < Grape::API
3
+
4
+ # helpers do
5
+ # def grape(rator)
6
+ # # TODO: use it or remove
7
+ # end
8
+ # end
9
+
10
+
11
+ resource :<%= end_resource.pluralize %> do
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,13 @@
1
+
2
+
3
+ def test_<%= end_method.downcase %>_<%= end_resource.pluralize %>
4
+ body = {
5
+ <% end_query.each do |name, type| -%>
6
+ <%= name %>: <%= sample_value(type) %>,
7
+ <% end -%>
8
+ }
9
+ expected = { status: "TODO" }
10
+ <%= end_method.downcase %> '<%= api_version %>/<%= end_resource.pluralize %>/<%= request_path_sample %>', body, { 'Content-Type' => 'application/json' }
11
+
12
+ assert_equal expected.to_json, last_response.body
13
+ end
@@ -0,0 +1,14 @@
1
+ require_relative '../../test_helper'
2
+
3
+ class API<%= api_version %><%= end_resource.classify.pluralize %>Test < API<%= api_version %>TestCase
4
+ def setup
5
+ super
6
+ end
7
+
8
+ def teardown
9
+ super
10
+ end
11
+
12
+ ### grapethor works here ###
13
+
14
+ end
@@ -0,0 +1,11 @@
1
+
2
+
3
+ context '<%= end_method %> <%= end_resource.pluralize %>' do
4
+ let(:expected) { { status: "TODO" } }
5
+ it '<%= end_method.downcase %> <%= end_resource.pluralize %>' do
6
+ <%= end_method.downcase %> '<%= api_version %>/<%= end_resource.pluralize %>/<%= request_path_sample %>', <%= end_query_sample %>
7
+
8
+ expect(last_response.status).to eq(200)
9
+ expect(last_response.body).to eq(expected.to_json)
10
+ end
11
+ end
@@ -0,0 +1,12 @@
1
+ require_relative '../../spec_helper'
2
+
3
+ describe API<%= api_version %>::<%= end_resource.classify.pluralize %> do
4
+ include Rack::Test::Methods
5
+
6
+ def app
7
+ API<%= api_version %>::Base
8
+ end
9
+
10
+ ### grapethor works here ###
11
+
12
+ end
@@ -0,0 +1,13 @@
1
+ Copyright (c) <%= Time.now.year %> <%= app_copyright %>
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not
4
+ use this file except in compliance with the License. You may obtain a copy of
5
+ the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11
+ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
+ License for the specific language governing permissions and limitations under
13
+ the License.
@@ -0,0 +1,316 @@
1
+ Copyright (c) <%= Time.now.year %> <%= app_copyright %>
2
+
3
+ COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
4
+
5
+ 1. Definitions.
6
+
7
+ 1.1. "Contributor" means each individual or entity that creates or contributes
8
+ to the creation of Modifications.
9
+
10
+ 1.2. "Contributor Version" means the combination of the Original Software,
11
+ prior Modifications used by a Contributor (if any), and the Modifications made
12
+ by that particular Contributor.
13
+
14
+ 1.3. "Covered Software" means (a) the Original Software, or (b) Modifications,
15
+ or (c) the combination of files containing Original Software with files
16
+ containing Modifications, in each case including portions thereof.
17
+
18
+ 1.4. "Executable" means the Covered Software in any form other than Source
19
+ Code.
20
+
21
+ 1.5. "Initial Developer" means the individual or entity that first makes
22
+ Original Software available under this License.
23
+
24
+ 1.6. "Larger Work" means a work which combines Covered Software or portions
25
+ thereof with code not governed by the terms of this License.
26
+
27
+ 1.7. "License" means this document.
28
+
29
+ 1.8. "Licensable" means having the right to grant, to the maximum extent
30
+ possible, whether at the time of the initial grant or subsequently acquired,
31
+ any and all of the rights conveyed herein.
32
+
33
+ 1.9. "Modifications" means the Source Code and Executable form of any of the
34
+ following:
35
+
36
+ A. Any file that results from an addition to, deletion from or modification of
37
+ the contents of a file containing Original Software or previous Modifications;
38
+
39
+ B. Any new file that contains any part of the Original Software or previous
40
+ Modification; or
41
+
42
+ C. Any new file that is contributed or otherwise made available under the
43
+ terms of this License.
44
+
45
+ 1.10. "Original Software" means the Source Code and Executable form of
46
+ computer software code that is originally released under this License.
47
+
48
+ 1.11. "Patent Claims" means any patent claim(s), now owned or hereafter
49
+ acquired, including without limitation, method, process, and apparatus claims,
50
+ in any patent Licensable by grantor.
51
+
52
+ 1.12. "Source Code" means (a) the common form of computer software code in
53
+ which modifications are made and (b) associated documentation included in or
54
+ with such code.
55
+
56
+ 1.13. "You" (or "Your") means an individual or a legal entity exercising
57
+ rights under, and complying with all of the terms of, this License. For legal
58
+ entities, "You" includes any entity which controls, is controlled by, or is
59
+ under common control with You. For purposes of this definition, "control"
60
+ means (a) the power, direct or indirect, to cause the direction or management
61
+ of such entity, whether by contract or otherwise, or (b) ownership of more
62
+ than fifty percent (50%) of the outstanding shares or beneficial ownership of
63
+ such entity.
64
+
65
+ 2. License Grants.
66
+
67
+ 2.1. The Initial Developer Grant.
68
+
69
+ Conditioned upon Your compliance with Section 3.1 below and subject to third
70
+ party intellectual property claims, the Initial Developer hereby grants You a
71
+ world-wide, royalty-free, non-exclusive license:
72
+
73
+ (a) under intellectual property rights (other than patent or trademark)
74
+ (Licensable by Initial Developer, to use, reproduce, modify, display, perform,
75
+ (sublicense and distribute the Original Software (or portions thereof), with
76
+ (or without Modifications, and/or as part of a Larger Work; and
77
+
78
+ (b) under Patent Claims infringed by the making, using or selling of Original
79
+ (Software, to make, have made, use, practice, sell, and offer for sale, and/or
80
+ (otherwise dispose of the Original Software (or portions thereof).
81
+
82
+ (c) The licenses granted in Sections 2.1(a) and (b) are effective on the date
83
+ (Initial Developer first distributes or otherwise makes the Original Software
84
+ (available to a third party under the terms of this License.
85
+
86
+ (d) Notwithstanding Section 2.1(b) above, no patent license is granted: (1)
87
+ (for code that You delete from the Original Software, or (2) for infringements
88
+ (caused by: (i) the modification of the Original Software, or (ii) the
89
+ (combination of the Original Software with other software or devices.
90
+
91
+ 2.2. Contributor Grant.
92
+
93
+ Conditioned upon Your compliance with Section 3.1 below and subject to third
94
+ party intellectual property claims, each Contributor hereby grants You a
95
+ world-wide, royalty-free, non-exclusive license:
96
+
97
+ (a) under intellectual property rights (other than patent or trademark)
98
+ (Licensable by Contributor to use, reproduce, modify, display, perform,
99
+ (sublicense and distribute the Modifications created by such Contributor (or
100
+ (portions thereof), either on an unmodified basis, with other Modifications,
101
+ (as Covered Software and/or as part of a Larger Work; and
102
+
103
+ (b) under Patent Claims infringed by the making, using, or selling of
104
+ (Modifications made by that Contributor either alone and/or in combination
105
+ (with its Contributor Version (or portions of such combination), to make, use,
106
+ (sell, offer for sale, have made, and/or otherwise dispose of: (1)
107
+ (Modifications made by that Contributor (or portions thereof); and (2) the
108
+ (combination of Modifications made by that Contributor with its Contributor
109
+ (Version (or portions of such combination).
110
+
111
+ (c) The licenses granted in Sections 2.2(a) and 2.2(b) are effective on the
112
+ (date Contributor first distributes or otherwise makes the Modifications
113
+ (available to a third party. d) Notwithstanding Section 2.2(b) above, no
114
+ (patent license is granted: (1) for any code that Contributor has deleted from
115
+ (the Contributor Version; (2) for infringements caused by: (i) third party
116
+ (modifications of Contributor Version, or (ii) the combination of
117
+ (Modifications made by that Contributor with other software (except as part of
118
+ (the Contributor Version) or other devices; or (3) under Patent Claims
119
+ (infringed by Covered Software in the absence of Modifications made by that
120
+ (Contributor.
121
+
122
+ 3. Distribution Obligations.
123
+
124
+ 3.1. Availability of Source Code.
125
+
126
+ Any Covered Software that You distribute or otherwise make available in
127
+ Executable form must also be made available in Source Code form and that
128
+ Source Code form must be distributed only under the terms of this License. You
129
+ must include a copy of this License with every copy of the Source Code form of
130
+ the Covered Software You distribute or otherwise make available. You must
131
+ inform recipients of any such Covered Software in Executable form as to how
132
+ they can obtain such Covered Software in Source Code form in a reasonable
133
+ manner on or through a medium customarily used for software exchange.
134
+
135
+ 3.2. Modifications.
136
+
137
+ The Modifications that You create or to which You contribute are governed by
138
+ the terms of this License. You represent that You believe Your Modifications
139
+ are Your original creation(s) and/or You have sufficient rights to grant the
140
+ rights conveyed by this License.
141
+
142
+ 3.3. Required Notices.
143
+
144
+ You must include a notice in each of Your Modifications that identifies You as
145
+ the Contributor of the Modification. You may not remove or alter any
146
+ copyright, patent or trademark notices contained within the Covered Software,
147
+ or any notices of licensing or any descriptive text giving attribution to any
148
+ Contributor or the Initial Developer.
149
+
150
+ 3.4. Application of Additional Terms.
151
+
152
+ You may not offer or impose any terms on any Covered Software in Source Code
153
+ form that alters or restricts the applicable version of this License or the
154
+ recipients' rights hereunder. You may choose to offer, and to charge a fee
155
+ for, warranty, support, indemnity or liability obligations to one or more
156
+ recipients of Covered Software. However, you may do so only on Your own
157
+ behalf, and not on behalf of the Initial Developer or any Contributor. You
158
+ must make it absolutely clear that any such warranty, support, indemnity or
159
+ liability obligation is offered by You alone, and You hereby agree to
160
+ indemnify the Initial Developer and every Contributor for any liability
161
+ incurred by the Initial Developer or such Contributor as a result of warranty,
162
+ support, indemnity or liability terms You offer.
163
+
164
+ 3.5. Distribution of Executable Versions.
165
+
166
+ You may distribute the Executable form of the Covered Software under the terms
167
+ of this License or under the terms of a license of Your choice, which may
168
+ contain terms different from this License, provided that You are in compliance
169
+ with the terms of this License and that the license for the Executable form
170
+ does not attempt to limit or alter the recipient's rights in the Source Code
171
+ form from the rights set forth in this License. If You distribute the Covered
172
+ Software in Executable form under a different license, You must make it
173
+ absolutely clear that any terms which differ from this License are offered by
174
+ You alone, not by the Initial Developer or Contributor. You hereby agree to
175
+ indemnify the Initial Developer and every Contributor for any liability
176
+ incurred by the Initial Developer or such Contributor as a result of any such
177
+ terms You offer.
178
+
179
+ 3.6. Larger Works.
180
+
181
+ You may create a Larger Work by combining Covered Software with other code not
182
+ governed by the terms of this License and distribute the Larger Work as a
183
+ single product. In such a case, You must make sure the requirements of this
184
+ License are fulfilled for the Covered Software.
185
+
186
+ 4. Versions of the License.
187
+
188
+ 4.1. New Versions.
189
+
190
+ Sun Microsystems, Inc. is the initial license steward and may publish revised
191
+ and/or new versions of this License from time to time. Each version will be
192
+ given a distinguishing version number. Except as provided in Section 4.3, no
193
+ one other than the license steward has the right to modify this License.
194
+
195
+ 4.2. Effect of New Versions.
196
+
197
+ You may always continue to use, distribute or otherwise make the Covered
198
+ Software available under the terms of the version of the License under which
199
+ You originally received the Covered Software. If the Initial Developer
200
+ includes a notice in the Original Software prohibiting it from being
201
+ distributed or otherwise made available under any subsequent version of the
202
+ License, You must distribute and make the Covered Software available under the
203
+ terms of the version of the License under which You originally received the
204
+ Covered Software. Otherwise, You may also choose to use, distribute or
205
+ otherwise make the Covered Software available under the terms of any
206
+ subsequent version of the License published by the license steward.
207
+
208
+ 4.3. Modified Versions.
209
+
210
+ When You are an Initial Developer and You want to create a new license for
211
+ Your Original Software, You may create and use a modified version of this
212
+ License if You: (a) rename the license and remove any references to the name
213
+ of the license steward (except to note that the license differs from this
214
+ License); and (b) otherwise make it clear that the license contains terms
215
+ which differ from this License.
216
+
217
+ 5. DISCLAIMER OF WARRANTY.
218
+
219
+ COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT
220
+ WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT
221
+ LIMITATION, WARRANTIES THAT THE COVERED SOFTWARE IS FREE OF DEFECTS,
222
+ MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK
223
+ AS TO THE QUALITY AND PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD
224
+ ANY COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL
225
+ DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
226
+ SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN
227
+ ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED SOFTWARE IS AUTHORIZED
228
+ HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
229
+
230
+ 6. TERMINATION.
231
+
232
+ 6.1. This License and the rights granted hereunder will terminate
233
+ automatically if You fail to comply with terms herein and fail to cure such
234
+ breach within 30 days of becoming aware of the breach. Provisions which, by
235
+ their nature, must remain in effect beyond the termination of this License
236
+ shall survive.
237
+
238
+ 6.2. If You assert a patent infringement claim (excluding declaratory judgment
239
+ actions) against Initial Developer or a Contributor (the Initial Developer or
240
+ Contributor against whom You assert such claim is referred to as
241
+ "Participant") alleging that the Participant Software (meaning the Contributor
242
+ Version where the Participant is a Contributor or the Original Software where
243
+ the Participant is the Initial Developer) directly or indirectly infringes any
244
+ patent, then any and all rights granted directly or indirectly to You by such
245
+ Participant, the Initial Developer (if the Initial Developer is not the
246
+ Participant) and all Contributors under Sections 2.1 and/or 2.2 of this
247
+ License shall, upon 60 days notice from Participant terminate prospectively
248
+ and automatically at the expiration of such 60 day notice period, unless if
249
+ within such 60 day period You withdraw Your claim with respect to the
250
+ Participant Software against such Participant either unilaterally or pursuant
251
+ to a written agreement with Participant.
252
+
253
+ 6.3. In the event of termination under Sections 6.1 or 6.2 above, all end user
254
+ licenses that have been validly granted by You or any distributor hereunder
255
+ prior to termination (excluding licenses granted to You by any distributor)
256
+ shall survive termination.
257
+
258
+ 7. LIMITATION OF LIABILITY.
259
+
260
+ UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING
261
+ NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL DEVELOPER, ANY
262
+ OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED SOFTWARE, OR ANY SUPPLIER OF
263
+ ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL,
264
+ INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT
265
+ LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK STOPPAGE,
266
+ COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR
267
+ LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH
268
+ DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH
269
+ OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT
270
+ APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE
271
+ EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS
272
+ EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
273
+
274
+ 8. U.S. GOVERNMENT END USERS.
275
+
276
+ The Covered Software is a "commercial item," as that term is defined in 48
277
+ C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" (as
278
+ that term is defined at 48 C.F.R. ¤ 252.227-7014(a)(1)) and "commercial
279
+ computer software documentation" as such terms are used in 48 C.F.R. 12.212
280
+ (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1
281
+ through 227.7202-4 (June 1995), all U.S. Government End Users acquire Covered
282
+ Software with only those rights set forth herein. This U.S. Government Rights
283
+ clause is in lieu of, and supersedes, any other FAR, DFAR, or other clause or
284
+ provision that addresses Government rights in computer software under this
285
+ License.
286
+
287
+ 9. MISCELLANEOUS.
288
+
289
+ This License represents the complete agreement concerning subject matter
290
+ hereof. If any provision of this License is held to be unenforceable, such
291
+ provision shall be reformed only to the extent necessary to make it
292
+ enforceable. This License shall be governed by the law of the jurisdiction
293
+ specified in a notice contained within the Original Software (except to the
294
+ extent applicable law, if any, provides otherwise), excluding such
295
+ jurisdiction's conflict-of-law provisions. Any litigation relating to this
296
+ License shall be subject to the jurisdiction of the courts located in the
297
+ jurisdiction and venue specified in a notice contained within the Original
298
+ Software, with the losing party responsible for costs, including, without
299
+ limitation, court costs and reasonable attorneys' fees and expenses. The
300
+ application of the United Nations Convention on Contracts for the
301
+ International Sale of Goods is expressly excluded. Any law or regulation which
302
+ provides that the language of a contract shall be construed against the
303
+ drafter shall not apply to this License. You agree that You alone are
304
+ responsible for compliance with the United States export administration
305
+ regulations (and the export control laws and regulation of any other
306
+ countries) when You use, distribute or otherwise make available any Covered
307
+ Software.
308
+
309
+ 10. RESPONSIBILITY FOR CLAIMS.
310
+
311
+ As between Initial Developer and the Contributors, each party is responsible
312
+ for claims and damages arising, directly or indirectly, out of its utilization
313
+ of rights under this License and You agree to work with Initial Developer and
314
+ Contributors to distribute such responsibility on an equitable basis. Nothing
315
+ herein is intended or shall be deemed to constitute any admission of
316
+ liability.