cowtech-rails 2.8.2 → 2.8.3
Sign up to get free protection for your applications and to get access to all the features.
- data/app/helpers/cowtech/ruby_on_rails/helpers/ar_crud_helper.rb +5 -5
- data/app/models/cowtech/ruby_on_rails/models/e_mail.rb +21 -18
- data/app/models/cowtech/ruby_on_rails/models/mongoid/cowtech.rb +1 -1
- data/lib/cowtech/tasks/app.rake +2 -2
- data/lib/cowtech/tasks/sql.rake +3 -2
- data/lib/cowtech/version.rb +1 -1
- metadata +3 -3
@@ -107,7 +107,7 @@ module Cowtech
|
|
107
107
|
search = "(@#{search}@)"
|
108
108
|
search.gsub!(/(\s+(AND|OR|NOT)\s+)/, "@) \\1 (@")
|
109
109
|
|
110
|
-
#
|
110
|
+
# Substitute parameters
|
111
111
|
i = -1
|
112
112
|
parameters = {}
|
113
113
|
search.gsub!(/@(.+?)@/) do |s|
|
@@ -146,18 +146,18 @@ module Cowtech
|
|
146
146
|
|
147
147
|
self.crud_query_add_condition(data, "(#{self.crud_get_class(data).table_name}.#{self.crud_get_class(data).deleted_column} IS NULL)", {}) if !data[:skip_deleted]
|
148
148
|
|
149
|
-
#
|
149
|
+
# Get query
|
150
150
|
args = params[parameter] if !args
|
151
151
|
|
152
152
|
if args.present? then
|
153
153
|
search, parameters = self.crud_query_parse_search(args)
|
154
154
|
|
155
|
-
#
|
155
|
+
# Build query
|
156
156
|
data[:query_params].merge!(parameters)
|
157
157
|
search_query = []
|
158
158
|
fields.each { |field| search_query << "(#{search.gsub("@FIELD@", "#{self.crud_get_class(data).table_name}.#{field.to_s}")})" }
|
159
159
|
|
160
|
-
#
|
160
|
+
# Add optional data
|
161
161
|
if externals then
|
162
162
|
externals.each do |external|
|
163
163
|
external_query = ""
|
@@ -230,7 +230,7 @@ module Cowtech
|
|
230
230
|
sf = sort_by.split("-")
|
231
231
|
rv = OpenStruct.new({:what => mo["what"], :how => mo["how"].upcase})
|
232
232
|
|
233
|
-
#
|
233
|
+
# Adapt some parameters
|
234
234
|
rv.what = "status_id" if rv.what == "status"
|
235
235
|
|
236
236
|
rv
|
@@ -8,14 +8,19 @@ module Cowtech
|
|
8
8
|
module RubyOnRails
|
9
9
|
module Models
|
10
10
|
class EMail < ActionMailer::Base
|
11
|
-
def self.setup(method = :smtp,
|
12
|
-
|
13
|
-
rv = YAML.load_file(file || (Rails.root + "config/email.yml"))
|
14
|
-
rescue Exception => e
|
15
|
-
raise e if raise_config_errors
|
16
|
-
rv = {}
|
17
|
-
end
|
11
|
+
def self.setup(method = :smtp, config = nil, raise_config_errors = true)
|
12
|
+
rv = {}
|
18
13
|
|
14
|
+
if config.is_a?(Hash) then
|
15
|
+
rv = config
|
16
|
+
else
|
17
|
+
begin
|
18
|
+
rv = YAML.load_file(config || (Rails.root + "config/email.yml"))
|
19
|
+
rescue Exception => e
|
20
|
+
raise e if raise_config_errors
|
21
|
+
rv = {}
|
22
|
+
end
|
23
|
+
end
|
19
24
|
|
20
25
|
ActionMailer::Base.raise_delivery_errors = true
|
21
26
|
ActionMailer::Base.delivery_method = method
|
@@ -30,37 +35,35 @@ module Cowtech
|
|
30
35
|
rv
|
31
36
|
end
|
32
37
|
|
33
|
-
def setup(method = :smtp,
|
34
|
-
@configuration ||= EMail.setup(method,
|
38
|
+
def setup(method = :smtp, config = nil, raise_config_errors = true)
|
39
|
+
@configuration ||= EMail.setup(method, config, raise_config_errors)
|
35
40
|
end
|
36
41
|
|
37
42
|
def generic(args)
|
38
43
|
# Load configuration
|
39
44
|
if !@configuration then
|
40
|
-
|
45
|
+
config = args.delete(:configuration)
|
41
46
|
|
42
|
-
if
|
43
|
-
|
47
|
+
if config.is_a?(Hash) then
|
48
|
+
self.setup(config[:method] || args.delete(:method) || :smtp, config)
|
44
49
|
else
|
45
50
|
self.setup(args.delete(:method) || :smtp, args.delete(:configuration_file))
|
46
51
|
end
|
47
52
|
end
|
48
53
|
|
49
|
-
#
|
54
|
+
# Get arguments and add reply-to
|
50
55
|
args = (args.is_a?(Hash) ? args : args[0]).delete_if { |k,v| v.blank? }
|
51
|
-
|
52
|
-
# AGGIUSTIAMO REPLY TO
|
53
56
|
args[:reply_to] = args[:from] if !args[:reply_to]
|
54
57
|
|
55
|
-
#
|
58
|
+
# Get body
|
56
59
|
plain_body = args.delete(:body) || args.delete(:plain_body) || args.delete(:text_body) || args.delete(:plain_text) || args.delete(:text)
|
57
60
|
html_body = args.delete(:html_body) || args.delete(:html)
|
58
61
|
|
59
62
|
mail(args) do |format|
|
60
|
-
if plain_body then
|
63
|
+
if plain_body then
|
61
64
|
format.text { render :text => plain_body }
|
62
65
|
end
|
63
|
-
if html_body then
|
66
|
+
if html_body then
|
64
67
|
format.html { render :text => html_body }
|
65
68
|
end
|
66
69
|
end
|
data/lib/cowtech/tasks/app.rake
CHANGED
@@ -102,11 +102,11 @@ namespace :css do
|
|
102
102
|
task :regenerate => :environment do |task|
|
103
103
|
puts "Regenerating CSS..."
|
104
104
|
|
105
|
-
if defined?(Less) then #
|
105
|
+
if defined?(Less) then # More
|
106
106
|
puts "Using More"
|
107
107
|
Rake::Task["more:clean"].execute
|
108
108
|
Rake::Task["more:generate"].execute
|
109
|
-
elsif defined?(Sass) #
|
109
|
+
elsif defined?(Sass) # Sass
|
110
110
|
Sass::Plugin.on_updating_stylesheet do |template, css|
|
111
111
|
puts "[SCSS] Compiling #{template} to #{css} ..."
|
112
112
|
end
|
data/lib/cowtech/tasks/sql.rake
CHANGED
@@ -80,11 +80,12 @@ module Cowtech
|
|
80
80
|
|
81
81
|
def self.backup(rake_args)
|
82
82
|
Cowtech::RubyOnRails::Scheduler.log "--- Backupping database ..."
|
83
|
-
|
83
|
+
|
84
|
+
# Get configuration
|
84
85
|
db_config = YAML.load_file(Rails.root + "config/database.yml")
|
85
86
|
env = Rails.env
|
86
87
|
|
87
|
-
#
|
88
|
+
# Execute
|
88
89
|
Cowtech::RubyOnRails::MysqlUtils.send("#{db_config[env]["adapter"]}_execute", db_config[env], rake_args)
|
89
90
|
end
|
90
91
|
|
data/lib/cowtech/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cowtech-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.8.
|
4
|
+
version: 2.8.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-04-15 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: cowtech-extensions
|
16
|
-
requirement: &
|
16
|
+
requirement: &70301460461200 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70301460461200
|
25
25
|
description: A general purpose Rails utility plugin.
|
26
26
|
email: shogun_panda@me.com
|
27
27
|
executables: []
|