Sha256: 73e8890fbe40250ff824bcc16406b12032f50e7514c99bdaab7b3c447ee93693

Contents?: true

Size: 1.81 KB

Versions: 3

Compression:

Stored size: 1.81 KB

Contents

# Rails template to build the sample app for specs

generate :model, 'author name:string{10}:uniq last_name:string birthday:date'
generate :model, 'post title:string:uniq body:text author:references'

#Add validation
inject_into_file "app/models/author.rb", "  validates_presence_of :name\n  validates_uniqueness_of :last_name\n", after: "Base\n"
inject_into_file "app/models/post.rb", "   validates_presence_of :author\n", after: ":author\n"

# Configure default_url_options in test environment
inject_into_file "config/environments/test.rb", "  config.action_mailer.default_url_options = { :host => 'example.com' }\n", after: "config.cache_classes = true\n"

# Add our local Active Admin to the load path
inject_into_file "config/environment.rb",
                 "\n$LOAD_PATH.unshift('#{File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'lib'))}')\nrequire \"active_admin\"\n",
                 after: "require File.expand_path('../application', __FILE__)"

run "rm Gemfile"

$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))

generate :'active_admin:install --skip-users'
generate :'formtastic:install'

# Initialize plugin
inject_into_file "config/initializers/active_admin.rb",
                 "  config.before_action do\n    left_sidebar!(collapsed: true) if respond_to?(:left_sidebar!)\n  end\n\n",
                 after: "ActiveAdmin.setup do |config|\n"

inject_into_file "app/assets/stylesheets/active_admin.scss",
                 "@import \"active_admin_sidebar\";\n",
                 after: "@import \"active_admin/base\";\n"

inject_into_file "app/assets/javascripts/active_admin.js.coffee",
                 "#= require active_admin_sidebar\n",
                 after: "#= require active_admin/base\n"

run "rm -r test"
run "rm -r spec"

route "root :to => 'admin/dashboard#index'"

rake "db:migrate"

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
active_admin_sidebar-1.2.0 spec/support/rails_template.rb
active_admin_sidebar-1.1.0 spec/support/rails_template.rb
active_admin_sidebar-1.0.0 spec/support/rails_template.rb