From c4da36f517aa67df3f369842e3df70be75dc4863 Mon Sep 17 00:00:00 2001 From: Onur Ozgur OZKAN Date: Thu, 5 Sep 2013 14:42:08 +0300 Subject: [PATCH] #81 add .editorconfig file --- Gemfile.lock | 12 +++++----- lib/cybele/app_builder.rb | 4 ++++ lib/cybele/generators/app_generator.rb | 6 +++++ templates/editorconfig | 31 ++++++++++++++++++++++++++ 4 files changed, 47 insertions(+), 6 deletions(-) create mode 100644 templates/editorconfig diff --git a/Gemfile.lock b/Gemfile.lock index 203d06f..d50a8fc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - cybele (0.7.0) + cybele (0.9.0) bundler (~> 1.3) rails (~> 4.0.0) @@ -33,17 +33,17 @@ GEM thread_safe (~> 0.1) tzinfo (~> 0.3.37) arel (4.0.0) - atomic (1.1.10) + atomic (1.1.13) builder (3.1.4) erubis (2.7.0) hike (1.2.3) - i18n (0.6.4) + i18n (0.6.5) mail (2.5.4) mime-types (~> 1.16) treetop (~> 1.4.8) - mime-types (1.23) + mime-types (1.25) minitest (4.7.5) - multi_json (1.7.7) + multi_json (1.7.9) polyglot (0.3.3) rack (1.5.2) rack-test (0.6.2) @@ -75,7 +75,7 @@ GEM thread_safe (0.1.2) atomic tilt (1.4.1) - treetop (1.4.14) + treetop (1.4.15) polyglot polyglot (>= 0.3.1) tzinfo (0.3.37) diff --git a/lib/cybele/app_builder.rb b/lib/cybele/app_builder.rb index 7916c3a..e211d69 100644 --- a/lib/cybele/app_builder.rb +++ b/lib/cybele/app_builder.rb @@ -15,6 +15,10 @@ def replace_gemfile copy_file 'cybele_Gemfile', 'Gemfile' end + def add_editorconfig + copy_file 'editorconfig', '.editorconfig' + end + def replace_application_rb_file remove_file 'config/application.rb' copy_file 'config/application.rb', 'config/application.rb' diff --git a/lib/cybele/generators/app_generator.rb b/lib/cybele/generators/app_generator.rb index c011f9a..4f356de 100644 --- a/lib/cybele/generators/app_generator.rb +++ b/lib/cybele/generators/app_generator.rb @@ -18,6 +18,7 @@ def finish_template def customization invoke :customize_gemfile + invoke :setup_editorconfig invoke :setup_database invoke :remove_files_we_dont_need invoke :replace_files @@ -40,6 +41,11 @@ def customize_gemfile bundle_command 'install --binstubs=bin/stubs' end + def setup_editorconfig + say 'Add .editorconfig file' + build :add_editorconfig + end + def remove_files_we_dont_need say 'Remove files we don\'t need' build :remove_readme_rdoc diff --git a/templates/editorconfig b/templates/editorconfig new file mode 100644 index 0000000..8beef20 --- /dev/null +++ b/templates/editorconfig @@ -0,0 +1,31 @@ +; This file is for unifying the coding style for different editors and IDEs. +; More information at http://EditorConfig.org + +root = true + +; Use 2 spaces for indentation in all Ruby files + +[*.rb] +indent_style = space +indent_size = 2 + +[Rakefile] +indent_style = space +indent_size = 2 + +[Gemfile*] +indent_style = space +indent_size = 2 + +[config.ru] +indent_style = space +indent_size = 2 + +# Tab indentation (no size specified) +[*.js] +indent_style = space + +# Indentation override for all JS under lib directory +[lib/**.js] +indent_style = space +indent_size = 2 \ No newline at end of file