Class: Taxis::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/taxis/install_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



10
11
12
# File 'lib/generators/taxis/install_generator.rb', line 10

def self.source_root
  @source_root ||= File.join(File.dirname(__FILE__), 'public')
end

Instance Method Details

#copy_js_treeObject



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/generators/taxis/install_generator.rb', line 42

def copy_js_tree
  dest_root = "public/javascripts/jsTree/"
  files = [ 
    'jquery.jstree.js',
    'themes/apple/bg.jpg',
    'themes/apple/d.png',
    'themes/apple/dot_for_ie.gif',
    'themes/apple/style.css',
    'themes/apple/throbber.gif',
  ]

  files.each do |file|
    copy_file 'jsTree/' + file, dest_root + file
  end


end

#copy_taxonomy_jsObject



38
39
40
# File 'lib/generators/taxis/install_generator.rb', line 38

def copy_taxonomy_js
  copy_file 'taxonomy.js', 'public/javascripts/taxonomy.js'
end

#ensure_jquery_gemObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/generators/taxis/install_generator.rb', line 15

def ensure_jquery_gem
  unless options[:skip_jquery]
    if ! defined? Jquery
      gem 'jquery-rails', '>= 0.2.6'

      jqry_msg = "The taxis default admin views require jquery for their use. As such, jquery-rails\nwas added to your gemfile.  You need to run \"bundle install\" and rerun this generator\nto finish installing taxis. If you don't want to use jquery, you can provide the --skip-jquery\noption when running the generator, but this will break the admin views.\nNOTE: This will also remove the prototype javascript framework from your application.\nSee https://github.com/indirect/jquery-rails for more information.\n"


      say jqry_msg, :red
      exit
    else
      generate "jquery:install"
    end
  end
end

#run_migration_installObject



60
61
62
# File 'lib/generators/taxis/install_generator.rb', line 60

def run_migration_install
  generate "taxis:migration"
end