ghp 0.0.2 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2007-2012 Denis Defreyne and contributors
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
data/README.md CHANGED
@@ -0,0 +1,11 @@
1
+ # git home page
2
+
3
+ An opinionated way to document your git projects:
4
+
5
+ - Markup: Markdown everywhere
6
+ - Hosting: generated static site hosted on a web server or local folder
7
+ - Start at the README (which is also the index.html)
8
+ - scripts have --help and man pages
9
+ - code documented with rocco, shocco
10
+ - documentation lives with code but generated site can be another git
11
+ repo/branch
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.2
1
+ 0.0.4
data/bin/ghp ADDED
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: utf-8
3
+
4
+ # taken from nanoc version 3.5.0b2
5
+
6
+ # Load nanoc
7
+ require 'nanoc'
8
+ require 'nanoc/cli'
9
+
10
+ module Nanoc
11
+ class Site
12
+ def load_code_snippets
13
+ @code_snippets_loaded ||= false
14
+ return if @code_snippets_loaded
15
+ @code_snippets_loaded = true
16
+
17
+ # Get code snippets
18
+ @code_snippets = Dir['lib/nanoc/**/*.rb'].sort.map do |filename|
19
+ Nanoc::CodeSnippet.new(
20
+ File.read(filename),
21
+ filename
22
+ )
23
+ end
24
+
25
+ # Execute code snippets
26
+ @code_snippets.each { |cs| cs.load }
27
+ end
28
+ end
29
+ end
30
+
31
+ # Run base
32
+ Nanoc::CLI.run(ARGV)
@@ -0,0 +1,21 @@
1
+ require 'redcarpet'
2
+
3
+ module Nanoc::DataSources
4
+ module Filesystem
5
+ def items
6
+ ghp_config = Nanoc::Site.new('.').config
7
+ alt_content = ghp_config[:alt_content] || "content"
8
+ alt_dir = $:.collect {|x| File.join(File.expand_path("..", x), alt_content) }.select {|x| File.directory? x }[0]
9
+ load_objects(alt_dir, 'item', Nanoc::Item)
10
+ end
11
+
12
+ def layouts
13
+ ghp_config = Nanoc::Site.new('.').config
14
+ alt_layouts = ghp_config[:alt_layouts] || "layouts"
15
+ alt_dir = $:.collect {|x| File.join(File.expand_path("..", x), alt_layouts) }.select {|x| File.directory? x }[0]
16
+ load_objects(alt_dir, 'layout', Nanoc::Layout)
17
+ end
18
+ end
19
+ end
20
+
21
+ include Nanoc3::Helpers::Rendering
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ghp
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 4
10
+ version: 0.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - David Nghiem
@@ -18,36 +18,68 @@ cert_chain: []
18
18
 
19
19
  date: 2013-01-26 00:00:00 -08:00
20
20
  default_executable:
21
- dependencies: []
22
-
21
+ dependencies:
22
+ - !ruby/object:Gem::Dependency
23
+ name: nanoc
24
+ prerelease: false
25
+ requirement: &id001 !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ">="
29
+ - !ruby/object:Gem::Version
30
+ hash: 3
31
+ segments:
32
+ - 0
33
+ version: "0"
34
+ type: :runtime
35
+ version_requirements: *id001
36
+ - !ruby/object:Gem::Dependency
37
+ name: redcarpet
38
+ prerelease: false
39
+ requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ hash: 3
45
+ segments:
46
+ - 0
47
+ version: "0"
48
+ type: :runtime
49
+ version_requirements: *id002
50
+ - !ruby/object:Gem::Dependency
51
+ name: sass
52
+ prerelease: false
53
+ requirement: &id003 !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ hash: 3
59
+ segments:
60
+ - 0
61
+ version: "0"
62
+ type: :runtime
63
+ version_requirements: *id003
23
64
  description: git home page
24
65
  email:
25
66
  - nghidav@gmail.com
26
67
  - amanibhavam@destructuring.org
27
- executables: []
28
-
68
+ executables:
69
+ - ghp
29
70
  extensions: []
30
71
 
31
72
  extra_rdoc_files: []
32
73
 
33
74
  files:
34
75
  - LICENSE
76
+ - LICENSE.nanoc
35
77
  - VERSION
36
78
  - README.md
37
- - libexec/_bump
38
- - libexec/_jason
39
- - libexec/_log4sh
40
- - libexec/_shflags
41
- - libexec/_sub
42
- - libexec/build
43
- - libexec/build-gem
44
- - libexec/bump
45
- - libexec/edit-gem
46
- - libexec/publish
47
- - libexec/publish-gem
48
79
  - lib/development.rb
49
80
  - lib/ghp/version.rb
50
- - lib/helpers.rb
81
+ - lib/nanoc/helpers.rb
82
+ - bin/ghp
51
83
  has_rdoc: true
52
84
  homepage: https://github.com/destructuring/ghp
53
85
  licenses: []
@@ -1,3 +0,0 @@
1
- require 'redcarpet'
2
-
3
- include Nanoc3::Helpers::Rendering
@@ -1,118 +0,0 @@
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
- }
@@ -1,165 +0,0 @@
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