appyantra_admin 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -0
- data/Gemfile +24 -0
- data/MIT-LICENSE +20 -0
- data/README.md +101 -0
- data/Rakefile +26 -0
- data/app/assets/images/appyantra_admin/.gitkeep +0 -0
- data/app/assets/images/appyantra_admin/breadcrumb_divider.png +0 -0
- data/app/assets/images/appyantra_admin/btn_submit.png +0 -0
- data/app/assets/images/appyantra_admin/btn_submit_2.png +0 -0
- data/app/assets/images/appyantra_admin/btn_view_site.png +0 -0
- data/app/assets/images/appyantra_admin/header_bg.png +0 -0
- data/app/assets/images/appyantra_admin/header_shadow.png +0 -0
- data/app/assets/images/appyantra_admin/icn_add_user.png +0 -0
- data/app/assets/images/appyantra_admin/icn_alert_error.png +0 -0
- data/app/assets/images/appyantra_admin/icn_alert_info.png +0 -0
- data/app/assets/images/appyantra_admin/icn_alert_success.png +0 -0
- data/app/assets/images/appyantra_admin/icn_alert_warning.png +0 -0
- data/app/assets/images/appyantra_admin/icn_audio.png +0 -0
- data/app/assets/images/appyantra_admin/icn_categories.png +0 -0
- data/app/assets/images/appyantra_admin/icn_edit.png +0 -0
- data/app/assets/images/appyantra_admin/icn_edit_article.png +0 -0
- data/app/assets/images/appyantra_admin/icn_folder.png +0 -0
- data/app/assets/images/appyantra_admin/icn_jump_back.png +0 -0
- data/app/assets/images/appyantra_admin/icn_logout.png +0 -0
- data/app/assets/images/appyantra_admin/icn_new_article.png +0 -0
- data/app/assets/images/appyantra_admin/icn_photo.png +0 -0
- data/app/assets/images/appyantra_admin/icn_profile.png +0 -0
- data/app/assets/images/appyantra_admin/icn_search.png +0 -0
- data/app/assets/images/appyantra_admin/icn_security.png +0 -0
- data/app/assets/images/appyantra_admin/icn_settings.png +0 -0
- data/app/assets/images/appyantra_admin/icn_tags.png +0 -0
- data/app/assets/images/appyantra_admin/icn_trash.png +0 -0
- data/app/assets/images/appyantra_admin/icn_user.png +0 -0
- data/app/assets/images/appyantra_admin/icn_video.png +0 -0
- data/app/assets/images/appyantra_admin/icn_view_users.png +0 -0
- data/app/assets/images/appyantra_admin/module_footer_bg.png +0 -0
- data/app/assets/images/appyantra_admin/post_message.png +0 -0
- data/app/assets/images/appyantra_admin/secondary_bar.png +0 -0
- data/app/assets/images/appyantra_admin/secondary_bar_shadow.png +0 -0
- data/app/assets/images/appyantra_admin/sidebar.png +0 -0
- data/app/assets/images/appyantra_admin/sidebar_divider.png +0 -0
- data/app/assets/images/appyantra_admin/sidebar_shadow.png +0 -0
- data/app/assets/images/appyantra_admin/table_sorter_header.png +0 -0
- data/app/assets/images/appyantra_admin/trash.png +0 -0
- data/app/assets/images/appyantra_admin/view.png +0 -0
- data/app/assets/images/website/600x300.gif +0 -0
- data/app/assets/images/website/alert-overlay.png +0 -0
- data/app/assets/images/website/bg.png +0 -0
- data/app/assets/images/website/link_bg.png +0 -0
- data/app/assets/images/website/link_border.png +0 -0
- data/app/assets/images/website/place_holder_img.png +0 -0
- data/app/assets/images/website/triangle.gif +0 -0
- data/app/assets/javascripts/appyantra_admin/admin_settings.js.coffee +3 -0
- data/app/assets/javascripts/appyantra_admin/admins/profiles.js.coffee +3 -0
- data/app/assets/javascripts/appyantra_admin/application.js +9 -0
- data/app/assets/javascripts/appyantra_admin/hideshow.js +39 -0
- data/app/assets/javascripts/appyantra_admin/home.js.coffee +3 -0
- data/app/assets/javascripts/appyantra_admin/jquery-1.5.2.min.js +16 -0
- data/app/assets/javascripts/appyantra_admin/jquery.equalHeight.js +20 -0
- data/app/assets/javascripts/appyantra_admin/jquery.tablesorter.min.js +4 -0
- data/app/assets/javascripts/appyantra_admin/managed_models.js.coffee +7 -0
- data/app/assets/javascripts/website/application.js +8 -0
- data/app/assets/javascripts/website/ie/DD_belatedPNG_0.0.8a-min.js +13 -0
- data/app/assets/javascripts/website/jquery.easing.1.3.js +205 -0
- data/app/assets/javascripts/website/jquery.roundabout-1.0.min.js +41 -0
- data/app/assets/javascripts/website/jquery.roundabout-shapes-1.1.js +150 -0
- data/app/assets/stylesheets/appyantra_admin/admin_settings.css.scss +3 -0
- data/app/assets/stylesheets/appyantra_admin/admins/profiles.css.scss +3 -0
- data/app/assets/stylesheets/appyantra_admin/application.css +7 -0
- data/app/assets/stylesheets/appyantra_admin/ie/ie.css +43 -0
- data/app/assets/stylesheets/appyantra_admin/main.css +1191 -0
- data/app/assets/stylesheets/appyantra_admin/managed_models.css.scss +3 -0
- data/app/assets/stylesheets/website/application.css +7 -0
- data/app/assets/stylesheets/website/reset.css +53 -0
- data/app/assets/stylesheets/website/styles.css +889 -0
- data/app/controllers/appyantra_admin/admin_settings_controller.rb +101 -0
- data/app/controllers/appyantra_admin/application_controller.rb +30 -0
- data/app/controllers/appyantra_admin/assets_controller.rb +91 -0
- data/app/controllers/appyantra_admin/home_controller.rb +24 -0
- data/app/controllers/appyantra_admin/pages_controller.rb +123 -0
- data/app/controllers/appyantra_admin/passwords_controller.rb +28 -0
- data/app/controllers/appyantra_admin/profiles_controller.rb +94 -0
- data/app/controllers/appyantra_admin/sessions_controller.rb +20 -0
- data/app/controllers/appyantra_admin/users/confirmations_controller.rb +15 -0
- data/app/controllers/appyantra_admin/users/passwords_controller.rb +16 -0
- data/app/controllers/appyantra_admin/users/registrations_controller.rb +16 -0
- data/app/controllers/appyantra_admin/users/sessions_controller.rb +15 -0
- data/app/controllers/appyantra_admin/users/user_paths.rb +33 -0
- data/app/controllers/appyantra_admin/users_controller.rb +92 -0
- data/app/helpers/appyantra_admin/admin_settings_helper.rb +9 -0
- data/app/helpers/appyantra_admin/application_helper.rb +73 -0
- data/app/helpers/appyantra_admin/pages_helper.rb +38 -0
- data/app/models/activity_feed.rb +5 -0
- data/app/models/activity_log_observer.rb +58 -0
- data/app/models/admin.rb +11 -0
- data/app/models/admin_setting.rb +74 -0
- data/app/models/encrypted_text.rb +20 -0
- data/app/models/link.rb +5 -0
- data/app/models/page.rb +24 -0
- data/app/models/page_keyword.rb +4 -0
- data/app/models/person.rb +14 -0
- data/app/models/short_text.rb +23 -0
- data/app/models/text.rb +11 -0
- data/app/models/user.rb +11 -0
- data/app/sweepers/appyantra_admin/pages_sweeper.rb +20 -0
- data/app/views/appyantra_admin/admin_settings/edit.html.haml +7 -0
- data/app/views/appyantra_admin/admin_settings/index.html.haml +56 -0
- data/app/views/appyantra_admin/admin_settings/mail_settings.html.haml +7 -0
- data/app/views/appyantra_admin/admin_settings/new.html.haml +7 -0
- data/app/views/appyantra_admin/assets/display.js.haml +3 -0
- data/app/views/appyantra_admin/assets/edit.html.haml +7 -0
- data/app/views/appyantra_admin/assets/new.html.haml +7 -0
- data/app/views/appyantra_admin/assets/show.html.haml +55 -0
- data/app/views/appyantra_admin/home/index.html.haml +74 -0
- data/app/views/appyantra_admin/mailer/reset_password_instructions.html.haml +6 -0
- data/app/views/appyantra_admin/mailer/unlock_instructions.html.haml +6 -0
- data/app/views/appyantra_admin/pages/_form.html.haml +40 -0
- data/app/views/appyantra_admin/pages/_page.html.haml +43 -0
- data/app/views/appyantra_admin/pages/edit.html.haml +19 -0
- data/app/views/appyantra_admin/pages/index.html.haml +46 -0
- data/app/views/appyantra_admin/pages/new.html.haml +7 -0
- data/app/views/appyantra_admin/pages/show.html.haml +1 -0
- data/app/views/appyantra_admin/passwords/edit.html.haml +15 -0
- data/app/views/appyantra_admin/passwords/new.html.haml +11 -0
- data/app/views/appyantra_admin/profiles/_admin_profile_form.html.haml +12 -0
- data/app/views/appyantra_admin/profiles/_admin_user.html.haml +11 -0
- data/app/views/appyantra_admin/profiles/edit.html.haml +18 -0
- data/app/views/appyantra_admin/profiles/index.html.haml +51 -0
- data/app/views/appyantra_admin/profiles/new.html.haml +6 -0
- data/app/views/appyantra_admin/profiles/show.html.haml +10 -0
- data/app/views/appyantra_admin/profiles/show.js.haml +3 -0
- data/app/views/appyantra_admin/sessions/new.html.haml +17 -0
- data/app/views/appyantra_admin/shared/_asset_item.html.haml +15 -0
- data/app/views/appyantra_admin/shared/_assets_list.html.haml +6 -0
- data/app/views/appyantra_admin/shared/_formtastic_semantic_form.html.haml +3 -0
- data/app/views/appyantra_admin/shared/_hash_form.html.haml +7 -0
- data/app/views/appyantra_admin/shared/_links.haml +6 -0
- data/app/views/appyantra_admin/shared/types/_encrypted_text.html.haml +1 -0
- data/app/views/appyantra_admin/shared/types/_link.html.haml +1 -0
- data/app/views/appyantra_admin/shared/types/_short_text.html.haml +1 -0
- data/app/views/appyantra_admin/shared/types/_text.html.haml +1 -0
- data/app/views/appyantra_admin/unlocks/new.html.haml +10 -0
- data/app/views/appyantra_admin/users/_form.html.haml +12 -0
- data/app/views/appyantra_admin/users/_user.html.haml +11 -0
- data/app/views/appyantra_admin/users/edit.html.haml +18 -0
- data/app/views/appyantra_admin/users/index.html.haml +54 -0
- data/app/views/appyantra_admin/users/new.html.haml +6 -0
- data/app/views/appyantra_admin/users/show.html.haml +10 -0
- data/app/views/appyantra_admin/users/show.js.haml +3 -0
- data/app/views/layouts/application.html.haml +98 -0
- data/app/views/layouts/appyantra_admin/application.html.haml +106 -0
- data/app/views/layouts/appyantra_admin/landing_page.html.haml +30 -0
- data/app/views/layouts/appyantra_admin/website.html.haml +96 -0
- data/app/views/pages/_google_analytics.html.haml +11 -0
- data/app/views/pages/_meta_tags.html.haml +2 -0
- data/app/views/pages/page.html.haml +4 -0
- data/app/views/users/confirmations/new.html.haml +26 -0
- data/app/views/users/mailer/confirmation_instructions.html.haml +4 -0
- data/app/views/users/mailer/reset_password_instructions.html.haml +6 -0
- data/app/views/users/mailer/unlock_instructions.html.haml +5 -0
- data/app/views/users/passwords/edit.html.haml +31 -0
- data/app/views/users/passwords/new.html.haml +22 -0
- data/app/views/users/registrations/edit.html.haml +42 -0
- data/app/views/users/registrations/new.html.haml +35 -0
- data/app/views/users/sessions/new.html.haml +26 -0
- data/app/views/website/index.html.haml +50 -0
- data/appyantra_admin.gemspec +24 -0
- data/config/initializers/devise.rb +209 -0
- data/config/initializers/formtastic.rb +82 -0
- data/config/initializers/mail_settings.rb +11 -0
- data/config/initializers/secret_token.rb +7 -0
- data/config/initializers/session_store.rb +8 -0
- data/config/initializers/wrap_parameters.rb +14 -0
- data/config/routes.rb +71 -0
- data/db/migrate/20120123093508_create_links.rb +15 -0
- data/db/migrate/20120123093916_create_texts.rb +10 -0
- data/db/migrate/20120123094124_create_admin_settings.rb +12 -0
- data/db/migrate/20120124202814_devise_create_admins.rb +25 -0
- data/db/migrate/20120125093505_add_name_to_admins.rb +6 -0
- data/db/migrate/20120217075442_devise_create_users.rb +25 -0
- data/db/migrate/20120217090326_add_name_to_users.rb +6 -0
- data/db/migrate/20120224210009_create_pages.rb +19 -0
- data/db/migrate/20120302084134_add_group_to_admin_settings.rb +5 -0
- data/db/migrate/20120309075847_create_encrypted_texts.rb +10 -0
- data/db/migrate/20120309075904_create_short_texts.rb +10 -0
- data/db/migrate/20120312234850_add_seo_to_pages.rb +5 -0
- data/db/migrate/20120312235235_create_keywords.rb +10 -0
- data/db/migrate/20120314063338_create_activity_feeds.rb +15 -0
- data/lib/appyantra_admin.rb +49 -0
- data/lib/appyantra_admin/crypto.rb +43 -0
- data/lib/appyantra_admin/engine.rb +17 -0
- data/lib/appyantra_admin/utils.rb +27 -0
- data/lib/appyantra_admin/version.rb +3 -0
- data/lib/generators/appyantra_admin/install/USAGE +8 -0
- data/lib/generators/appyantra_admin/install/install_generator.rb +34 -0
- data/lib/generators/appyantra_admin/install/templates/appyantra_admin.rb +28 -0
- data/lib/tasks/appyantra_admin_tasks.rake +47 -0
- data/script/rails +6 -0
- data/test/dummy/.gitignore +36 -0
- data/test/dummy/.rspec +1 -0
- data/test/dummy/Gemfile +43 -0
- data/test/dummy/Guardfile +19 -0
- data/test/dummy/README +261 -0
- data/test/dummy/Rakefile +8 -0
- data/test/dummy/app/assets/javascripts/application.js +9 -0
- data/test/dummy/app/assets/stylesheets/application.css +7 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/models/product.rb +2 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +48 -0
- data/test/dummy/config/boot.rb +6 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +30 -0
- data/test/dummy/config/environments/production.rb +60 -0
- data/test/dummy/config/environments/test.rb +39 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +10 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +4 -0
- data/test/dummy/db/migrate/20120213070715_create_products.rb +11 -0
- data/test/dummy/db/seeds.rb +7 -0
- data/test/dummy/doc/README_FOR_APP +2 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +26 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/public/robots.txt +5 -0
- data/test/dummy/script/rails +6 -0
- data/test/dummy/spec/controllers/appyantra_admin/admin_settings_controller_spec.rb +56 -0
- data/test/dummy/spec/controllers/appyantra_admin/assets_controller_spec.rb +64 -0
- data/test/dummy/spec/controllers/appyantra_admin/home_controller_spec.rb +28 -0
- data/test/dummy/spec/controllers/appyantra_admin/passwords_controller_spec.rb +40 -0
- data/test/dummy/spec/controllers/appyantra_admin/profiles_controller_spec.rb +88 -0
- data/test/dummy/spec/controllers/appyantra_admin/sessions_controller_spec.rb +32 -0
- data/test/dummy/spec/factories.rb +55 -0
- data/test/dummy/spec/factories/products.rb +9 -0
- data/test/dummy/spec/helpers/appyantra_admin/application_helper_spec.rb +31 -0
- data/test/dummy/spec/models/admin_setting_spec.rb +22 -0
- data/test/dummy/spec/models/admin_spec.rb +10 -0
- data/test/dummy/spec/models/encrypted_text_spec.rb +13 -0
- data/test/dummy/spec/models/link_spec.rb +5 -0
- data/test/dummy/spec/models/text_spec.rb +5 -0
- data/test/dummy/spec/requests/appyantra_admin/admin_user_auth_spec.rb +54 -0
- data/test/dummy/spec/requests/appyantra_admin/dashboard_spec.rb +34 -0
- data/test/dummy/spec/requests/appyantra_admin/mailer_spec.rb +72 -0
- data/test/dummy/spec/requests/appyantra_admin/manage_pages_spec.rb +209 -0
- data/test/dummy/spec/requests/appyantra_admin/manage_website_users_spec.rb +97 -0
- data/test/dummy/spec/requests/appyantra_admin/website_users_spec.rb +25 -0
- data/test/dummy/spec/routing/sessions_routing_spec.rb +11 -0
- data/test/dummy/spec/spec_helper.rb +51 -0
- data/test/dummy/spec/support/capybara.rb +7 -0
- data/test/dummy/spec/support/controller_macros.rb +8 -0
- data/test/dummy/spec/support/integration_macros.rb +40 -0
- data/test/dummy/spec/support/load_routes.rb +5 -0
- data/test/dummy/spec/support/matchers/user_matcher.rb +13 -0
- metadata +428 -0
@@ -0,0 +1,34 @@
|
|
1
|
+
class AppyantraAdmin::InstallGenerator < Rails::Generators::Base
|
2
|
+
source_root File.expand_path('../templates', __FILE__)
|
3
|
+
|
4
|
+
desc "Creates an AppyantraAdmin initializer and copies related files to your application."
|
5
|
+
|
6
|
+
def install
|
7
|
+
#copy_initializer
|
8
|
+
template "appyantra_admin.rb", "config/initializers/appyantra_admin.rb"
|
9
|
+
puts "Copying migrations..."
|
10
|
+
copy_migrations
|
11
|
+
add_appyantra_admin_routes
|
12
|
+
puts "After running the migrations, you need to do the following: "
|
13
|
+
puts "(1) Modify the initializer configurations --> config/initializers/appyantra_admin.rb"
|
14
|
+
puts "(2) Run Migrations"
|
15
|
+
puts "(3) Create an admin user by running:"
|
16
|
+
puts "rake appyantra_admin:create_admin email='EMAIL' first_name='FIRST_NAME' last_name='LAST_NAME'"
|
17
|
+
puts "(4) Create basic application settings by running:"
|
18
|
+
puts "rake appyantra_admin:setup_admin"
|
19
|
+
puts "(5) Delete public/index.html"
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def add_appyantra_admin_routes
|
25
|
+
appyantra_admin_route = %Q{mount AppyantraAdmin::Engine => "/appyantra_admin"}
|
26
|
+
appyantra_admin_route << "\n "
|
27
|
+
appyantra_admin_route << %Q{root :to => 'appyantra_admin/home#website'}
|
28
|
+
route appyantra_admin_route
|
29
|
+
end
|
30
|
+
|
31
|
+
def copy_migrations
|
32
|
+
%x[rake appyantra_admin:install:migrations]
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'appyantra_admin/utils'
|
2
|
+
# Use this hook to configure AppYantra Admin
|
3
|
+
AppyantraAdmin.setup do |config|
|
4
|
+
|
5
|
+
include AppyantraAdmin::Utils
|
6
|
+
|
7
|
+
# specify the model names that can be managed as assets from the Admin dashboard
|
8
|
+
# e.g. config.assets = ['Product']
|
9
|
+
config.assets = []
|
10
|
+
# This phrase is used by the AppyantraAdmin::Crypto library for the AES-256 key
|
11
|
+
AppyantraAdmin::Crypto.key_phrase = 'Dont forget to seal all the doors with salt!'
|
12
|
+
|
13
|
+
|
14
|
+
# By default layouts list is made from haml/erb files in views/layouts
|
15
|
+
# You can over-ride this by specifying your list
|
16
|
+
# e.g. config.page_layouts ['layout1', 'layout2', 'nested_folder/layout3']
|
17
|
+
config.page_layouts = list_page_layouts
|
18
|
+
|
19
|
+
Devise.setup do |config|
|
20
|
+
# ==> Mailer Configuration
|
21
|
+
# Configure the e-mail address which will be shown in Devise::Mailer,
|
22
|
+
# note that it will be overwritten if you use your own mailer class with default "from" parameter.
|
23
|
+
config.mailer_sender = "admin.email@yourdomain.com"
|
24
|
+
end
|
25
|
+
|
26
|
+
# set the html format used for HTML 5 use :html5
|
27
|
+
Haml::Template.options[:format] = :xhtml
|
28
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
namespace :appyantra_admin do
|
2
|
+
|
3
|
+
desc "Creates an admin user"
|
4
|
+
task :create_admin => :environment do
|
5
|
+
user_params = { first_name: ENV['first_name'], last_name: ENV['last_name'], email: ENV['email'] }
|
6
|
+
admin_user = Admin.new(user_params)
|
7
|
+
puts "Enter password"
|
8
|
+
admin_user.password = $stdin.gets.chomp
|
9
|
+
puts "Confirm password"
|
10
|
+
admin_user.password_confirmation = $stdin.gets.chomp
|
11
|
+
admin_user.save(:validate => false)
|
12
|
+
end
|
13
|
+
|
14
|
+
desc "Creates some basic settings"
|
15
|
+
task :setup_admin => :environment do
|
16
|
+
website_url = Link.create(name: 'website_url', text: 'Visit Website',
|
17
|
+
href: '#', title: 'Website URL')
|
18
|
+
site_name = ShortText.create(name: 'site_name', value: 'Acme Company')
|
19
|
+
copyright_year = ShortText.create(name: 'copyright_year', value: Time.now.year.to_s)
|
20
|
+
puts 'Creating Website URL setting...'
|
21
|
+
AdminSetting.create_from_entity(website_url.name, website_url)
|
22
|
+
puts 'Creating Site Name setting...'
|
23
|
+
AdminSetting.create_from_entity(site_name.name, site_name)
|
24
|
+
puts 'Creating Copyright Year setting...'
|
25
|
+
AdminSetting.create_from_entity(copyright_year.name, copyright_year)
|
26
|
+
end
|
27
|
+
|
28
|
+
desc "Adds a setting for Rich Text Editor and defaults it to CKEditor"
|
29
|
+
task :use_rich_text_editor => :environment do
|
30
|
+
rich_text_editor = ShortText.create(name: 'rich_text_editor', value: 'ckeditor')
|
31
|
+
AdminSetting.create_from_entity(rich_text_editor.name, rich_text_editor)
|
32
|
+
end
|
33
|
+
|
34
|
+
desc "Create settings for Google Analytics"
|
35
|
+
task :setup_google_analytics => :environment do
|
36
|
+
unless AdminSetting.exists?(group: 'Google Analytics')
|
37
|
+
tracking_code = ShortText.create(name: 'tracking_code', value: ENV['tracking_code'])
|
38
|
+
domain = ShortText.create(name: 'domain', value: ENV['domain'])
|
39
|
+
puts 'Creating Tracking Code setting...'
|
40
|
+
AdminSetting.create_from_entity(tracking_code.name, tracking_code, 'Google Analytics')
|
41
|
+
puts 'Creating Domain Name setting...'
|
42
|
+
AdminSetting.create_from_entity(domain.name, domain, 'Google Analytics')
|
43
|
+
# clears all the cached pages
|
44
|
+
FileUtils.rm_rf Rails.root.join("public/pages")
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
data/script/rails
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#!/usr/bin/env ruby
|
3
|
+
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
4
|
+
|
5
|
+
ENGINE_PATH = File.expand_path('../..', __FILE__)
|
6
|
+
load File.expand_path('../../test/dummy/script/rails', __FILE__)
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
2
|
+
#
|
3
|
+
# If you find yourself ignoring temporary files generated by your text editor
|
4
|
+
# or operating system, you probably want to add a global ignore instead:
|
5
|
+
# git config --global core.excludesfile ~/.gitignore_global
|
6
|
+
|
7
|
+
app/assets/javascripts/ckeditor
|
8
|
+
|
9
|
+
# Ignore bundler config
|
10
|
+
/.bundle
|
11
|
+
|
12
|
+
# Ignore all logfiles and tempfiles.
|
13
|
+
/log/*.log
|
14
|
+
/tmp
|
15
|
+
config/database.yml
|
16
|
+
db/schema.rb
|
17
|
+
db/migrate/*_create_links.rb
|
18
|
+
db/migrate/*_create_admin_settings.rb
|
19
|
+
db/migrate/*_add_name_to_admins.rb
|
20
|
+
db/migrate/*_create_texts.rb
|
21
|
+
db/migrate/*_devise_create_admins.rb
|
22
|
+
db/migrate/*_devise_create_users.rb
|
23
|
+
db/migrate/*_add_name_to_users.rb
|
24
|
+
db/migrate/*_create_pages.rb
|
25
|
+
db/migrate/*_add_group_to_admin_settings.rb
|
26
|
+
db/migrate/*_create_encrypted_texts.rb
|
27
|
+
db/migrate/*_create_short_texts.rb
|
28
|
+
db/migrate/*_add_seo_to_pages.rb
|
29
|
+
db/migrate/*_create_keywords.rb
|
30
|
+
db/migrate/*_create_activity_feeds.rb
|
31
|
+
|
32
|
+
# will be copied during install
|
33
|
+
config/initializers/appyantra_admin.rb
|
34
|
+
|
35
|
+
# pages
|
36
|
+
public/*/*
|
data/test/dummy/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--colour
|
data/test/dummy/Gemfile
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
source 'http://rubygems.org'
|
2
|
+
|
3
|
+
gem 'rails', '3.1.3'
|
4
|
+
|
5
|
+
# Bundle edge Rails instead:
|
6
|
+
# gem 'rails', :git => 'git://github.com/rails/rails.git'
|
7
|
+
|
8
|
+
group :test, :development do
|
9
|
+
gem 'pg'
|
10
|
+
gem 'appyantra_admin', path: '../../'
|
11
|
+
gem "rspec-rails", "~> 2.8.1"
|
12
|
+
gem "capybara" , "~> 1.1.2"
|
13
|
+
gem "factory_girl_rails"
|
14
|
+
gem "guard-rspec"
|
15
|
+
gem "database_cleaner"
|
16
|
+
end
|
17
|
+
|
18
|
+
# Gems used only for assets and not required
|
19
|
+
# in production environments by default.
|
20
|
+
group :assets do
|
21
|
+
gem 'sass-rails', '~> 3.1.5'
|
22
|
+
gem 'coffee-rails', '~> 3.1.1'
|
23
|
+
gem 'uglifier', '>= 1.0.3'
|
24
|
+
end
|
25
|
+
|
26
|
+
gem 'jquery-rails'
|
27
|
+
|
28
|
+
# To use ActiveModel has_secure_password
|
29
|
+
# gem 'bcrypt-ruby', '~> 3.0.0'
|
30
|
+
|
31
|
+
# Use unicorn as the web server
|
32
|
+
# gem 'unicorn'
|
33
|
+
|
34
|
+
# Deploy with Capistrano
|
35
|
+
# gem 'capistrano'
|
36
|
+
|
37
|
+
# To use debugger
|
38
|
+
# gem 'ruby-debug19', :require => 'ruby-debug'
|
39
|
+
|
40
|
+
group :test do
|
41
|
+
# Pretty printed test output
|
42
|
+
gem 'turn', '~> 0.8.3', :require => false
|
43
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
guard 'rspec', :version => 2 do
|
5
|
+
watch(%r{^spec/.+_spec\.rb$})
|
6
|
+
#watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
7
|
+
#watch('spec/spec_helper.rb') { "spec" }
|
8
|
+
#
|
9
|
+
## Rails example
|
10
|
+
#watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
11
|
+
#watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
|
12
|
+
#watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
|
13
|
+
#watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
|
14
|
+
#watch('config/routes.rb') { "spec/routing" }
|
15
|
+
#watch('app/controllers/application_controller.rb') { "spec/controllers" }
|
16
|
+
## Capybara request specs
|
17
|
+
#watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" }
|
18
|
+
end
|
19
|
+
|
data/test/dummy/README
ADDED
@@ -0,0 +1,261 @@
|
|
1
|
+
== Welcome to Rails
|
2
|
+
|
3
|
+
Rails is a web-application framework that includes everything needed to create
|
4
|
+
database-backed web applications according to the Model-View-Control pattern.
|
5
|
+
|
6
|
+
This pattern splits the view (also called the presentation) into "dumb"
|
7
|
+
templates that are primarily responsible for inserting pre-built data in between
|
8
|
+
HTML tags. The model contains the "smart" domain objects (such as Account,
|
9
|
+
Product, Person, Post) that holds all the business logic and knows how to
|
10
|
+
persist themselves to a database. The controller handles the incoming requests
|
11
|
+
(such as Save New Account, Update Product, Show Post) by manipulating the model
|
12
|
+
and directing data to the view.
|
13
|
+
|
14
|
+
In Rails, the model is handled by what's called an object-relational mapping
|
15
|
+
layer entitled Active Record. This layer allows you to present the data from
|
16
|
+
database rows as objects and embellish these data objects with business logic
|
17
|
+
methods. You can read more about Active Record in
|
18
|
+
link:files/vendor/rails/activerecord/README.html.
|
19
|
+
|
20
|
+
The controller and view are handled by the Action Pack, which handles both
|
21
|
+
layers by its two parts: Action View and Action Controller. These two layers
|
22
|
+
are bundled in a single package due to their heavy interdependence. This is
|
23
|
+
unlike the relationship between the Active Record and Action Pack that is much
|
24
|
+
more separate. Each of these packages can be used independently outside of
|
25
|
+
Rails. You can read more about Action Pack in
|
26
|
+
link:files/vendor/rails/actionpack/README.html.
|
27
|
+
|
28
|
+
|
29
|
+
== Getting Started
|
30
|
+
|
31
|
+
1. At the command prompt, create a new Rails application:
|
32
|
+
<tt>rails new myapp</tt> (where <tt>myapp</tt> is the application name)
|
33
|
+
|
34
|
+
2. Change directory to <tt>myapp</tt> and start the web server:
|
35
|
+
<tt>cd myapp; rails server</tt> (run with --help for options)
|
36
|
+
|
37
|
+
3. Go to http://localhost:3000/ and you'll see:
|
38
|
+
"Welcome aboard: You're riding Ruby on Rails!"
|
39
|
+
|
40
|
+
4. Follow the guidelines to start developing your application. You can find
|
41
|
+
the following resources handy:
|
42
|
+
|
43
|
+
* The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html
|
44
|
+
* Ruby on Rails Tutorial Book: http://www.railstutorial.org/
|
45
|
+
|
46
|
+
|
47
|
+
== Debugging Rails
|
48
|
+
|
49
|
+
Sometimes your application goes wrong. Fortunately there are a lot of tools that
|
50
|
+
will help you debug it and get it back on the rails.
|
51
|
+
|
52
|
+
First area to check is the application log files. Have "tail -f" commands
|
53
|
+
running on the server.log and development.log. Rails will automatically display
|
54
|
+
debugging and runtime information to these files. Debugging info will also be
|
55
|
+
shown in the browser on requests from 127.0.0.1.
|
56
|
+
|
57
|
+
You can also log your own messages directly into the log file from your code
|
58
|
+
using the Ruby logger class from inside your controllers. Example:
|
59
|
+
|
60
|
+
class WeblogController < ActionController::Base
|
61
|
+
def destroy
|
62
|
+
@weblog = Weblog.find(params[:id])
|
63
|
+
@weblog.destroy
|
64
|
+
logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
The result will be a message in your log file along the lines of:
|
69
|
+
|
70
|
+
Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1!
|
71
|
+
|
72
|
+
More information on how to use the logger is at http://www.ruby-doc.org/core/
|
73
|
+
|
74
|
+
Also, Ruby documentation can be found at http://www.ruby-lang.org/. There are
|
75
|
+
several books available online as well:
|
76
|
+
|
77
|
+
* Programming Ruby: http://www.ruby-doc.org/docs/ProgrammingRuby/ (Pickaxe)
|
78
|
+
* Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
|
79
|
+
|
80
|
+
These two books will bring you up to speed on the Ruby language and also on
|
81
|
+
programming in general.
|
82
|
+
|
83
|
+
|
84
|
+
== Debugger
|
85
|
+
|
86
|
+
Debugger support is available through the debugger command when you start your
|
87
|
+
Mongrel or WEBrick server with --debugger. This means that you can break out of
|
88
|
+
execution at any point in the code, investigate and change the model, and then,
|
89
|
+
resume execution! You need to install ruby-debug to run the server in debugging
|
90
|
+
mode. With gems, use <tt>sudo gem install ruby-debug</tt>. Example:
|
91
|
+
|
92
|
+
class WeblogController < ActionController::Base
|
93
|
+
def index
|
94
|
+
@posts = Post.all
|
95
|
+
debugger
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
So the controller will accept the action, run the first line, then present you
|
100
|
+
with a IRB prompt in the server window. Here you can do things like:
|
101
|
+
|
102
|
+
>> @posts.inspect
|
103
|
+
=> "[#<Post:0x14a6be8
|
104
|
+
@attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>,
|
105
|
+
#<Post:0x14a6620
|
106
|
+
@attributes={"title"=>"Rails", "body"=>"Only ten..", "id"=>"2"}>]"
|
107
|
+
>> @posts.first.title = "hello from a debugger"
|
108
|
+
=> "hello from a debugger"
|
109
|
+
|
110
|
+
...and even better, you can examine how your runtime objects actually work:
|
111
|
+
|
112
|
+
>> f = @posts.first
|
113
|
+
=> #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
|
114
|
+
>> f.
|
115
|
+
Display all 152 possibilities? (y or n)
|
116
|
+
|
117
|
+
Finally, when you're ready to resume execution, you can enter "cont".
|
118
|
+
|
119
|
+
|
120
|
+
== Console
|
121
|
+
|
122
|
+
The console is a Ruby shell, which allows you to interact with your
|
123
|
+
application's domain model. Here you'll have all parts of the application
|
124
|
+
configured, just like it is when the application is running. You can inspect
|
125
|
+
domain models, change values, and save to the database. Starting the script
|
126
|
+
without arguments will launch it in the development environment.
|
127
|
+
|
128
|
+
To start the console, run <tt>rails console</tt> from the application
|
129
|
+
directory.
|
130
|
+
|
131
|
+
Options:
|
132
|
+
|
133
|
+
* Passing the <tt>-s, --sandbox</tt> argument will rollback any modifications
|
134
|
+
made to the database.
|
135
|
+
* Passing an environment name as an argument will load the corresponding
|
136
|
+
environment. Example: <tt>rails console production</tt>.
|
137
|
+
|
138
|
+
To reload your controllers and models after launching the console run
|
139
|
+
<tt>reload!</tt>
|
140
|
+
|
141
|
+
More information about irb can be found at:
|
142
|
+
link:http://www.rubycentral.org/pickaxe/irb.html
|
143
|
+
|
144
|
+
|
145
|
+
== dbconsole
|
146
|
+
|
147
|
+
You can go to the command line of your database directly through <tt>rails
|
148
|
+
dbconsole</tt>. You would be connected to the database with the credentials
|
149
|
+
defined in database.yml. Starting the script without arguments will connect you
|
150
|
+
to the development database. Passing an argument will connect you to a different
|
151
|
+
database, like <tt>rails dbconsole production</tt>. Currently works for MySQL,
|
152
|
+
PostgreSQL and SQLite 3.
|
153
|
+
|
154
|
+
== Description of Contents
|
155
|
+
|
156
|
+
The default directory structure of a generated Ruby on Rails application:
|
157
|
+
|
158
|
+
|-- app
|
159
|
+
| |-- assets
|
160
|
+
| |-- images
|
161
|
+
| |-- javascripts
|
162
|
+
| `-- stylesheets
|
163
|
+
| |-- controllers
|
164
|
+
| |-- helpers
|
165
|
+
| |-- mailers
|
166
|
+
| |-- models
|
167
|
+
| `-- views
|
168
|
+
| `-- layouts
|
169
|
+
|-- config
|
170
|
+
| |-- environments
|
171
|
+
| |-- initializers
|
172
|
+
| `-- locales
|
173
|
+
|-- db
|
174
|
+
|-- doc
|
175
|
+
|-- lib
|
176
|
+
| `-- tasks
|
177
|
+
|-- log
|
178
|
+
|-- public
|
179
|
+
|-- script
|
180
|
+
|-- test
|
181
|
+
| |-- fixtures
|
182
|
+
| |-- functional
|
183
|
+
| |-- integration
|
184
|
+
| |-- performance
|
185
|
+
| `-- unit
|
186
|
+
|-- tmp
|
187
|
+
| |-- cache
|
188
|
+
| |-- pids
|
189
|
+
| |-- sessions
|
190
|
+
| `-- sockets
|
191
|
+
`-- vendor
|
192
|
+
|-- assets
|
193
|
+
`-- stylesheets
|
194
|
+
`-- plugins
|
195
|
+
|
196
|
+
app
|
197
|
+
Holds all the code that's specific to this particular application.
|
198
|
+
|
199
|
+
app/assets
|
200
|
+
Contains subdirectories for images, stylesheets, and JavaScript files.
|
201
|
+
|
202
|
+
app/controllers
|
203
|
+
Holds controllers that should be named like weblogs_controller.rb for
|
204
|
+
automated URL mapping. All controllers should descend from
|
205
|
+
ApplicationController which itself descends from ActionController::Base.
|
206
|
+
|
207
|
+
app/models
|
208
|
+
Holds models that should be named like post.rb. Models descend from
|
209
|
+
ActiveRecord::Base by default.
|
210
|
+
|
211
|
+
app/views
|
212
|
+
Holds the template files for the view that should be named like
|
213
|
+
weblogs/index.html.erb for the WeblogsController#index action. All views use
|
214
|
+
eRuby syntax by default.
|
215
|
+
|
216
|
+
app/views/layouts
|
217
|
+
Holds the template files for layouts to be used with views. This models the
|
218
|
+
common header/footer method of wrapping views. In your views, define a layout
|
219
|
+
using the <tt>layout :default</tt> and create a file named default.html.erb.
|
220
|
+
Inside default.html.erb, call <% yield %> to render the view using this
|
221
|
+
layout.
|
222
|
+
|
223
|
+
app/helpers
|
224
|
+
Holds view helpers that should be named like weblogs_helper.rb. These are
|
225
|
+
generated for you automatically when using generators for controllers.
|
226
|
+
Helpers can be used to wrap functionality for your views into methods.
|
227
|
+
|
228
|
+
config
|
229
|
+
Configuration files for the Rails environment, the routing map, the database,
|
230
|
+
and other dependencies.
|
231
|
+
|
232
|
+
db
|
233
|
+
Contains the database schema in schema.rb. db/migrate contains all the
|
234
|
+
sequence of Migrations for your schema.
|
235
|
+
|
236
|
+
doc
|
237
|
+
This directory is where your application documentation will be stored when
|
238
|
+
generated using <tt>rake doc:app</tt>
|
239
|
+
|
240
|
+
lib
|
241
|
+
Application specific libraries. Basically, any kind of custom code that
|
242
|
+
doesn't belong under controllers, models, or helpers. This directory is in
|
243
|
+
the load path.
|
244
|
+
|
245
|
+
public
|
246
|
+
The directory available for the web server. Also contains the dispatchers and the
|
247
|
+
default HTML files. This should be set as the DOCUMENT_ROOT of your web
|
248
|
+
server.
|
249
|
+
|
250
|
+
script
|
251
|
+
Helper scripts for automation and generation.
|
252
|
+
|
253
|
+
test
|
254
|
+
Unit and functional tests along with fixtures. When using the rails generate
|
255
|
+
command, template test files will be generated for you and placed in this
|
256
|
+
directory.
|
257
|
+
|
258
|
+
vendor
|
259
|
+
External libraries that the application depends on. Also includes the plugins
|
260
|
+
subdirectory. If the app has frozen rails, those gems also go here, under
|
261
|
+
vendor/rails/. This directory is in the load path.
|