<commit_before># ap-system.rb - Rails Application Template with AP System rules
# Copyright (C) 2011 - <NAME> <<EMAIL>>, <NAME> <<EMAIL>> and <NAME> <<EMAIL>>
#
# ap-system.rb is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

#
# Usage:
#   rails new myapp -T -J -m https://gist.github.com/raw/7a589bdb00721f5b339f/ap-system.rb
#

# custom generators and templates overrides
say_status("fetching", "custom generators and templates overrides", :green)
inside('lib') do
  run('git clone git://github.com/lguardiola/generators.git')
  remove_dir('generators/.git')
end
empty_directory('lib/templates/rails/scaffold_controller')
get('https://gist.github.com/raw/7a589bdb00721f5b339f/controller.rb', 'lib/templates/rails/scaffold_controller/controller.rb')

empty_directory('lib/templates/haml/scaffold')
%w(edit.html.haml  _form.html.haml  index.html.haml  new.html.haml  show.html.haml).each do |template|
  get("https://gist.github.com/raw/7a589bdb00721f5b339f/#{template}", "lib/templates/haml/scaffold/#{template}")
end

# design
say_status("design", "turn off scaffold stylesheets generate", :green)
application do
  %Q(
    # turn off scaffold stylesheets generate
    config.generators do |generator|
      generator.stylesheets false
    end
  )
end
say_status("design", "add gems", :green)
gem 'haml-rails'
gem 'hpricot', :group => [:development, :test]
gem 'ruby_parser', :group => [:development, :test]
say_status("design", "add compass without integration", :green)
gem 'compass', :group => [:development, :test]
#TODO: run compass to create config files

say_status("design", "replace erb template engine system to haml", :green)
remove_file('app/views/layouts/application.html.erb')
get('https://gist.github.com/raw/7a589bdb00721f5b339f/application.html.haml', 'app/views/layouts/application.html.haml')
say_status("design", "add shared view folders for common partials", :green)
empty_directory_with_gitkeep('app/views/shared')

# timezone
application("config.time_zone = 'Buenos Aires'")

if yes?('Would you like to manage forms with simple_form?')
  gem 'simple_form'
  run('bundle install')
  generate('simple_form:install')
end<commit_msg>upgrade urls to fetch dependences<commit_after># This file is part of rails-templates (https://github.com/apslab/rails-templates) - application template and various custom templates to overrides generals rails generators
# Copyright (C) 2011 - <NAME> <<EMAIL>>, <NAME> <<EMAIL>> and <NAME> <<EMAIL>>
#
# rails-templates is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

#
# Usage:
#   rails new myapp -T -J -m https://github.com/apslab/rails-templates/raw/master/apslabs.rb
#

# custom generators and templates overrides
say_status("fetching", "custom generators and templates overrides", :green)
inside('lib') do
  run('git clone git://github.com/apslab/generators.git')
  remove_dir('generators/.git')

  run('git clone -b templates git://github.com/apslab/rails-templates.git templates')
  remove_dir('templates/.git')
end

# design
say_status("design", "turn off scaffold stylesheets generate", :green)
application do
  %Q(
    # turn off scaffold stylesheets generate
    config.generators do |generator|
      generator.stylesheets false
    end
  )
end
say_status("design", "add gems", :green)
gem 'haml-rails'
gem 'hpricot', :group => [:development, :test]
gem 'ruby_parser', :group => [:development, :test]
say_status("design", "add compass without integration", :green)
gem 'compass', :group => [:development, :test]
#TODO: run compass to create config files

say_status("design", "replace erb template engine system to haml", :green)
remove_file('app/views/layouts/application.html.erb')
get('https://github.com/apslab/rails-templates/raw/assets/views/layouts/application.html.haml', 'app/views/layouts/application.html.haml')
say_status("design", "add shared view folders for common partials", :green)
empty_directory_with_gitkeep('app/views/shared')

# timezone
application("config.time_zone = 'Buenos Aires'")

if yes?('Would you like to manage forms with simple_form?')
  gem 'simple_form'
  run('bundle install')
  generate('simple_form:install')
end
{'fraction_non_alphanumeric': 0.12283018867924528, 'fraction_numerical': 0.01169811320754717, 'mean_word_length': 5.1496519721577725, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 29, 'https://': 7, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6012053', 'n_tokens_mistral': 1692, 'n_tokens_neox': 1596, 'n_words': 524}