metacon 0.0.1

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.
@@ -0,0 +1,44 @@
1
+ #!/bin/bash
2
+ # Just a fancy way to run rake against exactly the right Rakefile, with a
3
+ # default WORKER_ENV always of development, and more easily pass in
4
+ # command-line parameters to the task, etc. Meant to be symlinked to.
5
+ #
6
+ # ex:
7
+ # $ do-something production blah
8
+ # (becomes, more or less)
9
+ # $ WORKER_ENV=production rake do-something[blah]
10
+
11
+ set -e # Exit on error
12
+ #------------------------------------------------------------------------------
13
+ # Make sure we know exactly where the real script is so we can run from
14
+ # anywhere. (follows sym-links etc.)
15
+ SCRIPT_PATH="${BASH_SOURCE[0]}";
16
+ if [ -h "${SCRIPT_PATH}" ]; then
17
+ while([ -h "${SCRIPT_PATH}" ]) do
18
+ if [[ `uname -s` == 'Darwin' ]]; then
19
+ SCRIPT_PATH=`readlink "${SCRIPT_PATH}"`
20
+ else
21
+ SCRIPT_PATH=`readlink -f "${SCRIPT_PATH}"`
22
+ fi
23
+ done
24
+ fi
25
+ pushd . > /dev/null
26
+ cd `dirname ${SCRIPT_PATH}` > /dev/null
27
+ SCRIPT_PATH=`pwd`;
28
+ popd > /dev/null
29
+ #------------------------------------------------------------------------------
30
+
31
+ RAKEFILE="${SCRIPT_PATH}/Rakefile" # Explicit to this Rakefile
32
+
33
+ pushd . > /dev/null # Save cwd & go to that rakefile's directory
34
+ cd "${SCRIPT_PATH}"
35
+
36
+ task=`basename ${BASH_SOURCE[0]}`
37
+ if [[ "$#" > 0 ]]; then
38
+ worker_env=$1
39
+ shift
40
+ else
41
+ worker_env=development
42
+ fi
43
+ WORKER_ENV=$worker_env rake --nosearch -f "${RAKEFILE}" ${task}[$@]
44
+ popd > /dev/null # Restore old cwd
File without changes
@@ -0,0 +1,7 @@
1
+ GEM
2
+ specs:
3
+
4
+ PLATFORMS
5
+ ruby
6
+
7
+ DEPENDENCIES
@@ -0,0 +1,24 @@
1
+ overlord help # (or -h or --help)
2
+ overlord version # (or -v or --version)
3
+
4
+ overlord setup
5
+
6
+ overlord goto gamer_transcode/development
7
+
8
+ overlord build
9
+ overlord rebuild
10
+ overlord test
11
+
12
+
13
+ ### Setup
14
+ (was initialize)
15
+
16
+
17
+
18
+ ### ". __overlord_helper" in .bashrc
19
+ - Set up overlord command (function that makes sure it's in the right dir
20
+ tree)
21
+ - Set up Autocomplete based on conf
22
+ - Set up bash prompt
23
+ - 'cd' monkeypatch to keep things consistent
24
+
@@ -0,0 +1,96 @@
1
+ require 'rake/clean'
2
+ require 'rubygems'
3
+ require './helpers/rake_help.rb'
4
+ require 'pp'
5
+
6
+ task :default => :test
7
+
8
+ desc "Initialize everything on a new machine"
9
+ task :initialize => [:core_deps, :virtual_envs, :update_submodules]
10
+
11
+ task :core_deps do
12
+ status "Checking for pythonbrew"
13
+ unless command_exists? 'pythonbrew'
14
+ cmd = ''
15
+ cfail("pythonbrew not found. Please install via the following bash commands:\n" +
16
+ " |{=== curl -kL http://xrl.us/pythonbrewinstall} | |{=== bash}\n" +
17
+ " |{=== echo '[[ -s $HOME/.pythonbrew/etc/bashrc ]] && " +
18
+ "source $HOME/.pythonbrew/etc/bashrc' >> ~/.bashrc}\n" +
19
+ " |{=== source $HOME/.pythonbrew/etc/bashrc}\n" +
20
+ "or by following instructions at https://github.com/utahta/pythonbrew.")
21
+ end
22
+ result 'installed'
23
+
24
+ status "Checking for python versions"
25
+ versions = `pythonbrew list`.split("\n").map{|p| p.strip}
26
+ unless versions.include?('Python-2.7.2')
27
+ result "installing isolated/local python 2.7.2"
28
+ sh 'pythonbrew install --no-test 2.7.2'
29
+ end
30
+ result "Python instance ready"
31
+
32
+ end
33
+
34
+ task :virtual_envs do
35
+ status "Creating virtual environments for various workers / environments"
36
+
37
+ result "not yet implemented"
38
+ end
39
+
40
+ desc "Update submodules (initializes if necessary) - run first and often"
41
+ task :update_submodules => [:global_gitignore] do
42
+ sh "git submodule init"
43
+ sh "git submodule update"
44
+ end
45
+
46
+ task :build do
47
+ puts "build"
48
+ end
49
+
50
+ task :rebuild do
51
+ puts "rebuild"
52
+ end
53
+
54
+
55
+ task :restart do
56
+ puts "restart"
57
+ end
58
+
59
+ task :sync do
60
+ # Make sure that git doesn't have anything dangling - esp submodule commit
61
+ # changes or uncommitted submodule changes etc.
62
+ puts "sync"
63
+ end
64
+
65
+ task :test do
66
+ puts "test"
67
+ end
68
+
69
+ task :info do
70
+ puts "environment: ..."
71
+ puts "worker-type: ..."
72
+ puts "..."
73
+ end
74
+
75
+
76
+ task :global_gitignore do
77
+ globalignore = `git config -l | grep core.excludesfile | cut -d= -f2`.strip
78
+ if globalignore.length == 0 || (! File.exist?(globalignore))
79
+ color_puts "|{blue Hmm... you don't have a global .gitignore file...}"
80
+ puts "I'm going to add one for you with a bunch of nice defaults at "+
81
+ "~/.gitignore. I hope you don't mind...\n\n"
82
+ sh "git config --global core.excludesfile ~/.gitignore"
83
+ sh "echo -e \".DS_Store\nThumbs.db\n.*.swp\n.bundle\n*.tmproj\ntmtags\n"+
84
+ "*~\n\\#*\n.\\#*\n.redcar\n*.rbc\" >> ~/.gitignore"
85
+ globalignore = `git config -l | grep core.excludesfile | cut -d= -f2`.strip
86
+ end
87
+
88
+ if globalignore.length > 0 && `grep description-pak \"#{globalignore}\"`.strip.length == 0
89
+ color_puts "|{blue Adding some generated package stuff to your global "+
90
+ "gitignore so that the submodules don't get messy.}"
91
+ color_puts "(Can't add to some individual .gitignores because the "+
92
+ "submodules may not be under our control)"
93
+ sh "echo \"\\ndescription-pak\\ndoc-pak\\nffmpeg_*.deb\\nx264_*.deb\" >> "+
94
+ "\"#{globalignore}\""
95
+ end
96
+ end
@@ -0,0 +1,44 @@
1
+ #!/bin/bash
2
+ # Just a fancy way to run rake against exactly the right Rakefile, with a
3
+ # default WORKER_ENV always of development, and more easily pass in
4
+ # command-line parameters to the task, etc. Meant to be symlinked to.
5
+ #
6
+ # ex:
7
+ # $ do-something production blah
8
+ # (becomes, more or less)
9
+ # $ WORKER_ENV=production rake do-something[blah]
10
+
11
+ set -e # Exit on error
12
+ #------------------------------------------------------------------------------
13
+ # Make sure we know exactly where the real script is so we can run from
14
+ # anywhere. (follows sym-links etc.)
15
+ SCRIPT_PATH="${BASH_SOURCE[0]}";
16
+ if [ -h "${SCRIPT_PATH}" ]; then
17
+ while([ -h "${SCRIPT_PATH}" ]) do
18
+ if [[ `uname -s` == 'Darwin' ]]; then
19
+ SCRIPT_PATH=`readlink "${SCRIPT_PATH}"`
20
+ else
21
+ SCRIPT_PATH=`readlink -f "${SCRIPT_PATH}"`
22
+ fi
23
+ done
24
+ fi
25
+ pushd . > /dev/null
26
+ cd `dirname ${SCRIPT_PATH}` > /dev/null
27
+ SCRIPT_PATH=`pwd`;
28
+ popd > /dev/null
29
+ #------------------------------------------------------------------------------
30
+
31
+ RAKEFILE="${SCRIPT_PATH}/Rakefile" # Explicit to this Rakefile
32
+
33
+ pushd . > /dev/null # Save cwd & go to that rakefile's directory
34
+ cd "${SCRIPT_PATH}"
35
+
36
+ task=`basename ${BASH_SOURCE[0]}`
37
+ if [[ "$#" > 0 ]]; then
38
+ worker_env=$1
39
+ shift
40
+ else
41
+ worker_env=development
42
+ fi
43
+ WORKER_ENV=$worker_env rake --nosearch -f "${RAKEFILE}" ${task}[$@]
44
+ popd > /dev/null # Restore old cwd
@@ -0,0 +1,44 @@
1
+ #!/bin/bash
2
+ # Just a fancy way to run rake against exactly the right Rakefile, with a
3
+ # default WORKER_ENV always of development, and more easily pass in
4
+ # command-line parameters to the task, etc. Meant to be symlinked to.
5
+ #
6
+ # ex:
7
+ # $ do-something production blah
8
+ # (becomes, more or less)
9
+ # $ WORKER_ENV=production rake do-something[blah]
10
+
11
+ set -e # Exit on error
12
+ #------------------------------------------------------------------------------
13
+ # Make sure we know exactly where the real script is so we can run from
14
+ # anywhere. (follows sym-links etc.)
15
+ SCRIPT_PATH="${BASH_SOURCE[0]}";
16
+ if [ -h "${SCRIPT_PATH}" ]; then
17
+ while([ -h "${SCRIPT_PATH}" ]) do
18
+ if [[ `uname -s` == 'Darwin' ]]; then
19
+ SCRIPT_PATH=`readlink "${SCRIPT_PATH}"`
20
+ else
21
+ SCRIPT_PATH=`readlink -f "${SCRIPT_PATH}"`
22
+ fi
23
+ done
24
+ fi
25
+ pushd . > /dev/null
26
+ cd `dirname ${SCRIPT_PATH}` > /dev/null
27
+ SCRIPT_PATH=`pwd`;
28
+ popd > /dev/null
29
+ #------------------------------------------------------------------------------
30
+
31
+ RAKEFILE="${SCRIPT_PATH}/Rakefile" # Explicit to this Rakefile
32
+
33
+ pushd . > /dev/null # Save cwd & go to that rakefile's directory
34
+ cd "${SCRIPT_PATH}"
35
+
36
+ task=`basename ${BASH_SOURCE[0]}`
37
+ if [[ "$#" > 0 ]]; then
38
+ worker_env=$1
39
+ shift
40
+ else
41
+ worker_env=development
42
+ fi
43
+ WORKER_ENV=$worker_env rake --nosearch -f "${RAKEFILE}" ${task}[$@]
44
+ popd > /dev/null # Restore old cwd
@@ -0,0 +1,99 @@
1
+ # encoding: utf-8
2
+ $KCODE='U' if RUBY_VERSION < '1.9.0'
3
+
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Going to run `bundle install` to install missing gems"
10
+ sh 'bundle install'
11
+ begin
12
+ Bundler.setup(:default, :development)
13
+ rescue Bundler::BundlerError => e
14
+ $stderr.puts e.message
15
+ $stderr.puts "Run `bundle install` to install missing gems"
16
+ exit e.status_code
17
+ end
18
+ end
19
+
20
+ #require 'rake'
21
+ require 'yaml'
22
+
23
+ #include Rake::DSL
24
+
25
+ ROOTDIR = File.expand_path(File.join(File.dirname(__FILE__),'..'))
26
+ CONTEXT_OS = `uname -s`.strip.downcase.to_sym
27
+ def mac?() CONTEXT_OS == :darwin end
28
+ def darwin?() CONTEXT_OS == :darwin end
29
+ def linux?() CONTEXT_OS == :linux end
30
+
31
+ ESCS = {:normal =>"\e[0m", :black =>"\e[0;30m", :blue =>"\e[0;34m",
32
+ :green =>"\e[0;32m", :cyan =>"\e[0;36m", :red =>"\e[0;31m",
33
+ :purple =>"\e[0;35m", :brown =>"\e[0;33m", :gray =>"\e[0;37m",
34
+ :dark_gray =>"\e[1;30m", :light_blue=>"\e[1;34m", :light_green =>"\e[1;32m",
35
+ :light_cyan=>"\e[1;36m", :light_red =>"\e[1;31m", :light_purple =>"\e[1;35m",
36
+ :yellow =>"\e[1;33m", :white =>"\e[1;37m", :bg_black =>"\e[40m",
37
+ :bg_red =>"\e[41m", :bg_green =>"\e[42m", :bg_yellow =>"\e[43m",
38
+ :bg_blue => "\e[44m", :bg_magenta=>"\e[45m", :bg_cyan =>"\e[46m",
39
+ :bg_white => "\e[47m", :"=" =>"\e[44;1;37m", :"==" =>"\e[4;1;37m",
40
+ :"===" => "\e[1;34m"}
41
+
42
+ def color_puts(str, emit=true)
43
+ begin
44
+ r = false
45
+ str.gsub!(/\|\{([^ \|]+ )([^\}\|]*)\}/){r=true; "#{ESCS[$1.strip.to_sym]}#{$2}#{ESCS[:normal]}"}
46
+ end while r
47
+ puts str if emit
48
+ return str
49
+ end
50
+
51
+ def cwarn(str) color_puts("---|{red Warning:} #{str}") end
52
+ def cfail(str) color_fail("---|{red Fail:} #{str}") end
53
+ def color_fail(str) fail color_puts(str, false) end
54
+
55
+ def status(str) color_puts("\n---|{== #{str}}") end
56
+ def result(str) color_puts(" |{green #{str}}\n") end
57
+
58
+ def f(*args) File.expand_path(File.join(args)) end # Shortcut for File.join
59
+
60
+ def chd(*args)
61
+ dir = f(args)
62
+ color_puts "|{gray cd #{dir}}"
63
+ Dir.chdir(dir)
64
+ end
65
+
66
+ def command_exists?(cmd)
67
+ `( command -v #{cmd} )`.length > 0
68
+ end
69
+
70
+ def vew(cmd)
71
+ sh "#{ROOTDIR}/vew #{cmd}"
72
+ #sh "/bin/bash -c '. /usr/local/bin/virtualenvwrapper.sh ; #{cmd}'"
73
+ end
74
+
75
+ # From http://svn.ruby-lang.org/repos/ruby/trunk/lib/shellwords.rb
76
+ def shellescape(str)
77
+ return "''" if str.empty?
78
+ str = str.dup
79
+ str.strip!
80
+ str.gsub!(/([^A-Za-z0-9_\-.,:\/@\n])/n, "\\\\\\1")
81
+ str.gsub!(/\n/, "'\n'")
82
+ return str
83
+ end
84
+
85
+ def ensure_profile_has(cmd, also_run=true)
86
+ prof = Dir[ENV['HOME']+'/.bash_profile']
87
+ prof = Dir[ENV['HOME']+'/.profile'] if prof.size == 0
88
+ prof = Dir[ENV['HOME']+'/.bashrc'] if prof.size == 0
89
+ if prof.size == 0
90
+ color_puts("\n|{red IMPORTANT: Please put the following in your .bash_profile equivalent: #{cmd}}\n")
91
+ else
92
+ there = `grep -F #{shellescape(cmd)} '#{prof[0]}'`.length > 0
93
+ unless there
94
+ color_puts "|{brown ADDING >>> |{yellow #{cmd.strip}}} |{brown <<< to your #{prof[0]}!}"
95
+ sh "echo #{shellescape(cmd)} >> '#{prof[0]}'"
96
+ end
97
+ end
98
+ sh cmd if also_run
99
+ end
@@ -0,0 +1,44 @@
1
+ #!/bin/bash
2
+ # Just a fancy way to run rake against exactly the right Rakefile, with a
3
+ # default WORKER_ENV always of development, and more easily pass in
4
+ # command-line parameters to the task, etc. Meant to be symlinked to.
5
+ #
6
+ # ex:
7
+ # $ do-something production blah
8
+ # (becomes, more or less)
9
+ # $ WORKER_ENV=production rake do-something[blah]
10
+
11
+ set -e # Exit on error
12
+ #------------------------------------------------------------------------------
13
+ # Make sure we know exactly where the real script is so we can run from
14
+ # anywhere. (follows sym-links etc.)
15
+ SCRIPT_PATH="${BASH_SOURCE[0]}";
16
+ if [ -h "${SCRIPT_PATH}" ]; then
17
+ while([ -h "${SCRIPT_PATH}" ]) do
18
+ if [[ `uname -s` == 'Darwin' ]]; then
19
+ SCRIPT_PATH=`readlink "${SCRIPT_PATH}"`
20
+ else
21
+ SCRIPT_PATH=`readlink -f "${SCRIPT_PATH}"`
22
+ fi
23
+ done
24
+ fi
25
+ pushd . > /dev/null
26
+ cd `dirname ${SCRIPT_PATH}` > /dev/null
27
+ SCRIPT_PATH=`pwd`;
28
+ popd > /dev/null
29
+ #------------------------------------------------------------------------------
30
+
31
+ RAKEFILE="${SCRIPT_PATH}/Rakefile" # Explicit to this Rakefile
32
+
33
+ pushd . > /dev/null # Save cwd & go to that rakefile's directory
34
+ cd "${SCRIPT_PATH}"
35
+
36
+ task=`basename ${BASH_SOURCE[0]}`
37
+ if [[ "$#" > 0 ]]; then
38
+ worker_env=$1
39
+ shift
40
+ else
41
+ worker_env=development
42
+ fi
43
+ WORKER_ENV=$worker_env rake --nosearch -f "${RAKEFILE}" ${task}[$@]
44
+ popd > /dev/null # Restore old cwd
@@ -0,0 +1,44 @@
1
+ #!/bin/bash
2
+ # Just a fancy way to run rake against exactly the right Rakefile, with a
3
+ # default WORKER_ENV always of development, and more easily pass in
4
+ # command-line parameters to the task, etc. Meant to be symlinked to.
5
+ #
6
+ # ex:
7
+ # $ do-something production blah
8
+ # (becomes, more or less)
9
+ # $ WORKER_ENV=production rake do-something[blah]
10
+
11
+ set -e # Exit on error
12
+ #------------------------------------------------------------------------------
13
+ # Make sure we know exactly where the real script is so we can run from
14
+ # anywhere. (follows sym-links etc.)
15
+ SCRIPT_PATH="${BASH_SOURCE[0]}";
16
+ if [ -h "${SCRIPT_PATH}" ]; then
17
+ while([ -h "${SCRIPT_PATH}" ]) do
18
+ if [[ `uname -s` == 'Darwin' ]]; then
19
+ SCRIPT_PATH=`readlink "${SCRIPT_PATH}"`
20
+ else
21
+ SCRIPT_PATH=`readlink -f "${SCRIPT_PATH}"`
22
+ fi
23
+ done
24
+ fi
25
+ pushd . > /dev/null
26
+ cd `dirname ${SCRIPT_PATH}` > /dev/null
27
+ SCRIPT_PATH=`pwd`;
28
+ popd > /dev/null
29
+ #------------------------------------------------------------------------------
30
+
31
+ RAKEFILE="${SCRIPT_PATH}/Rakefile" # Explicit to this Rakefile
32
+
33
+ pushd . > /dev/null # Save cwd & go to that rakefile's directory
34
+ cd "${SCRIPT_PATH}"
35
+
36
+ task=`basename ${BASH_SOURCE[0]}`
37
+ if [[ "$#" > 0 ]]; then
38
+ worker_env=$1
39
+ shift
40
+ else
41
+ worker_env=development
42
+ fi
43
+ WORKER_ENV=$worker_env rake --nosearch -f "${RAKEFILE}" ${task}[$@]
44
+ popd > /dev/null # Restore old cwd