perpetuus 0.0.1
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.
- checksums.yaml +15 -0
- data/.gitignore +18 -0
- data/.rspec +2 -0
- data/Gemfile +11 -0
- data/LICENSE.txt +22 -0
- data/README.md +32 -0
- data/Rakefile +16 -0
- data/bin/perpetuus +5 -0
- data/lib/perpetuus/build.rb +51 -0
- data/lib/perpetuus/command.rb +54 -0
- data/lib/perpetuus/template.rb +175 -0
- data/lib/perpetuus/version.rb +3 -0
- data/lib/perpetuus.rb +24 -0
- data/meuapp/.gitignore +16 -0
- data/meuapp/Gemfile +45 -0
- data/meuapp/README.rdoc +28 -0
- data/meuapp/Rakefile +6 -0
- data/meuapp/app/assets/images/.keep +0 -0
- data/meuapp/app/assets/javascripts/application.js +16 -0
- data/meuapp/app/assets/stylesheets/application.css +13 -0
- data/meuapp/app/controllers/application_controller.rb +5 -0
- data/meuapp/app/controllers/concerns/.keep +0 -0
- data/meuapp/app/helpers/application_helper.rb +2 -0
- data/meuapp/app/mailers/.keep +0 -0
- data/meuapp/app/models/.keep +0 -0
- data/meuapp/app/models/concerns/.keep +0 -0
- data/meuapp/app/views/layouts/application.html.erb +14 -0
- data/meuapp/bin/bundle +3 -0
- data/meuapp/bin/rails +4 -0
- data/meuapp/bin/rake +4 -0
- data/meuapp/config/application.rb +28 -0
- data/meuapp/config/boot.rb +4 -0
- data/meuapp/config/database.yml +25 -0
- data/meuapp/config/environment.rb +5 -0
- data/meuapp/config/environments/development.rb +29 -0
- data/meuapp/config/environments/production.rb +80 -0
- data/meuapp/config/environments/test.rb +36 -0
- data/meuapp/config/initializers/backtrace_silencers.rb +7 -0
- data/meuapp/config/initializers/filter_parameter_logging.rb +4 -0
- data/meuapp/config/initializers/inflections.rb +16 -0
- data/meuapp/config/initializers/mime_types.rb +5 -0
- data/meuapp/config/initializers/secret_token.rb +12 -0
- data/meuapp/config/initializers/session_store.rb +3 -0
- data/meuapp/config/initializers/wrap_parameters.rb +14 -0
- data/meuapp/config/locales/en.yml +23 -0
- data/meuapp/config/routes.rb +56 -0
- data/meuapp/config.ru +4 -0
- data/meuapp/db/seeds.rb +7 -0
- data/meuapp/lib/assets/.keep +0 -0
- data/meuapp/lib/tasks/.keep +0 -0
- data/meuapp/log/.keep +0 -0
- data/meuapp/public/404.html +58 -0
- data/meuapp/public/422.html +58 -0
- data/meuapp/public/500.html +57 -0
- data/meuapp/public/favicon.ico +0 -0
- data/meuapp/public/robots.txt +5 -0
- data/meuapp/vendor/assets/javascripts/.keep +0 -0
- data/meuapp/vendor/assets/stylesheets/.keep +0 -0
- data/perpetuus.gemspec +27 -0
- data/spec/lib/perpetuus_spec.rb +4 -0
- data/spec/spec_helper.rb +19 -0
- metadata +191 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
!binary "U0hBMQ==":
|
|
3
|
+
metadata.gz: !binary |-
|
|
4
|
+
NzgxNmQ2YTMwMjMxN2RjZWE4MzRkOTIxNGIzN2UzZmQxODcyMDA1NQ==
|
|
5
|
+
data.tar.gz: !binary |-
|
|
6
|
+
MGE4NDgyN2JkMmExNGZmZDlhYjdmMTRjNjk3OWYzNzZjYzA4MWIzNA==
|
|
7
|
+
!binary "U0hBNTEy":
|
|
8
|
+
metadata.gz: !binary |-
|
|
9
|
+
ZjM1MzNlMjUyNDkxNzU5NWM3NmU4NGEzNmZkNTFhZDg0NzFiMzQ5ZDM4MGQ4
|
|
10
|
+
NjJkNmMwNmVlNGUwYzQ3YmQ0ZjcwNjZhNDEyOWU4MDE4MzMzMDA2NDBkYjQ1
|
|
11
|
+
Mzg1ZTE1YjgzYTkwNGM1MzBlYTBhZjZmMjhhNjk2YjkyOGI2MmM=
|
|
12
|
+
data.tar.gz: !binary |-
|
|
13
|
+
ZjU0YTBhMDNlODU5NzNjODNlODM0YTNhMDI2YjlhYTM1YmU1NGE4MzYxYjI0
|
|
14
|
+
NjA2YjZjZWI3NmYwZDYwZDczYTk2ZDJhZWFmZTk3YTExM2JjYTQ5NTZiY2U3
|
|
15
|
+
YjBmNzJhNzk1NTUyZDU2OGJjMjhmZTZmMDQzNzg2NDdhZmQ0YjM=
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2013 Ricardo Caldeira
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Perpetuus
|
|
2
|
+
[](https://codeclimate.com/github/ricardobond/perpetuus)
|
|
3
|
+
[](https://gemnasium.com/ricardobond/perpetuus)
|
|
4
|
+
[](https://travis-ci.org/ricardobond/perpetuus)
|
|
5
|
+
|
|
6
|
+
Continuous Deploy GEM for Rails Developers at Startup's environment.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
Only install the Perpetuus gem:
|
|
11
|
+
|
|
12
|
+
gem install 'perpetuus'
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
TODO: Write usage instructions here
|
|
17
|
+
|
|
18
|
+
## Contributing
|
|
19
|
+
|
|
20
|
+
1. Fork it
|
|
21
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
22
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
23
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
|
24
|
+
5. Create new Pull Request
|
|
25
|
+
|
|
26
|
+
## Restrictions
|
|
27
|
+
|
|
28
|
+
Only works with Ruby 1.9.x
|
|
29
|
+
|
|
30
|
+
## Requirements
|
|
31
|
+
|
|
32
|
+
- Heroku Toolbelt
|
data/Rakefile
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
require "bundler/gem_tasks"
|
|
2
|
+
require "rspec/core/rake_task"
|
|
3
|
+
|
|
4
|
+
require 'perpetuus'
|
|
5
|
+
require 'mg'
|
|
6
|
+
|
|
7
|
+
MG.new("perpetuus.gemspec")
|
|
8
|
+
RSpec::Core::RakeTask.new(:spec)
|
|
9
|
+
|
|
10
|
+
task :default => :spec
|
|
11
|
+
task :test => :spec
|
|
12
|
+
|
|
13
|
+
task :reinstall do
|
|
14
|
+
system 'gem uninstall perpetuus'
|
|
15
|
+
system 'rake install'
|
|
16
|
+
end
|
data/bin/perpetuus
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
require "travis"
|
|
2
|
+
|
|
3
|
+
module Perpetuus
|
|
4
|
+
class Build < Travis::Client::Repository
|
|
5
|
+
|
|
6
|
+
attr_accessor :username, :repository
|
|
7
|
+
attr_reader :client
|
|
8
|
+
|
|
9
|
+
def initialize
|
|
10
|
+
@username = extract_user_from_git_url
|
|
11
|
+
@repository = extract_repo_name_from_git_url
|
|
12
|
+
@client = Travis::Client.new
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def builded_with_success?
|
|
16
|
+
self.is_valid? ? git_repo.green? : false
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def is_valid?
|
|
20
|
+
git_repo ? true : false
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
private
|
|
24
|
+
|
|
25
|
+
def extract_user_from_git_url
|
|
26
|
+
remote_url = git_remote_url
|
|
27
|
+
begin_of_user = "https://github.com/"
|
|
28
|
+
end_of_user = "/"
|
|
29
|
+
remote_url[/#{begin_of_user}(.*?)#{end_of_user}/m, 1]
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def extract_repo_name_from_git_url
|
|
33
|
+
git_remote_url.split("/").last.sub(".git", "")
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def git_remote_url
|
|
37
|
+
remote = `git remote -v`
|
|
38
|
+
begin_of_url = "origin\t"
|
|
39
|
+
end_of_url = " "
|
|
40
|
+
remote[/#{begin_of_url}(.*?)#{end_of_url}/m, 1]
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def git_repo
|
|
44
|
+
begin
|
|
45
|
+
@client.repo("#{@username}/#{@repository}")
|
|
46
|
+
rescue Travis::Client::NotFound
|
|
47
|
+
puts "Username or repository doesn't exist!"
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
require 'thor'
|
|
2
|
+
|
|
3
|
+
module Perpetuus
|
|
4
|
+
class Command < Thor
|
|
5
|
+
include Thor::Actions
|
|
6
|
+
|
|
7
|
+
desc "setup", "Setup a new rails app ready to deploy in heroku"
|
|
8
|
+
def setup
|
|
9
|
+
@rails_app_name = ask_wizard("What's the name of rails project?", "rails")
|
|
10
|
+
puts "CREATING RAILS APP...".green
|
|
11
|
+
Perpetuus.new_rails_app(@rails_app_name)
|
|
12
|
+
Perpetuus.setup_git_repository(@rails_app_name)
|
|
13
|
+
unless (system "heroku create #{@heroku_app_name}")
|
|
14
|
+
@heroku_app_name = ask_wizard("What's the app name?", "heroku")
|
|
15
|
+
end
|
|
16
|
+
Perpetuus.push_to_heroku
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
desc "deploy", "Deploy your local branch to heroku if build passes"
|
|
20
|
+
def deploy
|
|
21
|
+
synchronize_changes_with_remote_repository
|
|
22
|
+
build = Perpetuus::Build.new
|
|
23
|
+
unless build.builded_with_success?
|
|
24
|
+
puts "Build Fail!".red
|
|
25
|
+
puts "Your code can't be deployed!"
|
|
26
|
+
puts "Check the status at https://travis-ci.org/#{build.username}/#{build.repository}"
|
|
27
|
+
puts build.last_build
|
|
28
|
+
return false
|
|
29
|
+
end
|
|
30
|
+
Perpetuus.push_to_heroku
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
private
|
|
34
|
+
|
|
35
|
+
def ask_wizard(question, label)
|
|
36
|
+
ask "\033[1m\033[30m\033[46m" + (label.upcase || "label").rjust(10) +
|
|
37
|
+
"\033[0m\033[36m" + " #{question}\033[0m"
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def synchronize_changes_with_remote_repository
|
|
41
|
+
git_pull
|
|
42
|
+
git_push
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def git_pull
|
|
46
|
+
system "git pull"
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def git_push
|
|
50
|
+
system "git push"
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
end
|
|
54
|
+
end
|
|
@@ -0,0 +1,175 @@
|
|
|
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}
|
data/lib/perpetuus.rb
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
require 'perpetuus/version'
|
|
2
|
+
require 'perpetuus/build'
|
|
3
|
+
require 'perpetuus/command'
|
|
4
|
+
require 'colored'
|
|
5
|
+
|
|
6
|
+
module Perpetuus
|
|
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
|
+
def self.push_to_heroku(branch="master")
|
|
18
|
+
system "git push heroku #{branch}"
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def self.new_rails_app(name)
|
|
22
|
+
system "rails new #{name} -T"
|
|
23
|
+
end
|
|
24
|
+
end
|
data/meuapp/.gitignore
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
|
2
|
+
#
|
|
3
|
+
# If you find yourself ignoring temporary files generated by your text editor
|
|
4
|
+
# or operating system, you probably want to add a global ignore instead:
|
|
5
|
+
# git config --global core.excludesfile '~/.gitignore_global'
|
|
6
|
+
|
|
7
|
+
# Ignore bundler config.
|
|
8
|
+
/.bundle
|
|
9
|
+
|
|
10
|
+
# Ignore the default SQLite database.
|
|
11
|
+
/db/*.sqlite3
|
|
12
|
+
/db/*.sqlite3-journal
|
|
13
|
+
|
|
14
|
+
# Ignore all logfiles and tempfiles.
|
|
15
|
+
/log/*.log
|
|
16
|
+
/tmp
|
data/meuapp/Gemfile
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
source 'https://rubygems.org'
|
|
2
|
+
|
|
3
|
+
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
|
4
|
+
gem 'rails', '4.0.0'
|
|
5
|
+
|
|
6
|
+
# Use sqlite3 as the database for Active Record
|
|
7
|
+
gem 'sqlite3'
|
|
8
|
+
|
|
9
|
+
# Use SCSS for stylesheets
|
|
10
|
+
gem 'sass-rails', '~> 4.0.0'
|
|
11
|
+
|
|
12
|
+
# Use Uglifier as compressor for JavaScript assets
|
|
13
|
+
gem 'uglifier', '>= 1.3.0'
|
|
14
|
+
|
|
15
|
+
# Use CoffeeScript for .js.coffee assets and views
|
|
16
|
+
gem 'coffee-rails', '~> 4.0.0'
|
|
17
|
+
|
|
18
|
+
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
|
|
19
|
+
# gem 'therubyracer', platforms: :ruby
|
|
20
|
+
|
|
21
|
+
# Use jquery as the JavaScript library
|
|
22
|
+
gem 'jquery-rails'
|
|
23
|
+
|
|
24
|
+
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
|
|
25
|
+
gem 'turbolinks'
|
|
26
|
+
|
|
27
|
+
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
|
|
28
|
+
gem 'jbuilder', '~> 1.2'
|
|
29
|
+
|
|
30
|
+
group :doc do
|
|
31
|
+
# bundle exec rake doc:rails generates the API under doc/api.
|
|
32
|
+
gem 'sdoc', require: false
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Use ActiveModel has_secure_password
|
|
36
|
+
# gem 'bcrypt-ruby', '~> 3.0.0'
|
|
37
|
+
|
|
38
|
+
# Use unicorn as the app server
|
|
39
|
+
# gem 'unicorn'
|
|
40
|
+
|
|
41
|
+
# Use Capistrano for deployment
|
|
42
|
+
# gem 'capistrano', group: :development
|
|
43
|
+
|
|
44
|
+
# Use debugger
|
|
45
|
+
# gem 'debugger', group: [:development, :test]
|
data/meuapp/README.rdoc
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
== README
|
|
2
|
+
|
|
3
|
+
This README would normally document whatever steps are necessary to get the
|
|
4
|
+
application up and running.
|
|
5
|
+
|
|
6
|
+
Things you may want to cover:
|
|
7
|
+
|
|
8
|
+
* Ruby version
|
|
9
|
+
|
|
10
|
+
* System dependencies
|
|
11
|
+
|
|
12
|
+
* Configuration
|
|
13
|
+
|
|
14
|
+
* Database creation
|
|
15
|
+
|
|
16
|
+
* Database initialization
|
|
17
|
+
|
|
18
|
+
* How to run the test suite
|
|
19
|
+
|
|
20
|
+
* Services (job queues, cache servers, search engines, etc.)
|
|
21
|
+
|
|
22
|
+
* Deployment instructions
|
|
23
|
+
|
|
24
|
+
* ...
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
Please feel free to use a different markup language if you do not plan to run
|
|
28
|
+
<tt>rake doc:app</tt>.
|
data/meuapp/Rakefile
ADDED
|
File without changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
|
2
|
+
// listed below.
|
|
3
|
+
//
|
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
|
6
|
+
//
|
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
|
8
|
+
// compiled file.
|
|
9
|
+
//
|
|
10
|
+
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
|
11
|
+
// about supported directives.
|
|
12
|
+
//
|
|
13
|
+
//= require jquery
|
|
14
|
+
//= require jquery_ujs
|
|
15
|
+
//= require turbolinks
|
|
16
|
+
//= require_tree .
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
|
3
|
+
* listed below.
|
|
4
|
+
*
|
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
|
6
|
+
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
|
7
|
+
*
|
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the top of the
|
|
9
|
+
* compiled file, but it's generally better to create a new file per style scope.
|
|
10
|
+
*
|
|
11
|
+
*= require_self
|
|
12
|
+
*= require_tree .
|
|
13
|
+
*/
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>Meuapp</title>
|
|
5
|
+
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
|
|
6
|
+
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
|
|
7
|
+
<%= csrf_meta_tags %>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
|
|
11
|
+
<%= yield %>
|
|
12
|
+
|
|
13
|
+
</body>
|
|
14
|
+
</html>
|
data/meuapp/bin/bundle
ADDED
data/meuapp/bin/rails
ADDED
data/meuapp/bin/rake
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
|
2
|
+
|
|
3
|
+
# Pick the frameworks you want:
|
|
4
|
+
require "active_record/railtie"
|
|
5
|
+
require "action_controller/railtie"
|
|
6
|
+
require "action_mailer/railtie"
|
|
7
|
+
require "sprockets/railtie"
|
|
8
|
+
# require "rails/test_unit/railtie"
|
|
9
|
+
|
|
10
|
+
# Require the gems listed in Gemfile, including any gems
|
|
11
|
+
# you've limited to :test, :development, or :production.
|
|
12
|
+
Bundler.require(:default, Rails.env)
|
|
13
|
+
|
|
14
|
+
module Meuapp
|
|
15
|
+
class Application < Rails::Application
|
|
16
|
+
# Settings in config/environments/* take precedence over those specified here.
|
|
17
|
+
# Application configuration should go into files in config/initializers
|
|
18
|
+
# -- all .rb files in that directory are automatically loaded.
|
|
19
|
+
|
|
20
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
|
21
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
|
22
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
|
23
|
+
|
|
24
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
|
25
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
|
26
|
+
# config.i18n.default_locale = :de
|
|
27
|
+
end
|
|
28
|
+
end
|