ghp 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
File without changes
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.2
@@ -0,0 +1,25 @@
1
+ module Bundler
2
+ class Dsl
3
+ unless $gex
4
+ alias :gex :gem
5
+ $gex = true
6
+ end
7
+
8
+ def gem(nm_gem, opt_gem = {})
9
+ shome = File.expand_path('../..', __FILE__)
10
+ gem_info = File.join(shome, ".local", nm_gem)
11
+ if File.exists? gem_info
12
+ source "http://localhost:9292"
13
+ local_opt = { :path => File.read(gem_info).strip }
14
+
15
+ unless local_opt[:path].empty?
16
+ gex nm_gem, local_opt
17
+ else
18
+ gex nm_gem, opt_gem.clone
19
+ end
20
+ else
21
+ gex nm_gem, opt_gem.clone
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,3 @@
1
+ module GHP
2
+ Version = File.read(File.expand_path('../../../VERSION', __FILE__)).strip
3
+ end
@@ -0,0 +1,3 @@
1
+ require 'redcarpet'
2
+
3
+ include Nanoc3::Helpers::Rendering
@@ -0,0 +1,118 @@
1
+ #!/bin/bash
2
+
3
+ function bump_version {
4
+ local dirty="$1"; shift
5
+
6
+ if [[ "$dirty" = "$FLAGS_FALSE" ]]; then
7
+ ensure_clean_git_status
8
+ fi
9
+
10
+ local_file=
11
+ if [[ -f VERSION || -L VERSION ]]; then
12
+ local_file=1
13
+ if [[ ! -e VERSION ]]; then
14
+ logger_fatal "cannot write to VERSION file"
15
+ exit 1
16
+ fi
17
+ fi
18
+
19
+ tmp_version=$(mktemp -t XXXXXXXXX)
20
+ if [[ -n $local_file ]]; then
21
+ cat VERSION | perl -ne 'm{^\s*v?(\d+)\.(\d+)\.(\d+)\s*$} && printf("%03d.%03d.%03d %d.%d.%d\n",$1,$2,$3,$1,$2,$3)' | sort -r | head -1 | awk '{print $2}' > $tmp_version
22
+ else
23
+ git tag | perl -ne 'm{^v(\d+)\.(\d+)\.(\d+)$} && printf("%03d.%03d.%03d %d.%d.%d\n",$1,$2,$3,$1,$2,$3)' | sort -r | head -1 | awk '{print $2}' > $tmp_version
24
+ fi
25
+
26
+ if [[ ! -s "$tmp_version" ]]; then
27
+ logger_fatal "need at least one git tag (in the form v0.0.0) or a version in file VERSION (in the form 0.0.0)"
28
+ exit 1
29
+ fi
30
+
31
+ case "$1" in
32
+ patch|minor|major)
33
+ bump=$1; shift
34
+ set -- $(cat $tmp_version | sed 's#\.# #g')
35
+ case "$bump" in
36
+ patch)
37
+ echo "$1.$2.$(($3 + 1))"
38
+ ;;
39
+ minor)
40
+ echo "$1.$(($2 + 1)).0"
41
+ ;;
42
+ major)
43
+ echo "$(($1 + 1)).0.0"
44
+ ;;
45
+ esac > $tmp_version
46
+ ;;
47
+ *)
48
+ ver_new=$1; shift
49
+ ver_new=${ver_new#v}
50
+ echo $ver_new > $tmp_version
51
+ ;;
52
+ esac
53
+
54
+ ver_new=$(cat $tmp_version)
55
+ set -- $(echo "$ver_new" | sed 's#\.# #g') 0
56
+ M=$1; shift
57
+ m=$1; shift
58
+ p=$1; shift
59
+
60
+ (echo "$(($M+0)).$(($m+0)).$(($p+0))" > $tmp_version) 2>&-
61
+ ver_new_same=$(cat $tmp_version)
62
+
63
+ if [[ $ver_new != $ver_new_same ]]; then
64
+ logger_fatal "invalid version: $ver_new"
65
+ exit 1
66
+ fi
67
+
68
+ ver_bumped="v$(cat $tmp_version)"
69
+ rm -f $tmp_version
70
+ ensure_git_tag_available $ver_bumped
71
+
72
+ if [[ -n $local_file ]]; then
73
+ echo ${ver_bumped#v} > VERSION
74
+ git add VERSION
75
+ if [[ -f Gemfile ]]; then
76
+ bundle check 2>&1 >/dev/null || { bundle --quiet install --local --path vendor/bundle || bundle check > /dev/null; }
77
+ git add Gemfile.lock
78
+ fi
79
+
80
+ git commit -m "bump: $ver_bumped"
81
+ fi
82
+
83
+ git_tag "$ver_bumped"
84
+ echo $ver_bumped
85
+ }
86
+
87
+ function ensure_git_tag_available {
88
+ version=$1; shift
89
+ git fetch --tags
90
+ remote_sha=$(git ls-remote origin $version | awk '{print $1}')
91
+ if [[ -n $remote_sha ]]; then
92
+ logger_fatal "already a remote tag $version, bump again"
93
+ exit 1
94
+ fi
95
+
96
+ local_sha=$(git show-ref $version | awk '{print $1}')
97
+ if [[ -n $local_sha ]]; then
98
+ logger_fatal "already a local tag $version"
99
+ exit 1
100
+ fi
101
+ }
102
+
103
+ function git_tag {
104
+ local version=$1; shift
105
+
106
+ ensure_git_tag_available "$version"
107
+
108
+ git tag $version
109
+ }
110
+
111
+ function ensure_clean_git_status {
112
+ local lines=$(git status -s -uno | wc -l | awk '{print $1}')
113
+ if [[ $lines != "0" ]]; then
114
+ logger_fatal "git status is not clean, cannot tag"
115
+ git status -s -uno
116
+ exit 1
117
+ fi
118
+ }
@@ -0,0 +1,165 @@
1
+ #!/bin/bash
2
+
3
+ : ${__meat__:=x}
4
+ if [[ "$__meat__" != 'x' ]]; then
5
+ return 0
6
+ fi
7
+ __meat__='y'
8
+
9
+ if [[ -z "${shome:-}" ]]; then
10
+ shome="$(cd -P -- "$(dirname -- "${BASH_SOURCE}")/.." && pwd -P)"
11
+ fi
12
+
13
+ function get_started {
14
+ # if getting-started bootstrap is detected, put this in the path
15
+ # mainly useful for getopt on os x
16
+ if [[ -d "$HOME/.getting-started/bootstrap" ]]; then
17
+ PATH="$HOME/.getting-started/bootstrap:$PATH"
18
+ hash -r
19
+ fi
20
+ }
21
+
22
+ function check_help {
23
+ # taken from shocco
24
+ if expr -- "$*" : ".*--help" >/dev/null; then
25
+ display_help
26
+ exit 0
27
+ fi
28
+ }
29
+
30
+ function display_help {
31
+ flags_help
32
+ echo
33
+
34
+ # taken from shocco
35
+ grep '^#/' <"$shome/$(basename $(dirname -- "$0"))/$(basename -- "$0")" | cut -c4-
36
+ }
37
+
38
+ # Exits the script with the last error code. Servers as a marker in $0 to
39
+ # begin ronn documentation until end of file.
40
+ function __MAN__ {
41
+ exit "$!"
42
+ }
43
+
44
+ # Extracts ronn-style Markdown after __MAN__ to stdout. If a line is "MAN", it
45
+ # is assumed that a here document is used (for syntactical reasons).
46
+ #
47
+ # A limitation of detecting "MAN" will truncate the Markdown if "MAN" is a
48
+ # legimate text.
49
+ #
50
+ # __MAN__ << "MAN"
51
+ # raw ronn-style Markdown
52
+ # MAN
53
+ function display_man {
54
+ awk '/^__MAN__/,/^MAN$/ {print}' <"$0" | tail -n +2 | egrep -v '^MAN$'
55
+ }
56
+
57
+ function display_synopsis {
58
+ awk '/^#/ && !/^#!/ { print } /^[^#]/ || /^$/ { exit }' <"$0" | cut -c3-
59
+ }
60
+
61
+ function which_library {
62
+ local library="$1"; shift
63
+ if [[ -r "$shome/bin/_$library" ]]; then
64
+ echo "$shome/bin/_$library"
65
+ elif [[ -r "$shome/libexec/_$library" ]]; then
66
+ echo "$shome/libexec/_$library"
67
+ elif [[ -r "$shome/.$library/bin/_profile" ]]; then
68
+ echo "$shome/.$library/bin/_profile"
69
+ elif [[ -r "$shome/.$library/libexec/_profile" ]]; then
70
+ echo "$shome/.$library/libexec/_profile"
71
+ elif [[ -r "$shome/.$library/.profile" ]]; then
72
+ echo "$shome/.$library/.profile"
73
+ else
74
+ local nm_library="${library%%/*}"
75
+ if [[ "$nm_library" != "$library" ]]; then
76
+ local nm_right="${library##*/}"
77
+ if [[ -r "$shome/.$nm_library/bin/_$nm_right" ]]; then
78
+ echo "$shome/.$nm_library/bin/_$nm_right"
79
+ elif [[ -r "$shome/.$nm_library/libexec/_$nm_right" ]]; then
80
+ echo "$shome/.$nm_library/libexec/_$nm_right"
81
+ fi
82
+ fi
83
+ fi
84
+ }
85
+
86
+ function require {
87
+ local nm_library="$1"; shift
88
+ local pth_lib="$(which_library "$nm_library")"
89
+ if [[ -r "$pth_lib" ]]; then
90
+ if [[ "$#" == 0 ]]; then
91
+ set --
92
+ fi
93
+ source "$pth_lib" "$@"
94
+ fi
95
+ }
96
+
97
+ function parse_command_line {
98
+ if [[ "$FLAGS_SUB" = "$FLAGS_TRUE" && "$@" > 0 ]]; then
99
+ export POSIXLY_CORRECT=1
100
+ fi
101
+
102
+ if ! FLAGS "$@"; then
103
+ unset POSIXLY_CORRECT
104
+ if [[ "$flags_error" = "help requested" ]]; then
105
+ echo ""
106
+ display_help
107
+ exit 0
108
+ fi
109
+
110
+ return 4
111
+ fi
112
+
113
+ unset POSIXLY_CORRECT
114
+ return 0
115
+ }
116
+
117
+ function configure_logging {
118
+ # load log4sh (disabling properties file warning) and clear the default
119
+ # configuration
120
+ LOG4SH_CONFIGURATION='none' require 'log4sh'
121
+ log4sh_resetConfiguration
122
+
123
+ # set the global logging level to INFO
124
+ logger_setLevel INFO
125
+
126
+ # add and configure a FileAppender that outputs to STDERR, and activate the
127
+ # configuration
128
+ logger_addAppender stderr
129
+ appender_setType stderr FileAppender
130
+ appender_file_setFile stderr STDERR
131
+ appender_activateOptions stderr
132
+ }
133
+
134
+ function ryaml {
135
+ ruby -ryaml -e 'def ps x; unless x.nil?; puts (x.class == String || x.class == Fixnum) ? x : x.to_yaml; end; end; ps ARGV[1..-1].inject(YAML.load(File.read(ARGV[0]))) {|acc, key| acc[acc.class == Array ? key.to_i : key] }' "$@" 2>&-
136
+ }
137
+
138
+ function random_str {
139
+ echo "$(date +%s).$$.$RANDOM"
140
+ }
141
+
142
+ function runmany {
143
+ local cpu="$1"; shift
144
+ local args="$1"; shift
145
+ if [[ "$#" = 0 ]]; then
146
+ cat
147
+ else
148
+ echo "$@"
149
+ fi | xargs -P $cpu -n $args -- bash -c "$*" ""
150
+ }
151
+
152
+ function _main {
153
+ if [[ -z "$shome" ]]; then
154
+ shome="$(cd -P -- "$(dirname -- "${BASH_SOURCE}")/.." && pwd -P)"
155
+ fi
156
+
157
+ require 'shflags'
158
+
159
+ configure_logging
160
+
161
+ PATH="$shome/bin:$PATH"
162
+ }
163
+
164
+ _main "$@"
165
+ set -fue