Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Runtime Options:
-s, [--sudo] # Use sudo for the gem install commands (for non rvm/osx users)
-u, [--url] # Rool url for your app in development
-C, [--cucumber] # Include cucumber tests, currently does not support oauth
-j, [--jslibrary] # write out javascript partials using the jquery or prototype. will default to prototype if Rails.version < 3.1.x

Devise Options (used with the -c command)

Expand Down
2 changes: 1 addition & 1 deletion devisable.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

Gem::Specification.new do |s|
s.name = %q{devisable}
s.version = "0.1.3"
s.version = "0.2.0"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Scott Sampson", "Jeremiah Hemphill"]
Expand Down
17 changes: 12 additions & 5 deletions lib/generators/devisable/devisable_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ def initialize(*runtime_args)
@@actual_configuration_options['cucumber'] = true
end
opts.on("-j", "--jslibrary (jquery|prototype)", String, "write out using the jquery or prototype libraries") do |j|
if j =~ /jquery/i
@@actual_configuration_options['jslibrary'] = 'jquery'
elsif j =~ /prototype/i
@@actual_configuration_options['jslibrary'] = 'prototype'
end
# otherwise use command lines options
lib = 'jquery' if j =~ /jquery/i
lib = 'prototype' if j =~ /prototype/i

@@actual_configuration_options['jslibrary'] = lib
end
end.parse!
execute
Expand Down Expand Up @@ -408,6 +408,13 @@ def new_project

#adds the javascript for the role permissions checkboxes
def add_javascript
# if no jslibrary has been selected yet
if @@actual_configuration_options['jslibrary'] == ''
# if the version is >= 3.1.0, then jquery is the default. otherwise, prototype
version = Rails.version.split('.').collect{|t|t.to_i}
@@actual_configuration_options['jslibrary'] = (version[0] >= 3 && version[1] >= 1) ? 'jquery' : 'prototype'
end

rep_str = load_erb_string('partials/_permission_manage_' + @@actual_configuration_options['jslibrary'] + '.js')
append_to_file "public/javascripts/application.js", rep_str
end
Expand Down