Class: Topkit::AppBuilder
- Inherits:
-
Rails::AppBuilder
- Object
- Rails::AppBuilder
- Topkit::AppBuilder
show all
- Includes:
- Actions
- Defined in:
- lib/topkit/app_builder.rb
Instance Method Summary
collapse
Methods included from Actions
#action_mailer_host, #concat_file, #configure_environment, #download_file, #replace_in_file
Instance Method Details
#add_to_git_ignore ⇒ Object
107
108
109
|
# File 'lib/topkit/app_builder.rb', line 107
def add_to_git_ignore
concat_file 'topkit_gitignore', '.gitignore'
end
|
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/topkit/app_builder.rb', line 5
def configure_rspec_generators
config = "config.generators do |g|\n g.fixture true\n g.fixture_replacement \"factory_girl\"\n g.assets false\n g.test_framework :rspec\n g.view_specs false\n g.controller_specs false\n g.helper_specs false\n g.routing_specs false\n g.request_specs false\n g.stylesheets false\nend\n\n RUBY\n\n inject_into_class 'config/application.rb', 'Application', config\nend\n"
|
#create_application_layout ⇒ Object
62
63
64
65
|
# File 'lib/topkit/app_builder.rb', line 62
def create_application_layout
remove_file "app/views/layouts/application.html.erb"
copy_file "application_layout.html.erb", "app/views/layouts/application.html.erb", force: true
end
|
#create_database ⇒ Object
34
35
36
|
# File 'lib/topkit/app_builder.rb', line 34
def create_database
bundle_command "exec rake db:create"
end
|
#create_partials_directory ⇒ Object
52
53
54
|
# File 'lib/topkit/app_builder.rb', line 52
def create_partials_directory
empty_directory 'app/views/application'
end
|
#create_status_partials ⇒ Object
56
57
58
59
60
|
# File 'lib/topkit/app_builder.rb', line 56
def create_status_partials
copy_file '_status.html.erb', 'app/views/application/_status.html.erb'
copy_file '_header.html.erb', 'app/views/application/_header.html.erb'
copy_file '_footer.html.erb', 'app/views/application/_footer.html.erb'
end
|
#enable_database_cleaner ⇒ Object
79
80
81
82
83
84
85
|
# File 'lib/topkit/app_builder.rb', line 79
def enable_database_cleaner
replace_in_file 'spec/spec_helper.rb',
'config.use_transactional_fixtures = true',
'config.use_transactional_fixtures = false'
copy_file 'database_cleaner_rspec.rb', 'spec/support/database_cleaner.rb'
end
|
#generate_backbone ⇒ Object
71
72
73
|
# File 'lib/topkit/app_builder.rb', line 71
def generate_backbone
generate "backbone:install"
end
|
#generate_backtrace ⇒ Object
75
76
77
|
# File 'lib/topkit/app_builder.rb', line 75
def generate_backtrace
download_file "https://gist.github.com/apcomplete/4113645/download", "vendor/assets/javascripts/backtrace.js"
end
|
#generate_cucumber ⇒ Object
99
100
101
|
# File 'lib/topkit/app_builder.rb', line 99
def generate_cucumber
generate 'cucumber:install', '--rspec', '--capybara'
end
|
#generate_devise ⇒ Object
92
93
94
95
96
97
|
# File 'lib/topkit/app_builder.rb', line 92
def generate_devise
generate "devise:install"
generate "devise User"
bundle_command "exec rake db:migrate"
generate "devise:views"
end
|
#generate_rspec ⇒ Object
67
68
69
|
# File 'lib/topkit/app_builder.rb', line 67
def generate_rspec
generate 'rspec:install'
end
|
#init_git ⇒ Object
103
104
105
|
# File 'lib/topkit/app_builder.rb', line 103
def init_git
run 'git init'
end
|
#remove_public_index ⇒ Object
38
39
40
|
# File 'lib/topkit/app_builder.rb', line 38
def remove_public_index
remove_file 'public/index.html'
end
|
#remove_rails_logo_image ⇒ Object
42
43
44
|
# File 'lib/topkit/app_builder.rb', line 42
def remove_rails_logo_image
remove_file 'app/assets/images/rails.png'
end
|
46
47
48
49
50
|
# File 'lib/topkit/app_builder.rb', line 46
def
replace_in_file 'config/routes.rb',
/Application\.routes\.draw do.*end/m,
"Application.routes.draw do\nend"
end
|
#replace_gemfile ⇒ Object
25
26
27
28
|
# File 'lib/topkit/app_builder.rb', line 25
def replace_gemfile
remove_file 'Gemfile'
copy_file 'Gemfile_clean', 'Gemfile'
end
|
#setup_stylesheets ⇒ Object
87
88
89
90
|
# File 'lib/topkit/app_builder.rb', line 87
def setup_stylesheets
remove_file 'app/assets/stylesheets/application.css'
create_file 'app/assets/stylesheets/application.css.scss'
end
|
#template_database_file ⇒ Object
30
31
32
|
# File 'lib/topkit/app_builder.rb', line 30
def template_database_file
template 'database.pg.yml.erb', 'config/database.yml', force: true
end
|