codestrap 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (150) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +20 -0
  3. data/.travis.yml +4 -0
  4. data/.yardopts +3 -0
  5. data/BOILERPLATE.md +151 -0
  6. data/CODESTRAPFILE.md +28 -0
  7. data/Gemfile +6 -0
  8. data/LICENSE.txt +13 -0
  9. data/README.md +69 -0
  10. data/Rakefile +51 -0
  11. data/bin/strap +8 -0
  12. data/bin/upstrap +8 -0
  13. data/codestrap.gemspec +37 -0
  14. data/config/projects/codestrap.rb +22 -0
  15. data/config/software/codestrap.rb +20 -0
  16. data/config/software/ruby.rb +247 -0
  17. data/config/software/zlib.rb +86 -0
  18. data/features/client.feature +99 -0
  19. data/features/fixtures/client/home/codestrap/bin/.empty +0 -0
  20. data/features/fixtures/client/home/codestrap/content/bash.erb +3 -0
  21. data/features/fixtures/client/home/codestrap/content/gem/dir/file +0 -0
  22. data/features/fixtures/client/home/codestrap/content/gem/dir/template +3 -0
  23. data/features/fixtures/client/home/codestrap/content/gem/file +1 -0
  24. data/features/fixtures/client/home/codestrap/content/gem/template +3 -0
  25. data/features/fixtures/client/home/codestrap/content/local_remote.erb +1 -0
  26. data/features/fixtures/client/home/codestrap/content/local_remote/dir/file +0 -0
  27. data/features/fixtures/client/home/codestrap/content/local_remote/dir/template +3 -0
  28. data/features/fixtures/client/home/codestrap/content/local_remote/file +1 -0
  29. data/features/fixtures/client/home/codestrap/content/local_remote/template +3 -0
  30. data/features/fixtures/client/home/codestrap/objects/local.json +3 -0
  31. data/features/fixtures/client/output/.empty +0 -0
  32. data/features/fixtures/client/var/lib/codestrap/bin/.empty +0 -0
  33. data/features/fixtures/client/var/lib/codestrap/content/bashremote.erb +3 -0
  34. data/features/fixtures/client/var/lib/codestrap/content/gemremote/dir/file +0 -0
  35. data/features/fixtures/client/var/lib/codestrap/content/gemremote/dir/template +3 -0
  36. data/features/fixtures/client/var/lib/codestrap/content/gemremote/file +0 -0
  37. data/features/fixtures/client/var/lib/codestrap/content/gemremote/template +3 -0
  38. data/features/fixtures/client/var/lib/codestrap/content/remote_local.erb +1 -0
  39. data/features/fixtures/client/var/lib/codestrap/content/remote_local/dir/file +0 -0
  40. data/features/fixtures/client/var/lib/codestrap/content/remote_local/dir/template +3 -0
  41. data/features/fixtures/client/var/lib/codestrap/content/remote_local/file +1 -0
  42. data/features/fixtures/client/var/lib/codestrap/content/remote_local/template +3 -0
  43. data/features/fixtures/client/var/lib/codestrap/content/remote_remote.erb +1 -0
  44. data/features/fixtures/client/var/lib/codestrap/content/remote_remote/dir/file +0 -0
  45. data/features/fixtures/client/var/lib/codestrap/content/remote_remote/dir/template +3 -0
  46. data/features/fixtures/client/var/lib/codestrap/content/remote_remote/file +0 -0
  47. data/features/fixtures/client/var/lib/codestrap/content/remote_remote/template +3 -0
  48. data/features/fixtures/client/var/lib/codestrap/objects/remote.json +3 -0
  49. data/features/fixtures/logging/home/logging/codestrap/bin/stubdirectory/.empty +0 -0
  50. data/features/fixtures/logging/home/logging/codestrap/bin/stubnotlink +0 -0
  51. data/features/fixtures/logging/home/logging/codestrap/content/.empty +0 -0
  52. data/features/fixtures/logging/home/logging/codestrap/objects/.empty +0 -0
  53. data/features/fixtures/server/mixed/var/lib/stub/content/address.erb +3 -0
  54. data/features/fixtures/server/mixed/var/lib/stub/content/cell.erb +3 -0
  55. data/features/fixtures/server/mixed/var/lib/stub/content/email.erb +3 -0
  56. data/features/fixtures/server/mixed/var/lib/stub/content/mobile.erb +3 -0
  57. data/features/fixtures/server/mixed/var/lib/stub/content/name.erb +3 -0
  58. data/features/fixtures/server/mixed/var/lib/stub/content/phone.erb +3 -0
  59. data/features/fixtures/server/mixed/var/lib/stub/content/puppetmodule/Modulefile +12 -0
  60. data/features/fixtures/server/mixed/var/lib/stub/content/puppetmodule/README +17 -0
  61. data/features/fixtures/server/mixed/var/lib/stub/content/puppetmodule/manifests/init.pp +42 -0
  62. data/features/fixtures/server/mixed/var/lib/stub/content/puppetmodule/spec/spec_helper.rb +18 -0
  63. data/features/fixtures/server/mixed/var/lib/stub/content/puppetmodule/tests/init.pp +13 -0
  64. data/features/fixtures/server/mixed/var/lib/stub/objects/contact.json +8 -0
  65. data/features/fixtures/server/mixed/var/lib/stub/objects/shadow/contact.json +8 -0
  66. data/features/fixtures/strap/projects/etc/.empty +0 -0
  67. data/features/fixtures/strap/projects/home/user/dir/bin/.empty +0 -0
  68. data/features/fixtures/strap/projects/home/user/dir/content/puppetmodule/Modulefile +12 -0
  69. data/features/fixtures/strap/projects/home/user/dir/content/puppetmodule/README +17 -0
  70. data/features/fixtures/strap/projects/home/user/dir/content/puppetmodule/manifests/:stub:project.name:/subclass.pp +3 -0
  71. data/features/fixtures/strap/projects/home/user/dir/content/puppetmodule/manifests/init.pp +42 -0
  72. data/features/fixtures/strap/projects/home/user/dir/content/puppetmodule/spec/spec_helper.rb +18 -0
  73. data/features/fixtures/strap/projects/home/user/dir/content/puppetmodule/tests/init.pp +13 -0
  74. data/features/fixtures/strap/projects/home/user/dir/objects/contact.json +8 -0
  75. data/features/fixtures/strap/projects/home/user/dir/objects/shadow/contact.json +8 -0
  76. data/features/fixtures/strap/projects/output/.empty +0 -0
  77. data/features/fixtures/stub/contact/etc/.empty +0 -0
  78. data/features/fixtures/stub/contact/home/user/dir/bin/.empty +0 -0
  79. data/features/fixtures/stub/contact/home/user/dir/content/address.erb +3 -0
  80. data/features/fixtures/stub/contact/home/user/dir/content/cell.erb +3 -0
  81. data/features/fixtures/stub/contact/home/user/dir/content/email.erb +3 -0
  82. data/features/fixtures/stub/contact/home/user/dir/content/mobile.erb +3 -0
  83. data/features/fixtures/stub/contact/home/user/dir/content/name.erb +3 -0
  84. data/features/fixtures/stub/contact/home/user/dir/content/phone.erb +3 -0
  85. data/features/fixtures/stub/contact/home/user/dir/objects/contact.json +8 -0
  86. data/features/fixtures/stub/contact/home/user/dir/objects/shadow/contact.json +8 -0
  87. data/features/fixtures/stub/contact/output/.empty +0 -0
  88. data/features/fixtures/stub/date/etc/.empty +0 -0
  89. data/features/fixtures/stub/date/home/user/stub/bin/.empty +0 -0
  90. data/features/fixtures/stub/date/home/user/stub/content/day.erb +3 -0
  91. data/features/fixtures/stub/date/home/user/stub/content/hour.erb +3 -0
  92. data/features/fixtures/stub/date/home/user/stub/content/minute.erb +3 -0
  93. data/features/fixtures/stub/date/home/user/stub/content/month.erb +3 -0
  94. data/features/fixtures/stub/date/home/user/stub/content/second.erb +3 -0
  95. data/features/fixtures/stub/date/home/user/stub/content/year.erb +3 -0
  96. data/features/fixtures/stub/date/home/user/stub/objects/.empty +0 -0
  97. data/features/fixtures/stub/date/output/.empty +0 -0
  98. data/features/fixtures/stub/script/etc/.empty +0 -0
  99. data/features/fixtures/stub/script/home/user/stub/bin/.empty +0 -0
  100. data/features/fixtures/stub/script/home/user/stub/content/credentials.erb +6 -0
  101. data/features/fixtures/stub/script/home/user/stub/objects/credentials.rb +11 -0
  102. data/features/fixtures/stub/script/output/.empty +0 -0
  103. data/features/logging.feature +39 -0
  104. data/features/object_scripts.feature +13 -0
  105. data/features/server.feature +36 -0
  106. data/features/step_definitions/client_steps.rb +99 -0
  107. data/features/step_definitions/logging_steps.rb +65 -0
  108. data/features/step_definitions/object_scripts_steps.rb +26 -0
  109. data/features/step_definitions/server_steps.rb +112 -0
  110. data/features/step_definitions/strap_steps.rb +69 -0
  111. data/features/step_definitions/stub_option_simple_steps.rb +31 -0
  112. data/features/step_definitions/stub_steps.rb +94 -0
  113. data/features/strap.feature +34 -0
  114. data/features/stub.feature +157 -0
  115. data/features/stub_option_simple.feature +14 -0
  116. data/features/stub_packages.feature +15 -0
  117. data/features/support/env.rb +197 -0
  118. data/lib/codestrap.rb +415 -0
  119. data/lib/codestrap/cli.rb +76 -0
  120. data/lib/codestrap/client.rb +179 -0
  121. data/lib/codestrap/config.rb +199 -0
  122. data/lib/codestrap/log.rb +56 -0
  123. data/lib/codestrap/mixin.rb +20 -0
  124. data/lib/codestrap/namespace.rb +19 -0
  125. data/lib/codestrap/object/abstract.rb +33 -0
  126. data/lib/codestrap/object/factory.rb +86 -0
  127. data/lib/codestrap/object/standard/datetime.rb +24 -0
  128. data/lib/codestrap/object/standard/files.rb +40 -0
  129. data/lib/codestrap/object/standard/project.rb +33 -0
  130. data/lib/codestrap/object/standard/rest.rb +30 -0
  131. data/lib/codestrap/patch.rb +122 -0
  132. data/lib/codestrap/server/rest.rb +177 -0
  133. data/lib/codestrap/server/version.rb +5 -0
  134. data/lib/codestrap/strap/abstract.rb +135 -0
  135. data/lib/codestrap/strap/factory.rb +85 -0
  136. data/lib/codestrap/strap/standard.rb +95 -0
  137. data/lib/codestrap/stub/abstract.rb +156 -0
  138. data/lib/codestrap/stub/factory.rb +87 -0
  139. data/lib/codestrap/stub/standard.rb +23 -0
  140. data/lib/codestrap/version.rb +3 -0
  141. data/omnibus.rb +53 -0
  142. data/package-scripts/codestrap/postinst +25 -0
  143. data/package-scripts/codestrap/postrm +17 -0
  144. data/package-scripts/codestrap/preinst +7 -0
  145. data/package-scripts/codestrap/prerm +15 -0
  146. data/resources/codestrap/pkg/background.png +0 -0
  147. data/resources/codestrap/pkg/distribution.xml.erb +22 -0
  148. data/resources/codestrap/pkg/license.html.erb +202 -0
  149. data/resources/codestrap/pkg/welcome.html.erb +7 -0
  150. metadata +466 -0
