Module: Anaconda
- Defined in:
- lib/anaconda.rb,
lib/anaconda/engine.rb,
lib/anaconda/errors.rb,
lib/anaconda/railtie.rb,
lib/anaconda/version.rb,
lib/anaconda/anaconda.rb,
lib/anaconda/anaconda_for.rb,
lib/anaconda/upload_helper.rb,
lib/anaconda/form_builder_helpers.rb,
lib/generators/anaconda/install_generator.rb,
lib/generators/anaconda/migration_generator.rb
Defined Under Namespace
Modules: FormBuilderHelpers, Model, Rails, UploadHelper Classes: AnacondaError, Error, InstallGenerator, MigrationGenerator, Railtie
Constant Summary collapse
- MagicMethods =
[:url]
- @@aws =
{ aws_access_key: "", aws_secret_key: "", aws_bucket: "" }
- @@file_types =
{ audio: /(\.|\/)(wav|mp3|m4a|aiff|ogg|flac)$/, video: /(\.|\/)(mp[e]?g|mov|avi|mp4|m4v)$/, image: /(\.|\/)(jp[e]?g|png|bmp)$/, resource: /(\.|\/)(pdf|ppt[x]?|doc[x]?|xls[x]?)$/, }
Class Method Summary collapse
-
.config {|_self| ... } ⇒ Object
Default way to setup Anaconda.
- .js_file_types ⇒ Object
Class Method Details
.config {|_self| ... } ⇒ Object
Default way to setup Anaconda. Run rails generate anaconda:install to create a fresh initializer with all configuration values.
30 31 32 |
# File 'lib/anaconda.rb', line 30 def self.config yield self end |
.js_file_types ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/anaconda.rb', line 34 def self.js_file_types # http://stackoverflow.com/questions/4854714/how-to-translate-ruby-regex-to-javascript-i-mx-and-rails-3-0-3 js_file_types = {} file_types.each do |group_name, regexp| str = regexp.inspect. sub('\\A' , '^'). sub('\\Z' , '$'). sub('\\z' , '$'). sub(/^\// , ''). sub(/\/[a-z]*$/ , ''). gsub(/\(\?#.+\)/ , ''). gsub(/\(\?-\w+:/ , '('). gsub(/\s/ , '') regexp_str = Regexp.new(str).source js_file_types[group_name.to_s] = regexp_str end return js_file_types end |