Class: Cardio::Generators::Deck::DeckGenerator
Overview
Create new Decks (Decko Applications)
Class Method Summary
collapse
Instance Method Summary
collapse
banner, banner_command, namespace, source_root
Class Method Details
.banner ⇒ Object
52
53
54
|
# File 'lib/generators/deck/deck_generator.rb', line 52
def self.banner
"#{banner_command} new #{arguments.map(&:usage).join(' ')} [options]"
end
|
.databases ⇒ Object
19
20
21
|
# File 'lib/generators/deck/deck_generator.rb', line 19
def self.databases
Rails::Generators::Database::DATABASES.join "/"
end
|
Instance Method Details
#config ⇒ Object
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
# File 'lib/generators/deck/deck_generator.rb', line 80
def config
inside "config" do
erb_template "application.rb"
erb_template "routes.rb"
erb_template "environment.rb"
erb_template "boot.rb"
template "databases/#{options[:database]}.yml", "database.yml"
template "cucumber.yml"
template "storage.yml"
template "puma.rb"
end
end
|
#core_files ⇒ Object
Generator works its way through each public method below
58
59
60
61
62
63
64
65
66
67
|
# File 'lib/generators/deck/deck_generator.rb', line 58
def core_files
erb_template "config.ru"
erb_template "Gemfile"
erb_template "Rakefile"
end
|
#dotfiles ⇒ Object
73
74
75
76
77
78
|
# File 'lib/generators/deck/deck_generator.rb', line 73
def dotfiles
copy_file "pryrc", ".pryrc"
copy_file "gitignore", ".gitignore"
template "rspec.erb", ".rspec"
template "simplecov.rb.erb", ".simplecov"
end
|
#empty_dirs ⇒ Object
69
70
71
|
# File 'lib/generators/deck/deck_generator.rb', line 69
def empty_dirs
%w[mod log files tmp].each { |dirname| empty_directory_with_keep_file dirname }
end
|
#public ⇒ Object
95
96
97
98
99
100
|
# File 'lib/generators/deck/deck_generator.rb', line 95
def public
inside "public" do
template "robots.txt"
inside("files") { template "htaccess", ".htaccess" }
end
end
|
#script ⇒ Object
106
107
108
109
|
# File 'lib/generators/deck/deck_generator.rb', line 106
def script
directory("script") { |content| "#{shebang}\n" + content }
chmod "script", 0o755 & ~File.umask, verbose: false
end
|
#seed_data ⇒ Object
124
125
126
127
128
129
130
131
132
133
134
|
# File 'lib/generators/deck/deck_generator.rb', line 124
def seed_data
if options["interactive"]
Interactive.new(destination_root, (monkey? || platypus?)).run
else
prefix = "bundle exec " if options["platypus"]
puts "Now:
1. Run `cd #{File.basename(destination_root)}` to enter your new deck directory
2. Run `#{prefix}decko setup` to seed your database (see config/database.yml).
3. Run `#{prefix}decko server` to start your server"
end
end
|
#spec ⇒ Object
111
112
113
114
115
116
117
118
119
120
|
# File 'lib/generators/deck/deck_generator.rb', line 111
def spec
inside "spec" do
if platypus?
jasmine_yml :decko
else
jasmine_yml :deck
template "spec_helper.rb"
end
end
end
|
#spring ⇒ Object
102
103
104
|
# File 'lib/generators/deck/deck_generator.rb', line 102
def spring
inside("bin") { erb_template "spring" }
end
|