wip-bootstrap 1.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.
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ *.gem
2
+ .DS_Store
3
+ .bundle
4
+ .yardoc
5
+ doc/*
6
+ pkg/*
7
+ scratch/*
8
+ spec/spec.opts
9
+ tmp/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in wip-bootstrap.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,14 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ wip-bootstrap (1.0)
5
+
6
+ GEM
7
+ remote: http://rubygems.org/
8
+ specs:
9
+
10
+ PLATFORMS
11
+ ruby
12
+
13
+ DEPENDENCIES
14
+ wip-bootstrap!
data/README.md ADDED
@@ -0,0 +1,4 @@
1
+ `wip-bootstrap` README
2
+ ============================================================================
3
+
4
+ Bootstraps [`wip`](http://github.com/coreyti/wip/)
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # NOTE: this file is meant to be "sourced" rather than executed directly.
4
+
5
+ wip() {
6
+ cmd="$1"
7
+
8
+ wip-route() {
9
+ result=$({ wip-ruby "route" $*; } 2>&1)
10
+
11
+ if [ -d "$result" ] ; then
12
+ echo "------------------------------------------------------------------------------"
13
+ echo " work : $result"
14
+ echo "------------------------------------------------------------------------------"
15
+ cd $result
16
+
17
+ [[ -s "./.wiprc" ]] && source ./.wiprc
18
+ export WIP_BACK=`pwd`
19
+ else
20
+ echo "$result"
21
+ fi
22
+ }
23
+
24
+ case "${cmd:-default}" in
25
+ default)
26
+ wip-ruby index .
27
+ ;;
28
+ *)
29
+ wip-route $*
30
+ ;;
31
+ esac
32
+ }
data/files/wiprc ADDED
@@ -0,0 +1,14 @@
1
+ #=============================================================
2
+ # $HOME/.wiprc FILE, generated by wip-bootstrap v1.0
3
+ # Feel free to add your site-wide profile customizations here,
4
+ # but be sure to maintain the 'source' line below.
5
+ #=============================================================
6
+
7
+ [[ -s "$HOME/.wip/bin/wiprc" ]] && source "$HOME/.wip/bin/wiprc"
8
+
9
+
10
+ #=============================================================
11
+ # Customizations
12
+ #=============================================================
13
+
14
+ # here's a good spot to start :)
@@ -0,0 +1,110 @@
1
+ require 'rubygems'
2
+ require 'fileutils'
3
+ require 'wip-bootstrap/version'
4
+
5
+ module WIP
6
+ module Bootstrap
7
+ class << self
8
+ def run
9
+ setup
10
+ install! unless installed?
11
+ end
12
+
13
+ private
14
+
15
+ def setup
16
+ @source_home = File.expand_path(File.join(File.dirname(__FILE__), '..'))
17
+ @target_home = Gem.user_home
18
+ @user_name = ENV['SUDO_USER'] || ENV['USER']
19
+ @group_id = ENV['SUDO_GID'] || ENV['staff'] # Ack!
20
+ @receipt = home_path(".wip/boostrap-v#{WIP::Bootstrap::VERSION}")
21
+ end
22
+
23
+ def installed?
24
+ File.exist?(@receipt)
25
+ end
26
+
27
+ def install!
28
+ banner('bootstrapping `wip`') {
29
+ line('wip-bootstrap version', WIP::Bootstrap::VERSION)
30
+
31
+ target_dir = home_path('.wip')
32
+ line('installing .wip to', target_dir) {
33
+ copy(files_path('wip/.'), target_dir)
34
+ chown(target_dir)
35
+ }
36
+
37
+ target_rc = home_path('.wiprc')
38
+ line('installing .wiprc to', home_path('.wiprc')) {
39
+ copy(files_path('wiprc'), target_rc)
40
+ chown(target_rc)
41
+ }
42
+
43
+ target_profile = home_path('.profile')
44
+ line('appending `source ~/.wiprc` to', target_profile) {
45
+ if (File.exist?(target_profile))
46
+ File.open(target_profile, 'a') do |f|
47
+ f.write(%Q{\n[[ -s "$HOME/.wiprc" ]] && source "$HOME/.wiprc"\n})
48
+ end
49
+ else
50
+ raise NotImplementedError
51
+ end
52
+
53
+ } unless grep?(target_profile, 'source "$HOME/.wiprc"')
54
+
55
+ line('delivering receipt to', @receipt) {
56
+ touch(@receipt)
57
+ }
58
+ }
59
+ end
60
+
61
+ def copy(source, target)
62
+ FileUtils.cp_r(source, target)
63
+ end
64
+
65
+ def chown(file)
66
+ FileUtils.chown_R(@user_name, @group_id, file)
67
+ end
68
+
69
+ def touch(file)
70
+ FileUtils.touch(file)
71
+ end
72
+
73
+ def home_path(path)
74
+ File.join(@target_home, path)
75
+ end
76
+
77
+ def files_path(path)
78
+ File.join(@source_home, 'files', path)
79
+ end
80
+
81
+ def grep?(file, content)
82
+ result = File.open(file, 'r') { |f| f.grep(/#{Regexp.escape(content)}/) }
83
+ result.length > 0
84
+ end
85
+
86
+ def banner(title, &block)
87
+ rule(title)
88
+ yield
89
+ rule
90
+ end
91
+
92
+ def rule(content = nil)
93
+ if content
94
+ puts "-- #{content} #{('-' * (74 - (content).length))}"
95
+ else
96
+ puts "-" * 78
97
+ end
98
+ end
99
+
100
+ def line(label, value)
101
+ puts " * #{pad(label)} #{value}"
102
+ yield if block_given?
103
+ end
104
+
105
+ def pad(label)
106
+ "#{label}#{'.' * 30}"[0,30]
107
+ end
108
+ end
109
+ end
110
+ end
@@ -0,0 +1,5 @@
1
+ module WIP
2
+ module Bootstrap
3
+ VERSION = "1.0"
4
+ end
5
+ end
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "wip-bootstrap/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "wip-bootstrap"
7
+ s.version = WIP::Bootstrap::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Corey Innis"]
10
+ s.email = ["support+wip@coolerator.net"]
11
+ s.homepage = "http://rubygems.org/gems/wip-bootstrap"
12
+ s.summary = "bootstrap 'wip'"
13
+ s.description = "bootstrap 'wip'"
14
+
15
+ s.rubyforge_project = "wip-bootstrap"
16
+
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+ end
metadata ADDED
@@ -0,0 +1,76 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: wip-bootstrap
3
+ version: !ruby/object:Gem::Version
4
+ hash: 15
5
+ prerelease: false
6
+ segments:
7
+ - 1
8
+ - 0
9
+ version: "1.0"
10
+ platform: ruby
11
+ authors:
12
+ - Corey Innis
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-11-01 00:00:00 -07:00
18
+ default_executable:
19
+ dependencies: []
20
+
21
+ description: bootstrap 'wip'
22
+ email:
23
+ - support+wip@coolerator.net
24
+ executables: []
25
+
26
+ extensions: []
27
+
28
+ extra_rdoc_files: []
29
+
30
+ files:
31
+ - .gitignore
32
+ - Gemfile
33
+ - Gemfile.lock
34
+ - README.md
35
+ - Rakefile
36
+ - files/wip/bin/wiprc
37
+ - files/wiprc
38
+ - lib/wip-bootstrap.rb
39
+ - lib/wip-bootstrap/version.rb
40
+ - wip-bootstrap.gemspec
41
+ has_rdoc: true
42
+ homepage: http://rubygems.org/gems/wip-bootstrap
43
+ licenses: []
44
+
45
+ post_install_message:
46
+ rdoc_options: []
47
+
48
+ require_paths:
49
+ - lib
50
+ required_ruby_version: !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ hash: 3
56
+ segments:
57
+ - 0
58
+ version: "0"
59
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
+ none: false
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ hash: 3
65
+ segments:
66
+ - 0
67
+ version: "0"
68
+ requirements: []
69
+
70
+ rubyforge_project: wip-bootstrap
71
+ rubygems_version: 1.3.7
72
+ signing_key:
73
+ specification_version: 3
74
+ summary: bootstrap 'wip'
75
+ test_files: []
76
+