ghp 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,59 @@
1
+ #!/bin/bash
2
+
3
+ if [[ "${BASH_SOURCE##*/}" != "_sub" ]]; then
4
+ shome="$(cd -P -- "$(dirname -- "$BASH_SOURCE")/.." && pwd -P)"
5
+ source "$shome/libexec/_jason"
6
+ set -- "$BASH_SOURCE" "$@"
7
+ fi
8
+
9
+ if [[ "$(type -t main)" != "function" ]]; then
10
+ function main {
11
+ if [[ "$#" > 0 ]]; then
12
+ logger_fatal "Command $sub_base $1 not implemented"
13
+ else
14
+ logger_fatal "Command $sub_base not implemented"
15
+ fi
16
+ exit 1
17
+ }
18
+ fi
19
+
20
+ function sub {
21
+ local bsource="$1"; shift
22
+ local sub_base="$(basename "$bsource")"
23
+ local bsource_cmd="$shome/libexec/${sub_base}"
24
+
25
+ if [[ "$bsource_cmd" = "$bsource" ]]; then
26
+ FLAGS_SUB="$FLAGS_TRUE"
27
+ parse_command_line "$@" || exit $?
28
+ eval set -- "${FLAGS_ARGV}"
29
+ fi
30
+
31
+ if [[ "$#" > 0 ]]; then
32
+ if [[ ! "$1" =~ ^- ]]; then
33
+ local sub_cmd="$(command -v "${sub_base}-$1" || true)"
34
+ if [[ ! -x "$sub_cmd" ]]; then
35
+ sub_cmd="$shome/libexec/${sub_base}-$1"
36
+ fi
37
+
38
+ if [[ -x "$sub_cmd" ]]; then
39
+ shift
40
+ exec "$sub_cmd" "$@"
41
+ fi
42
+ fi
43
+ fi
44
+
45
+ if [[ -x "$bsource_cmd" && "$bsource_cmd" != "$bsource" ]]; then
46
+ exec "$bsource_cmd" "$@"
47
+ else
48
+ if [[ "$(type -t main)" = "function" ]]; then
49
+ main "$@"
50
+ else
51
+ logger_fatal "Can't run $sub_base, missing main function"
52
+ exit 1
53
+ fi
54
+ fi
55
+ }
56
+
57
+ if [[ "$#" > 0 ]]; then
58
+ sub "$@"
59
+ fi
@@ -0,0 +1,30 @@
1
+ #!/bin/bash
2
+
3
+ #/ NAME
4
+ #/ build-gem -- upload the latest (timestamp) rubygem to rubygems.org
5
+ #/
6
+ #/ SYNOPSIS
7
+ #/ build gem -n gem_name
8
+
9
+ # figure out the project root under which bin, lib live
10
+ shome="$(cd -P -- "$(dirname -- "$BASH_SOURCE")/.." && pwd -P)"
11
+
12
+ # load a jason bourne library
13
+ source "$shome/libexec/_jason"
14
+
15
+ # define command line options:
16
+ DEFINE_string 'name' "$(basename "$shome")" 'name of gem' 'n'
17
+
18
+ # entry point
19
+ function main {
20
+ local pth_gemspec="$shome/$FLAGS_name.gemspec"
21
+ if [[ ! -e "$pth_gemspec" ]]; then
22
+ logger_fatal "could not find gemspec $pth_gemspec"
23
+ exit 1
24
+ fi
25
+
26
+ cd "$shome"
27
+ gem build "$pth_gemspec"
28
+ }
29
+
30
+ require sub "$BASH_SOURCE" "$@"
@@ -0,0 +1,30 @@
1
+ #!/bin/bash
2
+
3
+ #/ NAME
4
+ #/ build-gem -- upload the latest (timestamp) rubygem to rubygems.org
5
+ #/
6
+ #/ SYNOPSIS
7
+ #/ build gem -n gem_name
8
+
9
+ # figure out the project root under which bin, lib live
10
+ shome="$(cd -P -- "$(dirname -- "$BASH_SOURCE")/.." && pwd -P)"
11
+
12
+ # load a jason bourne library
13
+ source "$shome/libexec/_jason"
14
+
15
+ # define command line options:
16
+ DEFINE_string 'name' "$(basename "$shome")" 'name of gem' 'n'
17
+
18
+ # entry point
19
+ function main {
20
+ local pth_gemspec="$shome/$FLAGS_name.gemspec"
21
+ if [[ ! -e "$pth_gemspec" ]]; then
22
+ logger_fatal "could not find gemspec $pth_gemspec"
23
+ exit 1
24
+ fi
25
+
26
+ cd "$shome"
27
+ gem build "$pth_gemspec"
28
+ }
29
+
30
+ require sub "$BASH_SOURCE" "$@"
@@ -0,0 +1,32 @@
1
+ #!/bin/bash
2
+
3
+ #/ NAME
4
+ #/ bump -- increments a semver in a file or in git tags
5
+ #/
6
+ #/ SYNOPSIS
7
+ #/ bump [major|minor|patch]
8
+ #/ bump 1.2.3
9
+ #/ bump
10
+ #/ without arguments is equivalent to 'bump patch'
11
+
12
+ # figure out the project root under which bin, lib live
13
+ shome="$(cd -P -- "$(dirname -- "$BASH_SOURCE")/.." && pwd -P)"
14
+
15
+ # load a jason bourne library
16
+ source "$shome/libexec/_jason"
17
+
18
+ # parse the command-line
19
+ DEFINE_boolean 'dirty' "$FLAGS_FALSE" 'force bumping in unclean work area' 'f'
20
+
21
+ # entry point
22
+ function main {
23
+ require 'bump'
24
+
25
+ if [[ "$#" = 0 ]]; then
26
+ set -- patch
27
+ fi
28
+
29
+ bump_version "$FLAGS_dirty" "$@"
30
+ }
31
+
32
+ require sub "$BASH_SOURCE" "$@"
@@ -0,0 +1,81 @@
1
+ #!/bin/bash
2
+
3
+ #/ NAME
4
+ #/ edit-gem -- set environment to hint to Gemfile to use a local gemspec
5
+ #/
6
+ #/ SYNOPSIS
7
+ #/ edit gem <name> [location]
8
+ #/ edit gem -r <names>
9
+ #/ edit gem -R
10
+
11
+ # figure out the project root under which bin, lib live
12
+ shome="$(cd -P -- "$(dirname -- "$BASH_SOURCE")/.." && pwd -P)"
13
+
14
+ # load a jason bourne library
15
+ source "$shome/libexec/_jason"
16
+
17
+ # define command line options:
18
+ DEFINE_boolean "update" "$FLAGS_FALSE" "finish editing a local gem and updates project" "u"
19
+ DEFINE_boolean "reset" "$FLAGS_FALSE" "reset gem to remote" "r"
20
+ DEFINE_boolean "resetall" "$FLAGS_FALSE" "reset all gems to remote" "R"
21
+
22
+ # entry point
23
+ function main {
24
+ if [[ "$FLAGS_resetall" = "$FLAGS_TRUE" ]]; then
25
+ set +f
26
+ rm -f $shome/.local/*
27
+ set -f
28
+ bundle --local --quiet && bundle check > /dev/null
29
+ git diff --no-ext-diff Gemfile.lock vendor/cache
30
+ elif [[ "$FLAGS_reset" = "$FLAGS_TRUE" ]]; then
31
+ local nm_gem
32
+ for nm_gem in "$@"; do
33
+ rm -f "$shome/.local/$nm_gem"
34
+ done
35
+
36
+ bundle --local --quiet && bundle check > /dev/null
37
+
38
+ git diff --no-ext-diff Gemfile.lock vendor/cache
39
+ elif [[ "$FLAGS_update" = "$FLAGS_TRUE" ]]; then
40
+ local nm_gem
41
+ for nm_gem in "$@"; do
42
+ echo -n > "$shome/.local/$nm_gem"
43
+ done
44
+
45
+ bundle update "$@"
46
+
47
+ for nm_gem in "$@"; do
48
+ rm -f "$shome/.local/$nm_gem"
49
+ done
50
+ bundle --local --quiet && bundle check > /dev/null
51
+
52
+ git add Gemfile.lock vendor/cache
53
+ git add -u vendor/cache
54
+ git diff --no-ext-diff --cached Gemfile.lock vendor/cache
55
+ else
56
+ local nm_gem="$1"; shift
57
+
58
+ local pth_gem
59
+ if [[ "$#" = 0 ]]; then
60
+ pth_gem="gems/$nm_gem"
61
+ else
62
+ pth_gem="$1"; shift
63
+ fi
64
+
65
+ if [[ ! -d "$pth_gem" ]]; then
66
+ logger_fatal "cannot find local gem directoy at $pth_gem"
67
+ exit 1
68
+ fi
69
+
70
+ pth_gem="$(cd -P -- "$pth_gem" && pwd -P)"
71
+
72
+ echo "enabling local gem development on ${nm_gem} at ${pth_gem}"
73
+ mkdir -p "$shome/.local"
74
+ echo "$pth_gem" > "$shome/.local/$nm_gem"
75
+
76
+ bundle --local --quiet && bundle check > /dev/null
77
+ git diff --no-ext-diff Gemfile.lock vendor/cache
78
+ fi
79
+ }
80
+
81
+ require sub "$BASH_SOURCE" "$@"
@@ -0,0 +1,58 @@
1
+ #!/bin/bash
2
+
3
+ #/ NAME
4
+ #/ publish-gem -- publish a gem to a local, remote rubygems, geminabox repository
5
+ #/
6
+ #/ SYNOPSIS
7
+ #/ publish gem [--public | --private | --local]
8
+
9
+ # figure out the project root under which bin, lib live
10
+ shome="$(cd -P -- "$(dirname -- "$BASH_SOURCE")/.." && pwd -P)"
11
+
12
+ # load a jason bourne library
13
+ source "$shome/libexec/_jason"
14
+
15
+ # define command line options:
16
+ DEFINE_boolean "private" "$FLAGS_TRUE" "push to a local, private geminabox"
17
+ DEFINE_boolean "shared" "$FLAGS_FALSE" "push to a shared, private geminabox"
18
+ DEFINE_boolean "public" "$FLAGS_FALSE" "push to rubygems.org"
19
+
20
+ # entry point
21
+ function main {
22
+ if [[ "$FLAGS_public" = "$FLAGS_TRUE" ]]; then
23
+ push_gem "$@"
24
+ elif [[ "$FLAGS_private" = "$FLAGS_TRUE" ]]; then
25
+ push_gem_private
26
+ else
27
+ logger_fatal "must specify --public to confirm a gem push to rubygems.org"
28
+ exit 1
29
+ fi
30
+ }
31
+
32
+ # push a gem locally
33
+ function push_gem_private {
34
+ if [[ "$#" = 0 ]]; then
35
+ set +f
36
+ local latest_gem="$(ls -td *.gem 2>&- | head -1)"
37
+ push_gem_private "$latest_gem"
38
+ set -f
39
+ else
40
+ gem inabox -g http://localhost:9292 "$@"
41
+ fi
42
+ }
43
+
44
+ # push the latest gem to rubygems.org
45
+ function push_gem {
46
+ set +f
47
+ local latest_gem="$(ls -td *.gem 2>&- | head -1)"
48
+ set -f
49
+
50
+ if [[ -z "$latest_gem" ]]; then
51
+ logger_fatal "no gems found"
52
+ exit 1
53
+ fi
54
+
55
+ gem push "$latest_gem"
56
+ }
57
+
58
+ require sub "$BASH_SOURCE" "$@"
@@ -0,0 +1,58 @@
1
+ #!/bin/bash
2
+
3
+ #/ NAME
4
+ #/ publish-gem -- publish a gem to a local, remote rubygems, geminabox repository
5
+ #/
6
+ #/ SYNOPSIS
7
+ #/ publish gem [--public | --private | --local]
8
+
9
+ # figure out the project root under which bin, lib live
10
+ shome="$(cd -P -- "$(dirname -- "$BASH_SOURCE")/.." && pwd -P)"
11
+
12
+ # load a jason bourne library
13
+ source "$shome/libexec/_jason"
14
+
15
+ # define command line options:
16
+ DEFINE_boolean "private" "$FLAGS_TRUE" "push to a local, private geminabox"
17
+ DEFINE_boolean "shared" "$FLAGS_FALSE" "push to a shared, private geminabox"
18
+ DEFINE_boolean "public" "$FLAGS_FALSE" "push to rubygems.org"
19
+
20
+ # entry point
21
+ function main {
22
+ if [[ "$FLAGS_public" = "$FLAGS_TRUE" ]]; then
23
+ push_gem "$@"
24
+ elif [[ "$FLAGS_private" = "$FLAGS_TRUE" ]]; then
25
+ push_gem_private
26
+ else
27
+ logger_fatal "must specify --public to confirm a gem push to rubygems.org"
28
+ exit 1
29
+ fi
30
+ }
31
+
32
+ # push a gem locally
33
+ function push_gem_private {
34
+ if [[ "$#" = 0 ]]; then
35
+ set +f
36
+ local latest_gem="$(ls -td *.gem 2>&- | head -1)"
37
+ push_gem_private "$latest_gem"
38
+ set -f
39
+ else
40
+ gem inabox -g http://localhost:9292 "$@"
41
+ fi
42
+ }
43
+
44
+ # push the latest gem to rubygems.org
45
+ function push_gem {
46
+ set +f
47
+ local latest_gem="$(ls -td *.gem 2>&- | head -1)"
48
+ set -f
49
+
50
+ if [[ -z "$latest_gem" ]]; then
51
+ logger_fatal "no gems found"
52
+ exit 1
53
+ fi
54
+
55
+ gem push "$latest_gem"
56
+ }
57
+
58
+ require sub "$BASH_SOURCE" "$@"
metadata ADDED
@@ -0,0 +1,86 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ghp
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 2
10
+ version: 0.0.2
11
+ platform: ruby
12
+ authors:
13
+ - David Nghiem
14
+ - Tom Bombadil
15
+ autorequire:
16
+ bindir: bin
17
+ cert_chain: []
18
+
19
+ date: 2013-01-26 00:00:00 -08:00
20
+ default_executable:
21
+ dependencies: []
22
+
23
+ description: git home page
24
+ email:
25
+ - nghidav@gmail.com
26
+ - amanibhavam@destructuring.org
27
+ executables: []
28
+
29
+ extensions: []
30
+
31
+ extra_rdoc_files: []
32
+
33
+ files:
34
+ - LICENSE
35
+ - VERSION
36
+ - 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
+ - lib/development.rb
49
+ - lib/ghp/version.rb
50
+ - lib/helpers.rb
51
+ has_rdoc: true
52
+ homepage: https://github.com/destructuring/ghp
53
+ licenses: []
54
+
55
+ post_install_message:
56
+ rdoc_options: []
57
+
58
+ require_paths:
59
+ - lib
60
+ required_ruby_version: !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ hash: 3
66
+ segments:
67
+ - 0
68
+ version: "0"
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ none: false
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ hash: 3
75
+ segments:
76
+ - 0
77
+ version: "0"
78
+ requirements: []
79
+
80
+ rubyforge_project:
81
+ rubygems_version: 1.3.7
82
+ signing_key:
83
+ specification_version: 3
84
+ summary: git home page
85
+ test_files: []
86
+