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.
@@ -1,3 +1,3 @@
1
1
  module Testgem417
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/testgem417.rb CHANGED
@@ -1,18 +1,46 @@
1
1
  require "testgem417/version"
2
2
 
3
3
  module Testgem417
4
- class Testgem417Generator < Rails::Generators::NamedBase
5
- source_root File.expand_path('../templates', __FILE__)
4
+ module Generators
5
+ class InitGenerator < Rails::Generators::Base
6
+ source_root File.expand_path('../templates', __FILE__)
6
7
 
7
- def getname
8
- create_file "config/initializers/initializer.rb"
9
- p "Init"
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
- if name == "init"
12
- p "init"
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
- p "After init"
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testgem417
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: