Class: EchoBase

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/echo_base.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject

class_option :heroku, :default => :false class_option :db, :default => ‘sqlite’, :desc => ‘Database to use, options are couchdb, mongo, redis, mysql, postgres’



16
17
18
# File 'lib/echo_base.rb', line 16

def self.source_root
  @_source_root ||= File.expand_path('../templates/', __FILE__)
end

Instance Method Details

#app_filesObject



27
28
29
# File 'lib/echo_base.rb', line 27

def app_files
  directory 'app', "#{app_path}/app", :force => true
end

#bundleObject



43
44
45
# File 'lib/echo_base.rb', line 43

def bundle
  run 'bundle'
end

#cleanupObject



85
86
87
88
# File 'lib/echo_base.rb', line 85

def cleanup
  remove_file "#{app_path}/public/index.html"
  remove_file "#{app_path}/public/images/rails.png"
end

#configObject



35
36
37
38
39
40
41
# File 'lib/echo_base.rb', line 35

def config
  directory 'config', "#{app_path}/config"
  # application rb stuff:
  # include lib files
  # include generators
  # include js defaults
end

#cucumberObject



75
76
77
# File 'lib/echo_base.rb', line 75

def cucumber
  run 'rails g cucumber:install'
end

#deviseObject



62
63
64
65
# File 'lib/echo_base.rb', line 62

def devise
  #run devise generator
  #update devise file?
end

#doneObject



98
99
100
# File 'lib/echo_base.rb', line 98

def done
  say "all done"
end

#dot_filesObject



57
58
59
60
# File 'lib/echo_base.rb', line 57

def dot_files
  copy_file 'gitignore', "#{app_path}/.gitignore", :force => true
  #rvmrc
end

#gemfileObject



31
32
33
# File 'lib/echo_base.rb', line 31

def gemfile
  copy_file 'Gemfile', "#{app_path}/Gemfile", :force => true
end

#generate_rails_appObject



22
23
24
25
# File 'lib/echo_base.rb', line 22

def generate_rails_app
  invoke Rails::Generators::AppGenerator
  inject_into_file "#{app_path}/config/routes.rb", "resources :users\n\tmatch '/auth/:provider/callback', :to => 'sessions#create'\n\troot :to => 'users#index'", :after => "Application.routes.draw do\n"
end

#gitObject



90
91
92
93
94
95
96
# File 'lib/echo_base.rb', line 90

def git
  begin
    run 'git init;git add .;git commit -a -m "Initial Commit"'
  rescue
    say "Git fail"
  end
end

#herokuObject



79
80
81
82
83
# File 'lib/echo_base.rb', line 79

def heroku
  # heroku create
  # heroku addons add
  # 
end

#migrationsObject



47
48
49
50
51
# File 'lib/echo_base.rb', line 47

def migrations
  directory 'db', "#{app_path}/db", :force => true
  run 'rake db:create:all'
  run 'rake db:migrate'
end

#publicObject



53
54
55
# File 'lib/echo_base.rb', line 53

def public
  directory 'public', "#{app_path}/public", :force => true
end

#rspecObject



71
72
73
# File 'lib/echo_base.rb', line 71

def rspec
  run 'rails g rspec:install'
end

#subdomainsObject



67
68
69
# File 'lib/echo_base.rb', line 67

def subdomains
  
end