herokuise 0.8.3 → 0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/bin/herokuise +64 -29
- data/herokuise.gemspec +2 -2
- metadata +4 -5
data/Rakefile
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'rake'
|
3
3
|
require 'echoe'
|
4
4
|
|
5
|
-
Echoe.new('herokuise', '0.
|
5
|
+
Echoe.new('herokuise', '0.9') do |p|
|
6
6
|
p.description = "automate getting a site on heroku and git"
|
7
7
|
p.url = "http://github.com/orta/herokuise"
|
8
8
|
p.author = "orta therox"
|
data/bin/herokuise
CHANGED
@@ -1,52 +1,83 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'open-uri'
|
3
|
+
require 'optparse'
|
4
|
+
require 'net/http'
|
5
|
+
require 'uri'
|
6
|
+
|
7
|
+
# so you can tell the difference between herokuise and general output
|
8
|
+
def log(bit)
|
9
|
+
puts "\033[35m#{bit} \033[0m"
|
10
|
+
end
|
11
|
+
|
12
|
+
options = {}
|
13
|
+
ARGV << "-h" if ARGV.empty?
|
14
|
+
|
15
|
+
optparse = OptionParser.new do|opts|
|
16
|
+
opts.banner = "Usage: herokuise [project_name] [options] this will create a github repo and set up a sinatra app serving static content on heroku"
|
17
|
+
|
18
|
+
options[:nogithub] = false
|
19
|
+
opts.on( '-ng', '--no-github', 'Don\'t create a github repository' ) do
|
20
|
+
options[:nogithub] = true
|
21
|
+
end
|
22
|
+
|
23
|
+
opts.on( '-h', '--help', 'Display this screen' ) do
|
24
|
+
puts opts
|
25
|
+
exit
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
optparse.parse!
|
3
30
|
|
4
31
|
appname = ARGV[0]
|
5
|
-
|
6
|
-
|
32
|
+
if !appname
|
33
|
+
log opts
|
7
34
|
appname = "nellbot"
|
8
35
|
Process.exit
|
9
36
|
end
|
10
37
|
|
11
38
|
github_user = `git config --global github.user`
|
12
39
|
if github_user == ""
|
13
|
-
|
14
|
-
|
40
|
+
log "You need to set up your github gem username/password, type in"
|
41
|
+
log " -> github config"
|
15
42
|
Process.exit
|
16
43
|
end
|
17
44
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
rescue
|
24
|
-
|
45
|
+
# test for the heroku app existing already
|
46
|
+
page = Net::HTTP.get( URI.parse("http://#{appname}.heroku.com/") ).to_s
|
47
|
+
if !page.include? "No such app"
|
48
|
+
log "Heroku app http://#{appname}.heroku.com already exists"
|
49
|
+
Process.exit
|
25
50
|
end
|
26
51
|
|
52
|
+
|
27
53
|
#kill the old folder if it exists
|
28
54
|
if File.exists? appname
|
29
55
|
`rm -r #{appname}`
|
30
56
|
end
|
31
57
|
|
32
|
-
|
33
|
-
|
34
|
-
|
58
|
+
log ""
|
59
|
+
log "Herokuising ------------"
|
60
|
+
log ""
|
61
|
+
log "Creating #{appname}"
|
35
62
|
|
36
|
-
#this makes the appname folder for us
|
37
|
-
`github create #{appname}`
|
38
|
-
#`mkdir #{appname}`
|
39
63
|
|
40
|
-
|
64
|
+
if options[:nogithub] == false
|
65
|
+
log "Creating Github repo"
|
66
|
+
`github create #{appname}`
|
67
|
+
else
|
68
|
+
log "Creating folder and repo"
|
69
|
+
`mkdir #{appname}`
|
70
|
+
`git init #{appname}`
|
71
|
+
end
|
41
72
|
|
73
|
+
log "Making folders"
|
42
74
|
Dir.mkdir appname + "/public"
|
43
75
|
|
44
|
-
|
45
|
-
|
76
|
+
log "Making Files"
|
46
77
|
`echo "sinatra" > #{appname}/.gems`
|
47
78
|
|
48
79
|
`echo "require 'app'
|
49
|
-
|
80
|
+
run Sinatra::Application" > #{appname}/config.ru`
|
50
81
|
|
51
82
|
`echo "require 'rubygems'
|
52
83
|
require 'sinatra'
|
@@ -55,33 +86,37 @@ get '/' do
|
|
55
86
|
redirect '/index.html'
|
56
87
|
end" > #{appname}/app.rb`
|
57
88
|
|
58
|
-
puts "Pulling down Paul Irish's HTML5 Boilerplate code"
|
59
89
|
|
60
|
-
|
90
|
+
log "Pulling down Paul Irish's HTML5 Boilerplate code"
|
61
91
|
`git clone http://github.com/paulirish/html5-boilerplate.git #{appname}/public`
|
62
92
|
|
63
93
|
# and not get any git issues
|
64
94
|
`rm -rf #{appname}/public/.git`
|
65
95
|
|
96
|
+
# the images folder in the boilerplate has a .gitignore
|
97
|
+
# that often confuses me
|
98
|
+
`find . -name .gitignore -exec rm {} \;`
|
99
|
+
|
66
100
|
#switch to the new app directory
|
67
101
|
Dir.chdir( appname )
|
68
102
|
|
69
|
-
|
103
|
+
log "Commiting to Github"
|
70
104
|
|
71
105
|
`git add .`
|
72
106
|
`git add .gems`
|
73
107
|
|
74
108
|
`git commit -m "initial import from orta-herokuize"`
|
75
109
|
|
76
|
-
|
77
|
-
|
78
|
-
`git push`
|
110
|
+
if options[:nogithub] == false
|
111
|
+
log "Pushing to Github"
|
112
|
+
`git push`
|
113
|
+
end
|
79
114
|
|
80
|
-
|
115
|
+
log "Creating heroku repo"
|
81
116
|
|
82
117
|
`heroku create #{appname}`
|
83
118
|
|
84
|
-
|
119
|
+
log "Pushing to Heroku"
|
85
120
|
|
86
121
|
`git push heroku master`
|
87
122
|
|
data/herokuise.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{herokuise}
|
5
|
-
s.version = "0.
|
5
|
+
s.version = "0.9"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["orta therox"]
|
9
|
-
s.date = %q{
|
9
|
+
s.date = %q{2011-03-04}
|
10
10
|
s.default_executable = %q{herokuise}
|
11
11
|
s.description = %q{automate getting a site on heroku and git}
|
12
12
|
s.email = %q{orta.therox@gmail.com}
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: herokuise
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
|
10
|
-
version: 0.8.3
|
8
|
+
- 9
|
9
|
+
version: "0.9"
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- orta therox
|
@@ -15,7 +14,7 @@ autorequire:
|
|
15
14
|
bindir: bin
|
16
15
|
cert_chain: []
|
17
16
|
|
18
|
-
date:
|
17
|
+
date: 2011-03-04 00:00:00 +00:00
|
19
18
|
default_executable:
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|