oban 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md ADDED
File without changes
data/LICENSE ADDED
File without changes
data/README.md ADDED
@@ -0,0 +1,15 @@
1
+ ####ABOUT:
2
+
3
+ oban hopes to simplify the deploy process for apps on heroku that use
4
+ submodules
5
+
6
+ ####INSTALL:
7
+ sudo gem install oban --no-ri --no-rdoc
8
+
9
+ # edit oban.yml.example
10
+ cp oban.yml ~/.oban.yml
11
+
12
+ ####Example Deploy:
13
+ me@myhost:~/my_proj$ oban
14
+
15
+ ####TODO:
data/ROADMAP.md ADDED
File without changes
data/bin/oban ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/ruby
2
+ require 'yaml'
3
+ require 'oban'
4
+ require 'oban/colorify'
5
+
6
+ oban = Oban.new
7
+ oban.push
@@ -0,0 +1,25 @@
1
+ module Colorify
2
+ def colorBlack(text)
3
+ return "\033[1m\033[30m #{text} \033[0m"
4
+ end
5
+
6
+ def colorWhite(text)
7
+ return "\033[1m\033[37m #{text} \033[0m"
8
+ end
9
+
10
+ def colorGreen(text)
11
+ return "\033[1m\033[32m #{text} \033[0m"
12
+ end
13
+
14
+ def colorYellow(text)
15
+ return "\033[1m\033[33m #{text} \033[0m"
16
+ end
17
+
18
+ def colorRed(text)
19
+ return "\033[1m\033[31m #{text} \033[0m"
20
+ end
21
+
22
+ def colorBlue(text)
23
+ return "\033[1m\033[34m #{text} \033[0m"
24
+ end
25
+ end
data/lib/oban/oban.rb ADDED
@@ -0,0 +1,107 @@
1
+ require 'oban/colorify'
2
+
3
+ class Oban
4
+ include Colorify
5
+
6
+ attr_accessor :config
7
+ attr_accessor :heroku_remote
8
+
9
+ def initialize
10
+ conf_file = ENV['HOME'] + '/.oban.yml'
11
+
12
+ unless FileTest.exist?(conf_file)
13
+ puts colorRed('Missing Conf File!')
14
+ puts colorRed('\tPlease copy oban.yml.example to ~/.oban.yml and edit')
15
+ exit
16
+ end
17
+
18
+ self.config = YAML::load(File.open(conf_file) { |f| @stuff = f.read })
19
+
20
+ # grab config for current repository (based on github)
21
+ current = `git remote show origin | grep Fetch`
22
+
23
+ unless !current.empty? then
24
+ puts colorRed("Not a git repository!")
25
+ exit
26
+ end
27
+
28
+ current = current.split("URL:").last.strip
29
+ remote = ""
30
+
31
+ config.each do |e|
32
+ if !e["github"].match(current).nil? then
33
+ remote = e["heroku"]
34
+ end
35
+ end
36
+
37
+ unless !remote.empty?
38
+ puts colorRed("Could not Find Remote! Sorry")
39
+ puts colorRed("please ensure your ~/.oban.yml has a remote listed for this repo")
40
+ exit
41
+ end
42
+
43
+ self.heroku_remote = remote
44
+
45
+ puts colorBlue("using #{heroku_remote}")
46
+ end
47
+
48
+ def push
49
+ # switch to master before anything else
50
+ `git checkout master`
51
+
52
+ puts colorBlue('deploying')
53
+
54
+ # make sure we have config/s3.yml
55
+ # make sure we have config/mongo.yml
56
+ # make sure we have config/database.yml
57
+
58
+ # test to see if deploy exists.. wipe it if it does..
59
+ branches = `git branch`
60
+
61
+ if !branches.match('deploy').nil? then
62
+ `git branch -D deploy`
63
+ end
64
+
65
+ # create new branch then checkout
66
+ `git branch deploy`
67
+ `git checkout deploy`
68
+
69
+ # rm git modules
70
+ # needs to be refactored a bit better
71
+ `rm -rf .gitmodules`
72
+
73
+ #`rm -rf app/models/shared/.git`
74
+ `rm -rf app/models/.git`
75
+
76
+ `git rm --cached app/models`
77
+
78
+ #`git rm --cached app/models`
79
+ #`git rm --cached app/models/shared`
80
+
81
+ # Time.now.to_i hack?
82
+
83
+ `git add app/models`
84
+
85
+ #`rm -rf \`find . -mindepth 2 -name .git\``
86
+ #`git add .`
87
+
88
+ # only add remotes if necessary
89
+ remotes = `git remote`
90
+
91
+ if remotes.match('heroku').nil? then
92
+ heroku_remote = ""
93
+ `git remote add heroku #{heroku_remote}`
94
+ end
95
+
96
+ `git commit -a -m "deploying"`
97
+ # btw --force should NEVER be used (except for this case) ;)
98
+ `git push --force heroku HEAD:master`
99
+
100
+ # add back in our submodules
101
+ puts colorBlue('switching back to master')
102
+ `git checkout master`
103
+ `git submodule init`
104
+ `git submodule update`
105
+ end
106
+
107
+ end
@@ -0,0 +1,3 @@
1
+ module Oban
2
+ VERSION = "0.1.2" unless defined?(::Oban::VERSION)
3
+ end
data/lib/oban.rb ADDED
@@ -0,0 +1 @@
1
+ require 'oban/oban.rb'
metadata ADDED
@@ -0,0 +1,91 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: oban
3
+ version: !ruby/object:Gem::Version
4
+ hash: 31
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 2
10
+ version: 0.1.2
11
+ platform: ruby
12
+ authors:
13
+ - Ian Eyberg
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-10-06 00:00:00 -05:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: rspec
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ type: :development
34
+ version_requirements: *id001
35
+ description: deploy multiple apps with submodules to heroku (and others) with ease
36
+ email:
37
+ - ian@seeinginteractive.com
38
+ executables:
39
+ - oban
40
+ extensions: []
41
+
42
+ extra_rdoc_files: []
43
+
44
+ files:
45
+ - bin/oban
46
+ - lib/oban.rb
47
+ - lib/oban/oban.rb
48
+ - lib/oban/colorify.rb
49
+ - lib/oban/version.rb
50
+ - LICENSE
51
+ - README.md
52
+ - ROADMAP.md
53
+ - CHANGELOG.md
54
+ has_rdoc: true
55
+ homepage: http://github.com/feydr/oban
56
+ licenses: []
57
+
58
+ post_install_message:
59
+ rdoc_options: []
60
+
61
+ require_paths:
62
+ - lib
63
+ required_ruby_version: !ruby/object:Gem::Requirement
64
+ none: false
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ hash: 3
69
+ segments:
70
+ - 0
71
+ version: "0"
72
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ hash: 23
78
+ segments:
79
+ - 1
80
+ - 3
81
+ - 6
82
+ version: 1.3.6
83
+ requirements: []
84
+
85
+ rubyforge_project: oban
86
+ rubygems_version: 1.3.7
87
+ signing_key:
88
+ specification_version: 3
89
+ summary: deploy multiple apps with submodules to heroku (and others) with ease
90
+ test_files: []
91
+