uploadcolumn 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/Rakefile +0 -43
  2. data/VERSION +1 -1
  3. data/lib/upload_column/magic_columns.rb +16 -15
  4. metadata +15 -10
data/Rakefile CHANGED
@@ -1,8 +1,6 @@
1
1
  require 'rake'
2
2
  require 'rake/testtask'
3
3
  require 'rake/rdoctask'
4
- require 'spec/rake/spectask'
5
-
6
4
 
7
5
  begin
8
6
  require 'jeweler'
@@ -19,49 +17,8 @@ rescue LoadError
19
17
  puts "Jeweler not available. Install it with: gem install jeweler"
20
18
  end
21
19
 
22
-
23
-
24
20
  file_list = FileList['spec/*_spec.rb']
25
21
 
26
- namespace :spec do
27
- desc "Run all examples with RCov"
28
- Spec::Rake::SpecTask.new('rcov') do |t|
29
- t.spec_files = file_list
30
- t.rcov = true
31
- t.rcov_dir = "doc/coverage"
32
- t.rcov_opts = ['--exclude', 'spec']
33
- end
34
-
35
- desc "Generate an html report"
36
- Spec::Rake::SpecTask.new('report') do |t|
37
- t.spec_files = file_list
38
- t.rcov = true
39
- t.rcov_dir = "doc/coverage"
40
- t.rcov_opts = ['--exclude', 'spec']
41
- t.spec_opts = ["--format", "html:doc/reports/specs.html"]
42
- t.fail_on_error = false
43
- end
44
-
45
- desc "heckle all"
46
- task :heckle => [ 'spec:heckle:uploaded_file', 'spec:heckle:sanitized_file' ]
47
-
48
- namespace :heckle do
49
- desc "Heckle UploadedFile"
50
- Spec::Rake::SpecTask.new('uploaded_file') do |t|
51
- t.spec_files = [ File.join(File.dirname(__FILE__), *%w[spec uploaded_file_spec.rb]) ]
52
- t.spec_opts = ["--heckle", "UploadColumn::UploadedFile"]
53
- end
54
-
55
- desc "Heckle SanitizedFile"
56
- Spec::Rake::SpecTask.new('sanitized_file') do |t|
57
- t.spec_files = [ File.join(File.dirname(__FILE__), *%w[spec uploaded_file_spec.rb]) ]
58
- t.spec_opts = ["--heckle", "UploadColumn::SanitizedFile"]
59
- end
60
- end
61
-
62
- end
63
-
64
-
65
22
  desc 'Default: run unit tests.'
66
23
  task :default => 'spec:rcov'
67
24
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.2
1
+ 0.3.3
@@ -1,50 +1,51 @@
1
1
  module UploadColumn
2
2
  module MagicColumns
3
-
3
+
4
4
  def self.included(base)
5
5
  super
6
6
  base.send :alias_method_chain, :set_upload_column, :magic_columns
7
7
  base.send :alias_method_chain, :set_upload_column_temp, :magic_columns
8
8
  base.send :alias_method_chain, :save_uploaded_files, :magic_columns
9
9
  end
10
-
10
+
11
11
  def set_upload_column_with_magic_columns(name, file)
12
12
  set_upload_column_without_magic_columns(name, file)
13
13
  evaluate_magic_columns_for_upload_column(name)
14
14
  end
15
-
15
+
16
16
  def set_upload_column_temp_with_magic_columns(name, path)
17
17
  set_upload_column_temp_without_magic_columns(name, path)
18
18
  evaluate_magic_columns_for_upload_column(name)
19
19
  end
20
-
20
+
21
21
  def save_uploaded_files_with_magic_columns
22
22
  save_uploaded_files_without_magic_columns
23
23
  self.class.reflect_on_upload_columns.each do |name, column|
24
24
  evaluate_magic_columns_for_upload_column(name)
25
25
  end
26
26
  end
27
-
27
+
28
28
  private
29
-
29
+
30
30
  def evaluate_magic_columns_for_upload_column(name)
31
-
31
+
32
32
  self.class.column_names.each do |column_name|
33
-
33
+
34
34
  statement, predicate = column_name.split('_', 2)
35
-
35
+
36
36
  if statement and predicate and name.to_s == statement and not self.read_attribute(column_name.to_sym)
37
37
  uploaded_file = self.send(:get_upload_column, name.to_sym)
38
-
39
- self.write_attribute(column_name.to_sym, handle_predicate(uploaded_file, predicate))
38
+
39
+ super(column_name.to_sym, handle_predicate(uploaded_file, predicate))
40
40
  end
41
-
41
+
42
42
  end
43
43
  end
44
-
44
+
45
45
  def handle_predicate(uploaded_file, predicate)
46
46
  return uploaded_file.send(predicate.to_sym) if uploaded_file.respond_to?(predicate.to_sym)
47
47
  end
48
-
48
+
49
49
  end
50
- end
50
+ end
51
+
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uploadcolumn
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 21
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
8
  - 3
8
- - 2
9
- version: 0.3.2
9
+ - 3
10
+ version: 0.3.3
10
11
  platform: ruby
11
12
  authors:
12
13
  - Dave Hrycyszyn
@@ -16,7 +17,7 @@ autorequire:
16
17
  bindir: bin
17
18
  cert_chain: []
18
19
 
19
- date: 2010-03-20 00:00:00 +00:00
20
+ date: 2011-04-17 00:00:00 +01:00
20
21
  default_executable:
21
22
  dependencies: []
22
23
 
@@ -75,34 +76,38 @@ rdoc_options:
75
76
  require_paths:
76
77
  - lib
77
78
  required_ruby_version: !ruby/object:Gem::Requirement
79
+ none: false
78
80
  requirements:
79
81
  - - ">="
80
82
  - !ruby/object:Gem::Version
83
+ hash: 3
81
84
  segments:
82
85
  - 0
83
86
  version: "0"
84
87
  required_rubygems_version: !ruby/object:Gem::Requirement
88
+ none: false
85
89
  requirements:
86
90
  - - ">="
87
91
  - !ruby/object:Gem::Version
92
+ hash: 3
88
93
  segments:
89
94
  - 0
90
95
  version: "0"
91
96
  requirements: []
92
97
 
93
98
  rubyforge_project:
94
- rubygems_version: 1.3.6
99
+ rubygems_version: 1.3.7
95
100
  signing_key:
96
101
  specification_version: 3
97
102
  summary: Enables easy uploading of files, especially images.
98
103
  test_files:
99
- - spec/active_record_extension_spec.rb
100
- - spec/sanitized_file_spec.rb
101
- - spec/magic_columns_spec.rb
102
104
  - spec/spec_helper.rb
103
- - spec/image_science_manipulator_spec.rb
104
- - spec/upload_column_spec.rb
105
- - spec/custom_matchers.rb
106
105
  - spec/uploaded_file_spec.rb
107
106
  - spec/integration_spec.rb
107
+ - spec/active_record_extension_spec.rb
108
+ - spec/magic_columns_spec.rb
109
+ - spec/upload_column_spec.rb
110
+ - spec/image_science_manipulator_spec.rb
111
+ - spec/sanitized_file_spec.rb
108
112
  - spec/rmagick_manipulator_spec.rb
113
+ - spec/custom_matchers.rb