@@ -0,0 +1,87 @@
1
+ require 'codestrap/mixin'
2
+
3
+ module Codestrap
4
+ module Stub
5
+ # Factory for instantiating classes from the Codestrap::Stub namespace
6
+ class Factory
7
+ include Codestrap::Mixin::Exceptions::Factory
8
+
9
+ attr_reader :klass
10
+
11
+ # Factory constructor for Codestrap::Stub::* Classes
12
+ #
13
+ # @param nklass [Symbol|String]
14
+ # @return [Codestrap::Stub::Factory]
15
+ def initialize(nklass)
16
+ self.klass = nklass
17
+ enforce_methods
18
+ ensure_required
19
+ end
20
+
21
+ # Constructor for Codestrap::Stub::* Classes
22
+ #
23
+ # @param [Array] args
24
+ # Arguments to pass to constructor of child object
25
+ # @raise [FactoryNotImplemented]
26
+ # Raised when Class Codestrap::Stub::KLASS doesn't exist
27
+ # @return [Object]
28
+ # Return the object as specified Factory#klass.new(args)
29
+ def construct(*args)
30
+ self.klass.new(args)
31
+ end
32
+
33
+ # Dynamic Class creation.
34
+ # Looks for Classes in Codestrap::Stub::NKLASS
35
+ #
36
+ # @param [String|Symbol] nklass
37
+ # Look for Codestrap::Stub::nklass
38
+ # @raise [FactoryArgumentError]
39
+ # Raised if nklass is not type String or type Symbol
40
+ # @return [Codestrap::Stub::KLASS]
41
+ # Return class Codestrap::Stub::KLASS
42
+ def to_class nklass
43
+ case
44
+ when nklass.is_a?(Symbol)
45
+ klass = nklass.to_s
46
+ when nklass.is_a?(String)
47
+ klass = nklass
48
+ else
49
+ raise FactoryNotImplemented, %Q(Could not find Class Codestrap::Stub::#{nklass.to_s})
50
+ end
51
+ @klass = ['Codestrap', 'Stub', klass ].reduce(Module, :const_get)
52
+ @klass
53
+ end
54
+
55
+ alias :klass= :to_class
56
+
57
+ # Ensure self.klass has the following methods
58
+ #
59
+ # klass.pre
60
+ # klass.execute
61
+ #
62
+ # Inherited from Codestrap::Stub::Factory
63
+ # klass.file
64
+ # klass.finalize
65
+ #
66
+ # @raise [FactoryMethodEnforcement]
67
+ # Raised if a enforced method doesn't exist in the child
68
+ # @return [TrueClass, FalseClass]
69
+ def enforce_methods
70
+ [:pre, :execute, :overwrite, :overwrite=, :file, :to_disk].each do |method|
71
+ next if @klass.method_defined? method
72
+ raise FactoryException, "Error missing method #{@klass.to_s}##{method}"
73
+ end
74
+ end
75
+
76
+ # Ensures any methods aliased to abstract_method are overridden
77
+ # @raise [FactoryAbstractMethod]
78
+ # Raised if a abstract method (A method aliased to abstract_method), is not created in the child
79
+ def ensure_required
80
+ if @klass.abstract_methods.length > 0
81
+ methods = @klass.abstract_methods.map{ |method| "#{@klass.to_s}##{method}" }
82
+ raise FactoryAbstractMethod, "Abstract Method(s) #{methods.join(', ')} not overridden"
83
+ end
84
+ end
85
+ end
86
+ end
87
+ end
@@ -0,0 +1,23 @@
1
+ require 'erb'
2
+
3
+ module Codestrap
4
+ module Stub
5
+ # Standard file (erb) render
6
+ class Standard < Abstract
7
+
8
+ def initialize(*args)
9
+ end
10
+
11
+ def pre
12
+ @erb = ERB.new(File.read(self.src))
13
+ @erb.filename = self.src
14
+ end
15
+
16
+ def execute
17
+ ns = Codestrap::Namespace.new(@objects.objects)
18
+ file.write @erb.result(ns.get_binding)
19
+ file.close
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,3 @@
1
+ module Codestrap
2
+ VERSION = '0.1.0'
3
+ end
data/omnibus.rb ADDED
@@ -0,0 +1,53 @@
1
+ #
2
+ # This file is used to configure the codestrap project. It contains
3
+ # some minimal configuration examples for working with Omnibus. For a full list
4
+ # of configurable options, please see the documentation for +omnibus/config.rb+.
5
+ #
6
+
7
+ # Build internally
8
+ # ------------------------------
9
+ # By default, Omnibus uses system folders (like +/var+ and +/opt+) to build and
10
+ # cache components. If you would to build everything internally, you can
11
+ # uncomment the following options. This will prevent the need for root
12
+ # permissions in most cases.
13
+ #
14
+ # Uncomment this line to change the default base directory to "local"
15
+ # -------------------------------------------------------------------
16
+ # base_dir './local'
17
+ #
18
+ # Alternatively you can tune the individual values
19
+ # ------------------------------------------------
20
+ # cache_dir './local/omnibus/cache'
21
+ # git_cache_dir './local/omnibus/cache/git_cache'
22
+ # source_dir './local/omnibus/src'
23
+ # build_dir './local/omnibus/build'
24
+ # package_dir './local/omnibus/pkg'
25
+ # package_tmp './local/omnibus/pkg-tmp'
26
+
27
+ # Disable git caching
28
+ # ------------------------------
29
+ # use_git_caching false
30
+
31
+ # Enable S3 asset caching
32
+ # ------------------------------
33
+ # use_s3_caching true
34
+ # s3_access_key ENV['AWS_ACCESS_KEY_ID']
35
+ # s3_secret_key ENV['AWS_SECRET_ACCESS_KEY']
36
+ # s3_bucket ENV['AWS_S3_BUCKET']
37
+
38
+ # Customize compiler bits
39
+ # ------------------------------
40
+ # solaris_compiler 'gcc'
41
+ # build_retries 5
42
+ # fetcher_read_timeout 120
43
+ # fetcher_retries 5
44
+
45
+ # Load additional software
46
+ # ------------------------------
47
+ # software_gems ['omnibus-software', 'my-company-software']
48
+ # local_software_dirs ['/path/to/local/software']
49
+
50
+ # Windows architecture defaults
51
+ # ------------------------------
52
+ windows_arch %w{x86 x64}.include?((ENV['OMNIBUS_WINDOWS_ARCH'] || '').downcase) ?
53
+ ENV['OMNIBUS_WINDOWS_ARCH'].downcase.to_sym : :x86
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env bash
2
+ #
3
+ # Perform necessary codestrap setup steps
4
+ # after package is installed.
5
+ #
6
+
7
+ PROGNAME=`basename $0`
8
+
9
+ error_exit()
10
+ {
11
+ echo "${PROGNAME}: ${1:-"Unknown Error"}" 1>&2
12
+ exit 1
13
+ }
14
+
15
+ if [ ! -d /usr/local/bin ]; then
16
+ mkdir -p /usr/local/bin
17
+ fi
18
+
19
+ # Create the symlink so that codestrap is available in PATH
20
+ ln -Fs $2/bin/strap /usr/local/bin/strap
21
+ #ln -Fs $2/bin/upstrap /usr/local/bin/upstrap
22
+
23
+ echo "Thank you for installing codestrap!"
24
+
25
+ exit 0
@@ -0,0 +1,17 @@
1
+ #!/bin/sh
2
+ #
3
+ # Perform necessary codestrap removal steps
4
+ # after package is uninstalled.
5
+ #
6
+
7
+ for link in strap upstrap
8
+ do
9
+ if [ -f /usr/local/bin/${link} ]
10
+ then
11
+ unlink /usr/local/bin/${link}
12
+ fi
13
+ done
14
+
15
+ echo "codestrap has been uninstalled!"
16
+
17
+ exit 0
@@ -0,0 +1,7 @@
1
+ #!/bin/sh
2
+ #
3
+ # Perform necessary codestrap setup steps
4
+ # before package is installed.
5
+ #
6
+
7
+ echo "You're about to install codestrap!"
@@ -0,0 +1,15 @@
1
+ #!/bin/sh
2
+ #
3
+ # Perform necessary codestrap setup steps
4
+ # prior to installing package.
5
+ #
6
+
7
+ PROGNAME=`basename $0`
8
+
9
+ error_exit()
10
+ {
11
+ echo "${PROGNAME}: ${1:-"Unknown Error"}" 1>&2
12
+ exit 1
13
+ }
14
+
15
+ exit 0
@@ -0,0 +1,22 @@
1
+ <?xml version="1.0" standalone="no"?>
2
+ <installer-gui-script minSpecVersion="1">
3
+ <title><%= friendly_name %></title>
4
+ <background file="background.png" alignment="bottomleft" mime-type="image/png"/>
5
+ <welcome file="welcome.html" mime-type="text/html"/>
6
+ <license file="license.html" mime-type="text/html"/>
7
+
8
+ <!-- Generated by productbuild - - synthesize -->
9
+ <pkg-ref id="<%= identifier %>"/>
10
+ <options customize="never" require-scripts="false"/>
11
+ <choices-outline>
12
+ <line choice="default">
13
+ <line choice="<%= identifier %>"/>
14
+ </line>
15
+ </choices-outline>
16
+ <choice id="default"/>
17
+ <choice id="<%= identifier %>" visible="false">
18
+ <pkg-ref id="<%= identifier %>"/>
19
+ </choice>
20
+ <pkg-ref id="<%= identifier %>" version="<%= version %>" onConclusion="none"><%= component_pkg %></pkg-ref>
21
+ <domains enable_anywhere="false" enable_currentUserHome="false" enable_localSystem="true" />
22
+ </installer-gui-script>
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2014 <%= maintainer %>
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.