Class: RelevanceFileGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/relevance_file/relevance_file_generator.rb

Instance Method Summary collapse

Instance Method Details

#copy_gemfileObject



11
12
13
# File 'lib/generators/relevance_file/relevance_file_generator.rb', line 11

def copy_gemfile
  template "Gemfile.erb", "Gemfile"
end

#copy_spec_helperObject



33
34
35
# File 'lib/generators/relevance_file/relevance_file_generator.rb', line 33

def copy_spec_helper
  copy_file 'spec_helper.rb', 'spec/spec_helper.rb'
end

#create_application_layoutObject



19
20
21
# File 'lib/generators/relevance_file/relevance_file_generator.rb', line 19

def create_application_layout
  template 'application.html.haml.erb', 'app/views/layouts/application.html.haml'
end

#create_database_example_ymlObject



37
38
39
40
41
42
43
44
45
# File 'lib/generators/relevance_file/relevance_file_generator.rb', line 37

def create_database_example_yml
  if database == 'mysql'
    template 'database.example.yml.mysql.erb', 'config/database.example.yml'
  elsif database == 'postgresql'
    template 'database.example.yml.postgresql.erb', 'config/database.example.yml'
  else
    create_file 'database.example.yml', "Don't know how to make a template for database: #{database}"
  end
end

#create_readme_markdownObject



15
16
17
# File 'lib/generators/relevance_file/relevance_file_generator.rb', line 15

def create_readme_markdown
  template "README.markdown.erb", "README.markdown"
end

#create_rspecObject



29
30
31
# File 'lib/generators/relevance_file/relevance_file_generator.rb', line 29

def create_rspec
  create_file '.rspec', '--colour'
end

#create_rvmrcObject



23
24
25
26
27
# File 'lib/generators/relevance_file/relevance_file_generator.rb', line 23

def create_rvmrc
  if ENV['rvm_path']
    create_file ".rvmrc", "rvm use #{RelevanceRails.ruby_version}@#{name}"
  end
end

#fix_session_storeObject



47
48
49
# File 'lib/generators/relevance_file/relevance_file_generator.rb', line 47

def fix_session_store
  gsub_file 'config/initializers/session_store.rb', 'key:', ':key =>'
end

#fix_wrap_parametersObject



51
52
53
# File 'lib/generators/relevance_file/relevance_file_generator.rb', line 51

def fix_wrap_parameters
  gsub_file 'config/initializers/wrap_parameters.rb', 'format:', ':format =>'
end