perpetuus 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MzJjOTRiMjNkYTdjZDNhM2ZhYjU3MGMyYWEwMDAwNWY1Yjc5OTM1OA==
4
+ NjE0YzVhMTA1YTIxZmJkYmY5NTA4YmFhZGYwOGUxODNhY2E1NDJkYg==
5
5
  data.tar.gz: !binary |-
6
- YzMyMDE3MDU2NzA5NGFmODRjYmQ1NzY5M2YwMDNjODYwMDgyZTdlNQ==
6
+ ZTBjNDliOGFhYmFkNTAyZjEyYmFhMmM1ZjI4YTQyMjRmYTI4NDUzMQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- OWUyNTA3YzRjZDViYzhmMzNmOTVlYzMwYmRmZmYxYzZjNTNmMGRhMzU4ZGI4
10
- ZDdhMDRkNTNhNGU2OTFlMTNiMzhjNWExZWUxZGE1MGQyMzFhYzkxYmE4MTlm
11
- ZGEwY2RlNWNjZDU2N2ZjYjZmNGJmNjUyM2I0MmRhZTNhNTJjYzY=
9
+ YTM4YTg0MjBhMTg4OWMwNTVlNWEyMDUxYTY3ZjkyZTllOGMzMGU1M2RmYzA0
10
+ NTZhMWU5NmZlZTBkNWYzNjc2MDA0MjNlYzA3YzNhNDhlNzZmNjkyMmI0ZGFh
11
+ MjE3YmQzMmM4YWI3MTY3ZGJiOGZlZjE2MTMwZDRhOWZjMWMyMDU=
12
12
  data.tar.gz: !binary |-
13
- YmJkZWI4MmJhMDg2NmZmMWM2Nzg0ZWFjYTI4NzIxMjE5M2NlMjRlMDFkYzk4
14
- MTg3MjY5YmI1MDViOWMxMThiYTZhNTQ4NzNkNjFhZDg2NjczNThmMzIxZTY1
15
- OTZhZmViYTVlMTlhZTlhOWZhNTAzNzkzYjIzMDVjNjViMjNmMTg=
13
+ ZTIxMzhmOGQzODA2Mjg0YzFmYzM1MDVlMjNkODY0MTQ1Mzc5ZDAzM2NiNmFj
14
+ YTMyMDgyN2Y2ZjM4OTdmODE0NjE1YjAxZTI4NWQ1M2EzNTEzNGMzNWU5ZDkz
15
+ NGI5MTk1ZWUyZDZhMjZhZDgxZTcxZmFiNWQ0NmIwOGY5YzJjZDM=
@@ -9,13 +9,6 @@ module Perpetuus
9
9
  @rails_app_name = ask_wizard("What's the name of rails project?", "rails")
10
10
  puts "CREATING RAILS APP...".green
11
11
  Perpetuus.new_rails_app(@rails_app_name)
12
- =begin
13
- Perpetuus.setup_git_repository(@rails_app_name)
14
- unless (system "heroku create #{@heroku_app_name}")
15
- @heroku_app_name = ask_wizard("What's the app name?", "heroku")
16
- end
17
- Perpetuus.push_to_heroku
18
- =end
19
12
  end
20
13
 
21
14
  desc "deploy", "Deploy your local branch to heroku if build passes"
@@ -1,3 +1,3 @@
1
1
  module Perpetuus
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/perpetuus.rb CHANGED
@@ -5,15 +5,6 @@ require 'colored'
5
5
 
6
6
  module Perpetuus
7
7
 
8
- def self.setup_git_repository(app_name)
9
- system 'cd #{app_name}'
10
- print "[GIT]".white_on_blue
11
- puts "\tINITIALIZING GIT REPOSITORY...".green
12
- system 'git init'
13
- system 'git add .'
14
- system 'git commit -m "Initial commit."'
15
- end
16
-
17
8
  def self.push_to_heroku(branch="master")
18
9
  system "git push heroku #{branch}"
