joint 0.5 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ .DS_Store
2
+ log/*
3
+ tmp/*
4
+ doc/*
5
+ pkg/*
6
+ .bundle
7
+ *.swp
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem 'i18n'
4
+ gem 'bson_ext', '~> 1.1', :require => false
5
+ gemspec
@@ -0,0 +1,47 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ joint (0.5)
5
+ mime-types
6
+ mongo_mapper (~> 0.8.6)
7
+ wand (~> 0.3)
8
+
9
+ GEM
10
+ remote: http://rubygems.org/
11
+ specs:
12
+ activesupport (3.0.3)
13
+ bson (1.1.5)
14
+ bson_ext (1.1.5)
15
+ i18n (0.4.2)
16
+ jnunemaker-matchy (0.4.0)
17
+ jnunemaker-validatable (1.8.4)
18
+ activesupport (>= 2.3.4)
19
+ mime-types (1.16)
20
+ mocha (0.9.10)
21
+ rake
22
+ mongo (1.1.5)
23
+ bson (>= 1.1.5)
24
+ mongo_mapper (0.8.6)
25
+ activesupport (>= 2.3.4)
26
+ jnunemaker-validatable (~> 1.8.4)
27
+ plucky (~> 0.3.6)
28
+ plucky (0.3.6)
29
+ mongo (~> 1.1)
30
+ rake (0.8.7)
31
+ shoulda (2.11.3)
32
+ wand (0.3)
33
+ mime-types
34
+
35
+ PLATFORMS
36
+ ruby
37
+
38
+ DEPENDENCIES
39
+ bson_ext (~> 1.1)
40
+ i18n
41
+ jnunemaker-matchy
42
+ joint!
43
+ mime-types
44
+ mocha
45
+ mongo_mapper (~> 0.8.6)
46
+ shoulda
47
+ wand (~> 0.3)
@@ -0,0 +1,12 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
3
+
4
+ require 'rake/testtask'
5
+ Rake::TestTask.new do |test|
6
+ test.libs << 'lib' << 'test'
7
+ test.pattern = 'test/**/test_*.rb'
8
+ test.ruby_opts = ['-rubygems']
9
+ test.verbose = true
10
+ end
11
+
12
+ task :default => :test
@@ -0,0 +1,25 @@
1
+ # encoding: UTF-8
2
+ require File.expand_path('../lib/joint/version', __FILE__)
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "joint"
6
+ s.summary = %Q{MongoMapper and GridFS joined in file upload love.}
7
+ s.description = %Q{MongoMapper and GridFS joined in file upload love.}
8
+ s.email = "nunemaker@gmail.com"
9
+ s.homepage = "http://github.com/jnunemaker/joint"
10
+ s.authors = ["John Nunemaker"]
11
+ s.version = Joint::Version
12
+
13
+ s.add_dependency 'wand', '~> 0.3'
14
+ s.add_dependency 'mime-types'
15
+ s.add_dependency 'mongo_mapper', '~> 0.8.6'
16
+
17
+ s.add_development_dependency 'shoulda'
18
+ s.add_development_dependency 'mocha'
19
+ s.add_development_dependency 'jnunemaker-matchy'
20
+
21
+ s.files = `git ls-files`.split("\n")
22
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
23
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
24
+ s.require_paths = ["lib"]
25
+ end
@@ -49,7 +49,7 @@ module Joint
49
49
  else
50
50
  send("#{name}_id=", BSON::ObjectId.new) if send("#{name}_id").nil?
51
51
  send("#{name}_size=", File.size(file))
52
- send("#{name}_type=", Wand.wave(file.path))
52
+ send("#{name}_type=", Wand.wave(file.path, :original_filename => Joint.file_name(file)))
53
53
  send("#{name}_name=", Joint.file_name(file))
54
54
  assigned_attachments[:#{name}] = file
55
55
  nil_attachments.delete(:#{name})
@@ -1,3 +1,3 @@
1
1
  module Joint
2
- Version = '0.5'
2
+ Version = '0.5.1'
3
3
  end
@@ -0,0 +1,51 @@
1
+ def growl(title, msg, img)
2
+ %x{growlnotify -m #{ msg.inspect} -t #{title.inspect} --image ~/.watchr/#{img}.png}
3
+ end
4
+
5
+ def form_growl_message(str)
6
+ results = str.split("\n").last
7
+ if results =~ /[1-9]\s(failure|error)s?/
8
+ growl "Test Results", "#{results}", "fail"
9
+ elsif results != ""
10
+ growl "Test Results", "#{results}", "pass"
11
+ end
12
+ end
13
+
14
+ def run(cmd)
15
+ puts(cmd)
16
+ output = ""
17
+ IO.popen(cmd) do |com|
18
+ com.each_char do |c|
19
+ print c
20
+ output << c
21
+ $stdout.flush
22
+ end
23
+ end
24
+ form_growl_message output
25
+ end
26
+
27
+ def run_test_file(file)
28
+ run %Q(ruby -I"lib:test" -rubygems #{file})
29
+ end
30
+
31
+ def run_all_tests
32
+ run "rake test"
33
+ end
34
+
35
+ def related_test_files(path)
36
+ Dir['test/**/*.rb'].select { |file| file =~ /test_#{File.basename(path)}/ }
37
+ end
38
+
39
+ watch('test/test_helper\.rb') { system('clear'); run_all_tests }
40
+ watch('test/test_.*\.rb') { |m| system('clear'); run_test_file(m[0]) }
41
+ watch('lib/.*') { |m| related_test_files(m[0]).each { |file| run_test_file(file) } }
42
+
43
+ # Ctrl-\
44
+ Signal.trap('QUIT') do
45
+ puts " --- Running all tests ---\n\n"
46
+ run_all_tests
47
+ end
48
+
49
+ # Ctrl-C
50
+ Signal.trap('INT') { abort("\n") }
51
+
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: joint
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1
4
+ hash: 9
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- version: "0.5"
9
+ - 1
10
+ version: 0.5.1
10
11
  platform: ruby
11
12
  authors:
12
13
  - John Nunemaker
@@ -14,7 +15,7 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-12-06 00:00:00 -05:00
18
+ date: 2010-12-20 00:00:00 -05:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
@@ -25,12 +26,11 @@ dependencies:
25
26
  requirements:
26
27
  - - ~>
27
28
  - !ruby/object:Gem::Version
28
- hash: 21
29
+ hash: 13
29
30
  segments:
30
31
  - 0
31
- - 2
32
- - 1
33
- version: 0.2.1
32
+ - 3
33
+ version: "0.3"
34
34
  type: :runtime
35
35
  version_requirements: *id001
36
36
  - !ruby/object:Gem::Dependency
@@ -114,8 +114,16 @@ extensions: []
114
114
  extra_rdoc_files: []
115
115
 
116
116
  files:
117
- - lib/joint/version.rb
117
+ - .gitignore
118
+ - Gemfile
119
+ - Gemfile.lock
120
+ - LICENSE
121
+ - README.rdoc
122
+ - Rakefile
123
+ - joint.gemspec
118
124
  - lib/joint.rb
125
+ - lib/joint/version.rb
126
+ - specs.watchr
119
127
  - test/fixtures/harmony.png
120
128
  - test/fixtures/mr_t.jpg
121
129
  - test/fixtures/test1.txt
@@ -123,8 +131,6 @@ files:
123
131
  - test/fixtures/unixref.pdf
124
132
  - test/helper.rb
125
133
  - test/test_joint.rb
126
- - LICENSE
127
- - README.rdoc
128
134
  has_rdoc: true
129
135
  homepage: http://github.com/jnunemaker/joint
130
136
  licenses: []