testgem417 0.0.2 → 0.0.3
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/lib/testgem417/version.rb +1 -1
- data/lib/testgem417.rb +36 -8
- metadata +1 -1
data/lib/testgem417/version.rb
CHANGED
data/lib/testgem417.rb
CHANGED
|
@@ -1,18 +1,46 @@
|
|
|
1
1
|
require "testgem417/version"
|
|
2
2
|
|
|
3
3
|
module Testgem417
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
module Generators
|
|
5
|
+
class InitGenerator < Rails::Generators::Base
|
|
6
|
+
source_root File.expand_path('../templates', __FILE__)
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
def setup_databases
|
|
9
|
+
comment_lines "Gemfile", /sqlite3/
|
|
10
|
+
gsub_file "config/database.yml",
|
|
11
|
+
/adapter: sqlite3\n\s+database: db\/production.sqlite3/,
|
|
12
|
+
"adapter: postgresql\n database: db/production"
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def set_version
|
|
16
|
+
append_to_file "Gemfile", "ruby '1.9.3'", after: "source 'https://rubygems.org'\n"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def setup_git
|
|
20
|
+
git :init
|
|
21
|
+
git add: "."
|
|
22
|
+
git commit: "-am 'Pretty awesome first commit!'"
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def get_github_username
|
|
26
|
+
@gituser = ask "Enter your Github username:" if name == "init"
|
|
27
|
+
@project = Rails.application.class.parent_name.downcase
|
|
28
|
+
end
|
|
10
29
|
|
|
11
|
-
|
|
12
|
-
|
|
30
|
+
def upload_git
|
|
31
|
+
inside Rails.root do
|
|
32
|
+
run "curl -u '#{@gituser}' https://api.github.com/user/repos -d '{\"name\" : \"#{@project}\"}' "
|
|
33
|
+
end
|
|
34
|
+
git remote: "add origin git@github.com:#{@gituser}/#{@project}.git"
|
|
35
|
+
git push: "-u origin master"
|
|
13
36
|
end
|
|
14
37
|
|
|
15
|
-
|
|
38
|
+
def setup_heroku
|
|
39
|
+
inside Rails.root do
|
|
40
|
+
run "heroku create"
|
|
41
|
+
end
|
|
42
|
+
git push: "heroku master"
|
|
43
|
+
end
|
|
16
44
|
end
|
|
17
45
|
end
|
|
18
46
|
end
|