19
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: perpetuus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ricardo Caldeira
@@ -112,7 +112,6 @@ files:
112
112
  - lib/perpetuus.rb
113
113
  - lib/perpetuus/build.rb
114
114
  - lib/perpetuus/command.rb
115
- - lib/perpetuus/template.rb
116
115
  - lib/perpetuus/version.rb
117
116
  - perpetuus.gemspec
118
117
  - spec/lib/perpetuus_spec.rb
@@ -1,175 +0,0 @@
1
- initializer 'generators.rb', <<-RUBY
2
- Rails.application.config.generators do |g|
3
- end
4
- RUBY
5
-
6
- @recipes = ["activerecord", "git", "heroku", "rspec"]
7
-
8
- def recipes; @recipes end
9
- def recipe?(name); @recipes.include?(name) end
10
-
11
- def say_custom(tag, text); say "\033[1m\033[36m" + tag.to_s.rjust(10) + "\033[0m" + " #{text}" end
12
- def say_recipe(name); say "\033[1m\033[36m" + "recipe".rjust(10) + "\033[0m" + " Running #{name} recipe..." end
13
- def say_wizard(text); say_custom(@current_recipe || 'wizard', text) end
14
-
15
- def ask_wizard(question)
16
- ask "\033[1m\033[30m\033[46m" + (@current_recipe || "prompt").rjust(10) + "\033[0m\033[36m" + " #{question}\033[0m"
17
- end
18
-
19
- def yes_wizard?(question)
20
- answer = ask_wizard(question + " \033[33m(y/n)\033[0m")
21
- case answer.downcase
22
- when "yes", "y"
23
- true
24
- when "no", "n"
25
- false
26
- else
27
- yes_wizard?(question)
28
- end
29
- end
30
-
31
- def no_wizard?(question); !yes_wizard?(question) end
32
-
33
- def multiple_choice(question, choices)
34
- say_custom('question', question)
35
- values = {}
36
- choices.each_with_index do |choice,i|
37
- values[(i + 1).to_s] = choice[1]
38
- say_custom (i + 1).to_s + ')', choice[0]
39
- end
40
- answer = ask_wizard("Enter your selection:") while !values.keys.include?(answer)
41
- values[answer]
42
- end
43
-
44
- @current_recipe = nil
45
- @configs = {}
46
-
47
- @after_blocks = []
48
- def after_bundler(&block); @after_blocks << [@current_recipe, block]; end
49
- @after_everything_blocks = []
50
- def after_everything(&block); @after_everything_blocks << [@current_recipe, block]; end
51
- @before_configs = {}
52
- def before_config(&block); @before_configs[@current_recipe] = block; end
53
-
54
-
55
-
56
- # >-----------------------------[ ActiveRecord ]------------------------------<
57
-
58
- @current_recipe = "activerecord"
59
- @before_configs["activerecord"].call if @before_configs["activerecord"]
60
- say_recipe 'ActiveRecord'
61
-
62
- config = {}
63
- config['database'] = multiple_choice("Which database are you using?", [["MySQL", "mysql"], ["Oracle", "oracle"], ["PostgreSQL", "postgresql"], ["SQLite", "sqlite3"], ["Frontbase", "frontbase"], ["IBM DB", "ibm_db"]]) if true && true unless config.key?('database')
64
- config['auto_create'] = yes_wizard?("Automatically create database with default configuration?") if true && true unless config.key?('auto_create')
65
- @configs[@current_recipe] = config
66
-
67
- if config['database']
68
- say_wizard "Configuring '#{config['database']}' database settings..."
69
- old_gem = gem_for_database
70
- @options = @options.dup.merge(:database => config['database'])
71
- gsub_file 'Gemfile', "gem '#{old_gem}'", "gem '#{gem_for_database}'"
72
- template "config/databases/#{@options[:database]}.yml", "config/database.yml.new"
73
- run 'mv config/database.yml.new config/database.yml'
74
- end
75
-
76
- after_bundler do
77
- rake "db:create:all" if config['auto_create']
78
- end
79
-
80
-
81
- # >----------------------------------[ Git ]----------------------------------<
82
-
83
- @current_recipe = "git"
84
- @before_configs["git"].call if @before_configs["git"]
85
- say_recipe 'Git'
86
-
87
-
88
- @configs[@current_recipe] = config
89
-
90
- after_everything do
91
- git :init
92
- git :add => '.'
93
- git :commit => '-m "Initial import."'
94
- end
95
-
96
-
97
- # >--------------------------------[ Heroku ]---------------------------------<
98
-
99
- @current_recipe = "heroku"
100
- @before_configs["heroku"].call if @before_configs["heroku"]
101
- say_recipe 'Heroku'
102
-
103
- config = {}
104
- config['create'] = yes_wizard?("Automatically create appname.heroku.com?") if true && true unless config.key?('create')
105
- config['staging'] = yes_wizard?("Create staging app? (appname-staging.heroku.com)") if config['create'] && true unless config.key?('staging')
106
- config['domain'] = ask_wizard("Specify custom domain (or leave blank):") if config['create'] && true unless config.key?('domain')
107
- config['deploy'] = yes_wizard?("Deploy immediately?") if config['create'] && true unless config.key?('deploy')
108
- @configs[@current_recipe] = config
109
-
110
- heroku_name = app_name.gsub('_','')
111
-
112
- after_everything do
113
- if config['create']
114
- say_wizard "Creating Heroku app '#{heroku_name}.heroku.com'"
115
- while !system("heroku create #{heroku_name}")
116
- heroku_name = ask_wizard("What do you want to call your app? ")
117
- end
118
- end
119
-
120
- if config['staging']
121
- staging_name = "#{heroku_name}-staging"
122
- say_wizard "Creating staging Heroku app '#{staging_name}.heroku.com'"
123
- while !system("heroku create #{staging_name}")
124
- staging_name = ask_wizard("What do you want to call your staging app?")
125
- end
126
- git :remote => "rm heroku"
127
- git :remote => "add production git@heroku.com:#{heroku_name}.git"
128
- git :remote => "add staging git@heroku.com:#{staging_name}.git"
129
- say_wizard "Created branches 'production' and 'staging' for Heroku deploy."
130
- end
131
-
132
- unless config['domain'].blank?
133
- run "heroku addons:add custom_domains"
134
- run "heroku domains:add #{config['domain']}"
135
- end
136
-
137
- git :push => "#{config['staging'] ? 'staging' : 'heroku'} master" if config['deploy']
138
- end
139
-
140
-
141
- # >---------------------------------[ RSpec ]---------------------------------<
142
-
143
- @current_recipe = "rspec"
144
- @before_configs["rspec"].call if @before_configs["rspec"]
145
- say_recipe 'RSpec'
146
-
147
-
148
- @configs[@current_recipe] = config
149
-
150
- gem 'rspec-rails', '>= 2.0.1', :group => [:development, :test]
151
-
152
- inject_into_file "config/initializers/generators.rb", :after => "Rails.application.config.generators do |g|\n" do
153
- " g.test_framework = :rspec\n"
154
- end
155
-
156
- after_bundler do
157
- generate 'rspec:install'
158
- end
159
-
160
-
161
-
162
-
163
-
164
- @current_recipe = nil
165
-
166
- # >-----------------------------[ Run Bundler ]-------------------------------<
167
-
168
- say_wizard "Running Bundler install. This will take a while."
169
- run 'bundle install'
170
- say_wizard "Running after Bundler callbacks."
171
- @after_blocks.each{|b| config = @configs[b[0]] || {}; @current_recipe = b[0]; b[1].call}
172
-
173
- @current_recipe = nil
174
- say_wizard "Running after everything callbacks."
175
- @after_everything_blocks.each{|b| config = @configs[b[0]] || {}; @current_recipe = b[0]; b[1].call}