activeadmin-generator 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. data/.gitignore +1 -0
  2. data/README.md +0 -0
  3. data/Rakefile +3 -0
  4. data/activeadmin-generator.gemspec +22 -0
  5. data/bin/activeadmin-generate +4 -0
  6. data/lib/active_admin/generator/base.rb +62 -0
  7. data/lib/active_admin/generator/bricks/active_admin.rb +25 -0
  8. data/lib/active_admin/generator/bricks/active_admin_extras.rb +31 -0
  9. data/lib/active_admin/generator/bricks/base.rb +86 -0
  10. data/lib/active_admin/generator/bricks/clean_assets.rb +12 -0
  11. data/lib/active_admin/generator/bricks/database.rb +45 -0
  12. data/lib/active_admin/generator/bricks/errbit.rb +0 -0
  13. data/lib/active_admin/generator/bricks/frontend.rb +31 -0
  14. data/lib/active_admin/generator/bricks/git.rb +19 -0
  15. data/lib/active_admin/generator/bricks/heroku.rb +25 -0
  16. data/lib/active_admin/generator/bricks/s3.rb +0 -0
  17. data/lib/active_admin/generator/cli.rb +20 -0
  18. data/lib/active_admin/generator/templates/app/assets/fonts/.empty_directory +0 -0
  19. data/lib/active_admin/generator/templates/app/assets/images/.empty_directory +0 -0
  20. data/lib/active_admin/generator/templates/app/assets/javascripts/application.js.coffee +6 -0
  21. data/lib/active_admin/generator/templates/app/assets/stylesheets/active_admin.css.sass +1 -0
  22. data/lib/active_admin/generator/templates/app/assets/stylesheets/application.css.sass +22 -0
  23. data/lib/active_admin/generator/templates/app/assets/stylesheets/basic/_fonts.css.sass +4 -0
  24. data/lib/active_admin/generator/templates/app/assets/stylesheets/basic/_layout.css.sass +7 -0
  25. data/lib/active_admin/generator/templates/app/assets/stylesheets/basic/_sprites.css.sass +6 -0
  26. data/lib/active_admin/generator/templates/app/assets/stylesheets/lib/_colors.css.sass +0 -0
  27. data/lib/active_admin/generator/templates/app/assets/stylesheets/lib/_mixins.css.sass +0 -0
  28. data/lib/active_admin/generator/templates/app/assets/stylesheets/lib/_variables.css.sass +0 -0
  29. data/lib/active_admin/generator/templates/app/assets/stylesheets/modules/.empty_directory +0 -0
  30. data/lib/active_admin/generator/templates/app/assets/stylesheets/sections/.empty_directory +0 -0
  31. data/lib/active_admin/generator/templates/app/assets/stylesheets/themes/.empty_directory +0 -0
  32. data/lib/active_admin/generator/templates/app/controllers/application_controller.rb +3 -0
  33. data/lib/active_admin/generator/templates/app/controllers/static_controller.rb +6 -0
  34. data/lib/active_admin/generator/templates/app/models/asset_thumb.rb +4 -0
  35. data/lib/active_admin/generator/templates/app/views/application/_footer.html.slim +2 -0
  36. data/lib/active_admin/generator/templates/app/views/application/_head.html.slim +6 -0
  37. data/lib/active_admin/generator/templates/app/views/application/_header.html.slim +6 -0
  38. data/lib/active_admin/generator/templates/app/views/application/_js_includes.html.slim +2 -0
  39. data/lib/active_admin/generator/templates/app/views/layouts/application.html.slim +11 -0
  40. data/lib/active_admin/generator/templates/app/views/static/homepage.html.slim +2 -0
  41. data/lib/active_admin/generator/templates/config/active_admin_initializer.rb +142 -0
  42. data/lib/active_admin/generator/templates/config/initializers/active_admin.rb +142 -0
  43. data/lib/active_admin/generator/templates/config/initializers/dragonfly.rb +32 -0
  44. data/lib/active_admin/generator/templates/config/locales/it.yml +3 -0
  45. data/lib/active_admin/generator/templates/db/migrate/20121126113057_create_asset_thumbs.rb +10 -0
  46. data/lib/active_admin/generator/version.rb +8 -0
  47. data/lib/activeadmin-generator.rb +1 -0
  48. metadata +141 -0
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ pkg
data/README.md ADDED
File without changes
data/Rakefile ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
3
+
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/active_admin/generator/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Stefano Verna"]
6
+ gem.email = ["stefano.verna@welaika.com"]
7
+ gem.description = %q{Generate ActiveAdmin projects}
8
+ gem.summary = %q{Generate ActiveAdmin projects}
9
+ gem.homepage = ""
10
+
11
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
12
+ gem.files = `git ls-files`.split("\n")
13
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
14
+ gem.name = "activeadmin-generator"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = ActiveAdmin::Generator::VERSION
17
+
18
+ gem.add_dependency "rake"
19
+ gem.add_dependency "thor"
20
+ gem.add_dependency "railties"
21
+ end
22
+
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ $:.unshift File.join(File.dirname(__FILE__), "../lib")
3
+ require 'active_admin/generator/cli'
4
+ ActiveAdmin::Generator::CLI.start
@@ -0,0 +1,62 @@
1
+ class Base
2
+ BRICKS = %w(base git clean_assets frontend database heroku s3 active_admin active_admin_extras)
3
+ attr_reader :context
4
+
5
+ def initialize(context)
6
+ @context = context
7
+ end
8
+
9
+ def require_bricks
10
+ BRICKS.each do |brick_module|
11
+ context.apply "bricks/#{brick_module}.rb"
12
+ end
13
+ end
14
+
15
+ def bricks
16
+ @bricks ||= BRICKS.map do |brick_module|
17
+ brick_class = "bricks/#{brick_module}".camelize.constantize rescue nil
18
+ if brick_class
19
+ brick = brick_class.new(context)
20
+ brick.apply? ? brick : nil
21
+ else
22
+ nil
23
+ end
24
+ end.compact
25
+ end
26
+
27
+ def run!
28
+ require_bricks
29
+
30
+ hook :before_bundle
31
+ context.run "bundle install"
32
+ hook :after_bundle
33
+
34
+ hook :before_migrate
35
+ context.rake "db:migrate"
36
+ hook :after_migrate
37
+
38
+ hook :recap
39
+ end
40
+
41
+ def hook(name)
42
+ bricks.each do |brick|
43
+ if brick.respond_to? name
44
+ context.send :log, name.to_s.titleize, "brick: #{brick.title}"
45
+ brick.send(name)
46
+ end
47
+ end
48
+ end
49
+ end
50
+
51
+
52
+ module Thor::Actions
53
+ alias_method :old_source_paths, :source_paths
54
+ def source_paths
55
+ [ File.expand_path(File.dirname(__FILE__)), File.join(File.expand_path(File.dirname(__FILE__)), "templates") ] + old_source_paths
56
+ end
57
+ end
58
+
59
+ def run_bundle; end
60
+
61
+ Base.new(self).run!
62
+
@@ -0,0 +1,25 @@
1
+ module ::Bricks
2
+ class ActiveAdmin < Base
3
+ def before_bundle
4
+ gem "activeadmin"
5
+ gem "meta_search"
6
+ @site_title = ask("Name to be shown in admin backend")
7
+ end
8
+
9
+ def after_bundle
10
+ generate 'active_admin:install'
11
+ remove_file "config/initializers/active_admin.rb"
12
+ template "config/initializers/active_admin.rb"
13
+ commit_all "ActiveAdmin installed"
14
+ end
15
+
16
+ def recap
17
+ say 'Run rails server, visit http://127.0.0.1:3000/admin and log in using:'
18
+ say 'admin@example.com'
19
+ say 'password'
20
+ end
21
+ end
22
+ end
23
+
24
+
25
+
@@ -0,0 +1,31 @@
1
+ module ::Bricks
2
+ class ActiveAdminExtras < Base
3
+
4
+ def before_bundle
5
+ gem 'activeadmin-dragonfly', github: 'stefanoverna/activeadmin-dragonfly', branch: 'master'
6
+ gem 'activeadmin-globalize3', github: 'stefanoverna/activeadmin-globalize3', branch: 'master'
7
+ gem 'activeadmin-wysihtml5', github: 'stefanoverna/activeadmin-wysihtml5', branch: 'master'
8
+ gem 'activeadmin-gallery', github: 'stefanoverna/activeadmin-gallery', branch: 'master'
9
+ gem 'activeadmin-extra', github: 'stefanoverna/activeadmin-extra', branch: 'master'
10
+ gem 'activeadmin-seo', github: 'nebirhos/activeadmin-seo', branch: 'master'
11
+
12
+ commit_all "Added ActiveAdmin extra gems"
13
+ end
14
+
15
+ def after_bundle
16
+ rake "activeadmin_gallery:install:migrations"
17
+ rake "activeadmin_wysihtml5:install:migrations"
18
+ rake "activeadmin_seo:install:migrations"
19
+
20
+ remove_file "app/assets/stylesheets/active_admin.css.scss"
21
+ copy_file "app/assets/stylesheets/active_admin.css.sass"
22
+
23
+ commit_all "Run ActiveAdmin customizations"
24
+ end
25
+
26
+ end
27
+ end
28
+
29
+
30
+
31
+
@@ -0,0 +1,86 @@
1
+ require 'active_support/core_ext'
2
+
3
+ module ::Bricks
4
+ class Base
5
+
6
+ attr_reader :context, :base_path
7
+
8
+ delegate :directory, :copy_file, :remove_dir, :gsub_file, :rake, :generate, :route, :empty_directory,
9
+ :gem, :git, :remove_file, :append_file, to: :context
10
+
11
+ def initialize(context)
12
+ @context = context
13
+ @base_path = base_path
14
+ end
15
+
16
+ def title
17
+ "Base"
18
+ end
19
+
20
+ def template(source)
21
+ content = open(File.expand_path(context.find_in_source_paths(source.to_s))) {|input| input.binmode.read }
22
+ context.copy_file source do
23
+ ERB.new(content).result(binding)
24
+ end
25
+ end
26
+
27
+ def apply?
28
+ true
29
+ end
30
+
31
+ def commit_all(message)
32
+ git add: "-A ."
33
+ git :commit => "-m '#{message}'"
34
+ end
35
+
36
+ def before_bundle
37
+ say "=" * 80
38
+ say "Welcome to ActiveAdmin Generator! :)".center(80) + "\n"
39
+ say "=" * 80
40
+ end
41
+
42
+ def format(text)
43
+ string = ""
44
+ if title
45
+ string << "\033[1m\033[36m"
46
+ string << title.to_s.rjust(10)
47
+ string << "\033[0m "
48
+ end
49
+ string << text
50
+ string
51
+ end
52
+
53
+ def say(text)
54
+ @context.say format(text)
55
+ end
56
+
57
+ def ask(question)
58
+ @context.ask format(question)
59
+ end
60
+
61
+ def choose(question, choices)
62
+ say question
63
+ values = {}
64
+ choices.each_with_index do |choice,i|
65
+ values[(i + 1).to_s] = choice[1]
66
+ say "#{i.next.to_s}) #{choice[0]}"
67
+ end
68
+ answer = ask("Enter your selection:") while !values.keys.include?(answer)
69
+ values[answer]
70
+ end
71
+
72
+ def yes?(question)
73
+ answer = ask(question + " \033[33m(y/n)\033[0m")
74
+ case answer.downcase
75
+ when "yes", "y"
76
+ true
77
+ when "no", "n"
78
+ false
79
+ else
80
+ yes?(question)
81
+ end
82
+ end
83
+
84
+ end
85
+ end
86
+
@@ -0,0 +1,12 @@
1
+ module ::Bricks
2
+ class CleanAssets < Base
3
+ def before_bundle
4
+ remove_file 'public/index.html'
5
+ remove_file 'app/assets/images/rails.png'
6
+
7
+ commit_all "Removed Rails default assets"
8
+ end
9
+ end
10
+ end
11
+
12
+
@@ -0,0 +1,45 @@
1
+ module ::Bricks
2
+ class Database < Base
3
+
4
+ def before_bundle
5
+ remove_file "config/database.yml"
6
+ gsub_file 'Gemfile', /gem 'sqlite3'\n/, ''
7
+
8
+ @adapter = choose "Database used in development?", [["SQLite", :sqlite], ["PostgreSQL", :pg], ["MySQL", :mysql]]
9
+
10
+ if @adapter != :sqlite
11
+ @database = ask "Development database name:"
12
+ @username = ask "Username:"
13
+ @password = ask "Password:"
14
+ end
15
+
16
+ send("configure_#{@adapter}")
17
+ template "config/database.yml"
18
+ commit_all "Database configured"
19
+ end
20
+
21
+ def after_bundle
22
+ rake "db:drop"
23
+ rake "db:create"
24
+ end
25
+
26
+ def configure_sqlite
27
+ gem 'sqlite3'
28
+ end
29
+
30
+ def configure_mysql
31
+ gem 'mysql2'
32
+ end
33
+
34
+ def configure_pg
35
+ gem 'pg'
36
+ end
37
+
38
+ end
39
+ end
40
+
41
+
42
+
43
+
44
+
45
+
File without changes
@@ -0,0 +1,31 @@
1
+ module ::Bricks
2
+ class Frontend < Base
3
+ def before_bundle
4
+ gem "rails-i18n"
5
+ gem "slim-rails"
6
+ gem "compass-rails"
7
+ gem "sextant"
8
+ gem "modernizr-rails"
9
+ gem "hive-rails", github: 'stefanoverna/hive-rails', branch: 'master'
10
+ commit_all "Added frontend gems"
11
+
12
+ remove_dir 'app'
13
+ directory 'app'
14
+ route "root to: 'static#homepage'"
15
+
16
+ commit_all "Added basic frontend skeleton"
17
+
18
+ apply_i18n_routes!
19
+ end
20
+
21
+ def apply_i18n_routes!
22
+ gem 'i18n_routing'
23
+ copy_file "config/locales/it.yml"
24
+ commit_all "Added i18n routes"
25
+ end
26
+
27
+ end
28
+ end
29
+
30
+
31
+
@@ -0,0 +1,19 @@
1
+ module ::Bricks
2
+ class Git < Base
3
+ def before_bundle
4
+ git :init
5
+
6
+ append_file ".gitignore", <<-END
7
+ *.swp
8
+ .sass-cache
9
+ root.dir
10
+ .rake_tasks~
11
+ db/schema.rb
12
+ public/system
13
+ END
14
+
15
+ commit_all "First commit"
16
+ end
17
+ end
18
+ end
19
+
@@ -0,0 +1,25 @@
1
+ module ::Bricks
2
+ class Heroku < Base
3
+
4
+ def apply?
5
+ yes? "Do you want to deploy this site on Heroku?"
6
+ end
7
+
8
+ def before_bundle
9
+ copy_file "db/migrate/20121126113057_create_asset_thumbs.rb"
10
+ copy_file "config/initializers/dragonfly.rb"
11
+ end
12
+
13
+ def after_bundle
14
+ rake "activeadmin_gallery:install:migrations"
15
+ rake "activeadmin_wysihtml5:install:migrations"
16
+ rake "activeadmin_seo:install:migrations"
17
+ end
18
+
19
+ end
20
+ end
21
+
22
+
23
+
24
+
25
+
File without changes
@@ -0,0 +1,20 @@
1
+ require 'thor'
2
+ require 'rails/generators'
3
+ require 'rails/generators/rails/app/app_generator'
4
+
5
+ module ActiveAdmin
6
+ module Generator
7
+ class CLI < Thor
8
+
9
+ desc "new", "Bootstraps a new ActiveAdmin project"
10
+ def new(name)
11
+ ARGV.shift(ARGV.count)
12
+ ARGV.unshift name, '-T', '-m', File.join(File.dirname(__FILE__), "base.rb"), '--trace'
13
+ Rails::Generators::AppGenerator.start
14
+ end
15
+
16
+ end
17
+ end
18
+ end
19
+
20
+
@@ -0,0 +1,6 @@
1
+ #= require jquery
2
+ #= require jquery_ujs
3
+ #= require modernizr
4
+ #= require_tree .
5
+
6
+
@@ -0,0 +1 @@
1
+ @import "active_admin/extra/base"
@@ -0,0 +1,22 @@
1
+ /* Third party libraries
2
+ @import compass
3
+ @import hive
4
+
5
+ // Internal variables and mixins
6
+ @import lib/variables
7
+ @import lib/colors
8
+ @import lib/mixins
9
+
10
+ +global-reset
11
+
12
+ /* Basic styles
13
+ @import basic/fonts
14
+ @import basic/sprites
15
+ @import basic/layout
16
+
17
+ /* Modules
18
+
19
+ /* Sections
20
+
21
+ /* Themes
22
+
@@ -0,0 +1,4 @@
1
+ /* Fonts */
2
+
3
+ // +font-face("Font Name", font-files("font.ttf", "font.woff"), "font.eot", normal, normal)
4
+
@@ -0,0 +1,7 @@
1
+ /* Layout */
2
+
3
+ body
4
+ font-family: Helvetica, sans-serif
5
+
6
+ footer.page-footer
7
+
@@ -0,0 +1,6 @@
1
+ /* Sprites */
2
+
3
+ // $experimental-support-for-svg: true
4
+ // $s-layout: smart
5
+ // @import sprites/*.png
6
+
@@ -0,0 +1,3 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+ end
@@ -0,0 +1,6 @@
1
+ class StaticController < ApplicationController
2
+
3
+ def homepage
4
+ end
5
+
6
+ end
@@ -0,0 +1,4 @@
1
+ class AssetThumb < ActiveRecord::Base
2
+ attr_accessible :job, :uid
3
+ end
4
+
@@ -0,0 +1,6 @@
1
+ title Title
2
+ meta http-equiv="Content-Type" content="text/html; charset=utf-8"
3
+ meta name="viewport" content="width=device-width,minimum-scale=1,maximum-scale=1"
4
+ = stylesheet_link_tag "application", :media => "all"
5
+ = csrf_meta_tags
6
+
@@ -0,0 +1,6 @@
1
+ header.page-header
2
+ h1 Logo
3
+
4
+ nav.page-navigation
5
+ ul
6
+ li= link_to "Home", root_path
@@ -0,0 +1,2 @@
1
+ = javascript_include_tag "application"
2
+
@@ -0,0 +1,11 @@
1
+ doctype 5
2
+ html
3
+ head= render "head"
4
+ body
5
+ .hive: .cell_100
6
+ = render "header"
7
+ section.page_content= yield
8
+ = render "footer"
9
+
10
+ = render "js_includes"
11
+
@@ -0,0 +1,2 @@
1
+ h1 Hello, there!
2
+ p You can find me in app/views/static/homepage.html.slim
@@ -0,0 +1,142 @@
1
+ ActiveAdmin.setup do |config|
2
+ # == Site Title
3
+ #
4
+ # Set the title that is displayed on the main layout
5
+ # for each of the active admin pages.
6
+ #
7
+ config.site_title = SITE_TITLE
8
+
9
+ # Set the link url for the title. For example, to take
10
+ # users to your main site. Defaults to no link.
11
+ #
12
+ # config.site_title_link = "/"
13
+
14
+ # Set an optional image to be displayed for the header
15
+ # instead of a string (overrides :site_title)
16
+ #
17
+ # Note: Recommended image height is 21px to properly fit in the header
18
+ #
19
+ # config.site_title_image = "/images/logo.png"
20
+
21
+ # == Default Namespace
22
+ #
23
+ # Set the default namespace each administration resource
24
+ # will be added to.
25
+ #
26
+ # eg:
27
+ # config.default_namespace = :hello_world
28
+ #
29
+ # This will create resources in the HelloWorld module and
30
+ # will namespace routes to /hello_world/*
31
+ #
32
+ # To set no namespace by default, use:
33
+ # config.default_namespace = false
34
+ #
35
+ # Default:
36
+ # config.default_namespace = :admin
37
+ #
38
+ # You can customize the settings for each namespace by using
39
+ # a namespace block. For example, to change the site title
40
+ # within a namespace:
41
+ #
42
+ # config.namespace :admin do |admin|
43
+ # admin.site_title = "Custom Admin Title"
44
+ # end
45
+ #
46
+ # This will ONLY change the title for the admin section. Other
47
+ # namespaces will continue to use the main "site_title" configuration.
48
+
49
+ # == User Authentication
50
+ #
51
+ # Active Admin will automatically call an authentication
52
+ # method in a before filter of all controller actions to
53
+ # ensure that there is a currently logged in admin user.
54
+ #
55
+ # This setting changes the method which Active Admin calls
56
+ # within the controller.
57
+ config.authentication_method = :authenticate_admin_user!
58
+
59
+ # == Current User
60
+ #
61
+ # Active Admin will associate actions with the current
62
+ # user performing them.
63
+ #
64
+ # This setting changes the method which Active Admin calls
65
+ # to return the currently logged in user.
66
+ config.current_user_method = :current_admin_user
67
+
68
+ # == Logging Out
69
+ #
70
+ # Active Admin displays a logout link on each screen. These
71
+ # settings configure the location and method used for the link.
72
+ #
73
+ # This setting changes the path where the link points to. If it's
74
+ # a string, the strings is used as the path. If it's a Symbol, we
75
+ # will call the method to return the path.
76
+ #
77
+ # Default:
78
+ config.logout_link_path = :destroy_admin_user_session_path
79
+
80
+ # This setting changes the http method used when rendering the
81
+ # link. For example :get, :delete, :put, etc..
82
+ #
83
+ # Default:
84
+ # config.logout_link_method = :get
85
+
86
+ # == Root
87
+ #
88
+ # Set the action to call for the root path. You can set different
89
+ # roots for each namespace.
90
+ #
91
+ # Default:
92
+ # config.root_to = 'dashboard#index'
93
+
94
+ # == Admin Comments
95
+ #
96
+ # Admin comments allow you to add comments to any model for admin use.
97
+ # Admin comments are enabled by default.
98
+ #
99
+ # Default:
100
+ # config.allow_comments = true
101
+ #
102
+ # You can turn them on and off for any given namespace by using a
103
+ # namespace config block.
104
+ #
105
+ # Eg:
106
+ # config.namespace :without_comments do |without_comments|
107
+ # without_comments.allow_comments = false
108
+ # end
109
+
110
+ # == Batch Actions
111
+ #
112
+ # Enable and disable Batch Actions
113
+ #
114
+ config.batch_actions = true
115
+
116
+ # == Controller Filters
117
+ #
118
+ # You can add before, after and around filters to all of your
119
+ # Active Admin resources from here.
120
+ #
121
+ # config.before_filter :do_something_awesome
122
+
123
+ # == Register Stylesheets & Javascripts
124
+ #
125
+ # We recommend using the built in Active Admin layout and loading
126
+ # up your own stylesheets / javascripts to customize the look
127
+ # and feel.
128
+ #
129
+ # To load a stylesheet:
130
+ # config.register_stylesheet 'my_stylesheet.css'
131
+
132
+ # You can provide an options hash for more control, which is passed along to stylesheet_link_tag():
133
+ # config.register_stylesheet 'my_print_stylesheet.css', :media => :print
134
+ #
135
+ # To load a javascript file:
136
+ # config.register_javascript 'my_javascript.js'
137
+
138
+ # == CSV options
139
+ #
140
+ # Set the CSV builder separator (default is ",")
141
+ # config.csv_column_separator = ','
142
+ end
@@ -0,0 +1,142 @@
1
+ ActiveAdmin.setup do |config|
2
+ # == Site Title
3
+ #
4
+ # Set the title that is displayed on the main layout
5
+ # for each of the active admin pages.
6
+ #
7
+ config.site_title = "<%= @site_title %>"
8
+
9
+ # Set the link url for the title. For example, to take
10
+ # users to your main site. Defaults to no link.
11
+ #
12
+ config.site_title_link = "/"
13
+
14
+ # Set an optional image to be displayed for the header
15
+ # instead of a string (overrides :site_title)
16
+ #
17
+ # Note: Recommended image height is 21px to properly fit in the header
18
+ #
19
+ # config.site_title_image = "/images/logo.png"
20
+
21
+ # == Default Namespace
22
+ #
23
+ # Set the default namespace each administration resource
24
+ # will be added to.
25
+ #
26
+ # eg:
27
+ # config.default_namespace = :hello_world
28
+ #
29
+ # This will create resources in the HelloWorld module and
30
+ # will namespace routes to /hello_world/*
31
+ #
32
+ # To set no namespace by default, use:
33
+ # config.default_namespace = false
34
+ #
35
+ # Default:
36
+ # config.default_namespace = :admin
37
+ #
38
+ # You can customize the settings for each namespace by using
39
+ # a namespace block. For example, to change the site title
40
+ # within a namespace:
41
+ #
42
+ # config.namespace :admin do |admin|
43
+ # admin.site_title = "Custom Admin Title"
44
+ # end
45
+ #
46
+ # This will ONLY change the title for the admin section. Other
47
+ # namespaces will continue to use the main "site_title" configuration.
48
+
49
+ # == User Authentication
50
+ #
51
+ # Active Admin will automatically call an authentication
52
+ # method in a before filter of all controller actions to
53
+ # ensure that there is a currently logged in admin user.
54
+ #
55
+ # This setting changes the method which Active Admin calls
56
+ # within the controller.
57
+ config.authentication_method = :authenticate_admin_user!
58
+
59
+ # == Current User
60
+ #
61
+ # Active Admin will associate actions with the current
62
+ # user performing them.
63
+ #
64
+ # This setting changes the method which Active Admin calls
65
+ # to return the currently logged in user.
66
+ config.current_user_method = :current_admin_user
67
+
68
+ # == Logging Out
69
+ #
70
+ # Active Admin displays a logout link on each screen. These
71
+ # settings configure the location and method used for the link.
72
+ #
73
+ # This setting changes the path where the link points to. If it's
74
+ # a string, the strings is used as the path. If it's a Symbol, we
75
+ # will call the method to return the path.
76
+ #
77
+ # Default:
78
+ config.logout_link_path = :destroy_admin_user_session_path
79
+
80
+ # This setting changes the http method used when rendering the
81
+ # link. For example :get, :delete, :put, etc..
82
+ #
83
+ # Default:
84
+ # config.logout_link_method = :get
85
+
86
+ # == Root
87
+ #
88
+ # Set the action to call for the root path. You can set different
89
+ # roots for each namespace.
90
+ #
91
+ # Default:
92
+ # config.root_to = 'dashboard#index'
93
+
94
+ # == Admin Comments
95
+ #
96
+ # Admin comments allow you to add comments to any model for admin use.
97
+ # Admin comments are enabled by default.
98
+ #
99
+ # Default:
100
+ # config.allow_comments = true
101
+ #
102
+ # You can turn them on and off for any given namespace by using a
103
+ # namespace config block.
104
+ #
105
+ # Eg:
106
+ # config.namespace :without_comments do |without_comments|
107
+ # without_comments.allow_comments = false
108
+ # end
109
+
110
+ # == Batch Actions
111
+ #
112
+ # Enable and disable Batch Actions
113
+ #
114
+ config.batch_actions = true
115
+
116
+ # == Controller Filters
117
+ #
118
+ # You can add before, after and around filters to all of your
119
+ # Active Admin resources from here.
120
+ #
121
+ # config.before_filter :do_something_awesome
122
+
123
+ # == Register Stylesheets & Javascripts
124
+ #
125
+ # We recommend using the built in Active Admin layout and loading
126
+ # up your own stylesheets / javascripts to customize the look
127
+ # and feel.
128
+ #
129
+ # To load a stylesheet:
130
+ # config.register_stylesheet 'my_stylesheet.css'
131
+
132
+ # You can provide an options hash for more control, which is passed along to stylesheet_link_tag():
133
+ # config.register_stylesheet 'my_print_stylesheet.css', :media => :print
134
+ #
135
+ # To load a javascript file:
136
+ # config.register_javascript 'my_javascript.js'
137
+
138
+ # == CSV options
139
+ #
140
+ # Set the CSV builder separator (default is ",")
141
+ # config.csv_column_separator = ','
142
+ end
@@ -0,0 +1,32 @@
1
+ require 'dragonfly'
2
+ app = Dragonfly[:images]
3
+
4
+ app.configure_with(:imagemagick)
5
+ app.configure_with(:rails)
6
+ if Rails.env.production?
7
+ app.cache_duration = 3600*24*365*3
8
+ app.configure do |c|
9
+ c.define_url do |app, job, opts|
10
+ thumb = AssetThumb.find_by_job(job.serialize)
11
+ if thumb
12
+ app.datastore.url_for(thumb.uid)
13
+ else
14
+ app.server.url_for(job)
15
+ end
16
+ end
17
+ c.server.before_serve do |job, env|
18
+ uid = job.store
19
+ AssetThumb.create!(uid: uid, job: job.serialize)
20
+ end
21
+ end
22
+ app.datastore = Dragonfly::DataStorage::S3DataStore.new
23
+ app.datastore.configure do |c|
24
+ c.bucket_name = ENV['S3_BUCKET']
25
+ c.access_key_id = ENV['S3_KEY']
26
+ c.secret_access_key = ENV['S3_SECRET']
27
+ c.region = ENV['S3_REGION']
28
+ end
29
+ end
30
+
31
+ app.define_macro(ActiveRecord::Base, :image_accessor)
32
+ app.define_macro(ActiveRecord::Base, :file_accessor)
@@ -0,0 +1,3 @@
1
+ it:
2
+ resources:
3
+ static: 'statiche'
@@ -0,0 +1,10 @@
1
+ class CreateAssetThumbs < ActiveRecord::Migration
2
+ def change
3
+ create_table :asset_thumbs do |t|
4
+ t.string :uid
5
+ t.string :job
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,8 @@
1
+ module ActiveAdmin
2
+ module Generator
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
6
+
7
+
8
+
@@ -0,0 +1 @@
1
+ require 'active_admin/generator'
metadata ADDED
@@ -0,0 +1,141 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: activeadmin-generator
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Stefano Verna
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-11-26 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rake
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: thor
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: railties
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ description: Generate ActiveAdmin projects
63
+ email:
64
+ - stefano.verna@welaika.com
65
+ executables:
66
+ - activeadmin-generate
67
+ extensions: []
68
+ extra_rdoc_files: []
69
+ files:
70
+ - .gitignore
71
+ - README.md
72
+ - Rakefile
73
+ - activeadmin-generator.gemspec
74
+ - bin/activeadmin-generate
75
+ - lib/active_admin/generator/base.rb
76
+ - lib/active_admin/generator/bricks/active_admin.rb
77
+ - lib/active_admin/generator/bricks/active_admin_extras.rb
78
+ - lib/active_admin/generator/bricks/base.rb
79
+ - lib/active_admin/generator/bricks/clean_assets.rb
80
+ - lib/active_admin/generator/bricks/database.rb
81
+ - lib/active_admin/generator/bricks/errbit.rb
82
+ - lib/active_admin/generator/bricks/frontend.rb
83
+ - lib/active_admin/generator/bricks/git.rb
84
+ - lib/active_admin/generator/bricks/heroku.rb
85
+ - lib/active_admin/generator/bricks/s3.rb
86
+ - lib/active_admin/generator/cli.rb
87
+ - lib/active_admin/generator/templates/app/assets/fonts/.empty_directory
88
+ - lib/active_admin/generator/templates/app/assets/images/.empty_directory
89
+ - lib/active_admin/generator/templates/app/assets/javascripts/application.js.coffee
90
+ - lib/active_admin/generator/templates/app/assets/stylesheets/active_admin.css.sass
91
+ - lib/active_admin/generator/templates/app/assets/stylesheets/application.css.sass
92
+ - lib/active_admin/generator/templates/app/assets/stylesheets/basic/_fonts.css.sass
93
+ - lib/active_admin/generator/templates/app/assets/stylesheets/basic/_layout.css.sass
94
+ - lib/active_admin/generator/templates/app/assets/stylesheets/basic/_sprites.css.sass
95
+ - lib/active_admin/generator/templates/app/assets/stylesheets/lib/_colors.css.sass
96
+ - lib/active_admin/generator/templates/app/assets/stylesheets/lib/_mixins.css.sass
97
+ - lib/active_admin/generator/templates/app/assets/stylesheets/lib/_variables.css.sass
98
+ - lib/active_admin/generator/templates/app/assets/stylesheets/modules/.empty_directory
99
+ - lib/active_admin/generator/templates/app/assets/stylesheets/sections/.empty_directory
100
+ - lib/active_admin/generator/templates/app/assets/stylesheets/themes/.empty_directory
101
+ - lib/active_admin/generator/templates/app/controllers/application_controller.rb
102
+ - lib/active_admin/generator/templates/app/controllers/static_controller.rb
103
+ - lib/active_admin/generator/templates/app/models/asset_thumb.rb
104
+ - lib/active_admin/generator/templates/app/views/application/_footer.html.slim
105
+ - lib/active_admin/generator/templates/app/views/application/_head.html.slim
106
+ - lib/active_admin/generator/templates/app/views/application/_header.html.slim
107
+ - lib/active_admin/generator/templates/app/views/application/_js_includes.html.slim
108
+ - lib/active_admin/generator/templates/app/views/layouts/application.html.slim
109
+ - lib/active_admin/generator/templates/app/views/static/homepage.html.slim
110
+ - lib/active_admin/generator/templates/config/active_admin_initializer.rb
111
+ - lib/active_admin/generator/templates/config/initializers/active_admin.rb
112
+ - lib/active_admin/generator/templates/config/initializers/dragonfly.rb
113
+ - lib/active_admin/generator/templates/config/locales/it.yml
114
+ - lib/active_admin/generator/templates/db/migrate/20121126113057_create_asset_thumbs.rb
115
+ - lib/active_admin/generator/version.rb
116
+ - lib/activeadmin-generator.rb
117
+ homepage: ''
118
+ licenses: []
119
+ post_install_message:
120
+ rdoc_options: []
121
+ require_paths:
122
+ - lib
123
+ required_ruby_version: !ruby/object:Gem::Requirement
124
+ none: false
125
+ requirements:
126
+ - - ! '>='
127
+ - !ruby/object:Gem::Version
128
+ version: '0'
129
+ required_rubygems_version: !ruby/object:Gem::Requirement
130
+ none: false
131
+ requirements:
132
+ - - ! '>='
133
+ - !ruby/object:Gem::Version
134
+ version: '0'
135
+ requirements: []
136
+ rubyforge_project:
137
+ rubygems_version: 1.8.23
138
+ signing_key:
139
+ specification_version: 3
140
+ summary: Generate ActiveAdmin projects
141
+ test_files: []