dropzonejs-rails 0.3.2 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YTkwMTIzM2RiNzE2ZGEwMDFhNTIzN2M3ZTc4MzBmZWUzYzk2YjFlNA==
4
+ ZjdkMDExZWY2ZGMyYTk0ODdkNWZjMGNjYzFhNTQwYzI0YjMwNzM2OQ==
5
5
  data.tar.gz: !binary |-
6
- ZWMyNDZkYjZiY2M0NGExMDhmYWY4MjM3MDZhZTAxMTI4Y2RkMDZjOA==
6
+ MzdiZmQxNTc0ZGE5MTVmMzIzMjY0MzU5OWE0ZjcwZWIyZjYzNDcxMQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ODc0MjFhNjJkYzQxY2YwNTBjYTdhNjZkZTFhY2I1OTNiYTExM2U0Njc4ZTdh
10
- MTJhMmNhODU5YTZhOTE5MzdkZjA3ZTRkOTcwMDg2NThhZGUxZWRkYTI1ZWNj
11
- MjFiNTAzM2FiY2EzMzcxNmMzNDZhM2I5MDA1YTRlODNhMTY1MWI=
9
+ ZTMzZjc5OGFmMGEyMTFmNjk2MDVjMTIzY2MxYzY3MGYxN2E4MjYyNWE1ZTU4
10
+ ZjZiZjg3MTRiNzRlMDFjYjMzZjE0MTNiOGFlYzczOTIwNmVkZWQyZWQzN2Jk
11
+ NjBmZTE0MmI3NGMyMDE3YTNiYmRiMDk0ZGNlYWRiM2Q1MDlhOWU=
12
12
  data.tar.gz: !binary |-
13
- YTZkYzNkNzRlZTJjZWIxMzRkYTI0MGVhOWQyZTRhYTI1MmFjY2QyOTdlZTgx
14
- YTRkMDVkMDU5MzlkNGUyNDg0MDUwODk4YWRlMjlmOTViYTM1ZWNkZDQ3NjEy
15
- ZjM3OGZkNmEzMzk5NTE5NDVjYWEyNmI1MmYzOTM5MGRkZGE1ZTk=
13
+ YmFkYjM3OTUzNDNhMzE5MjZiNjJiZDA4MGUxNTI3MDBiMDVjYmFlNjA3NjJl
14
+ ZmRkYWMwNmIzNmRhMDFjNWZmNGE4NTVmNzlhMTEyOTVhZmM2ODIyMjk2OTM4
15
+ NzIzNDNhZmEyYmMwNzM2MGZjMTdjNDk5ZDkyZWU1YTI1MTcxMGI=
data/README.md CHANGED
@@ -53,8 +53,8 @@ Go to [this secret place](https://github.com/ncuesta/dropzonejs-rails/issues).
53
53
 
54
54
  ### Getting the latest version of Dropzone
55
55
 
56
- 1. Update `DropzonejsRails::DROPZONE_VERSION` to the newest version of Dropzone.
57
- 1. Do a `rake get` - it'll download the file four you.
56
+ 1. Run `rake check` to see if there is a newer version of Dropzone available.
57
+ 2. If **1.** tells you to do so, run `rake get` - it'll download the files four you.
58
58
 
59
59
 
60
60
  ## Licence (MIT)
data/Rakefile CHANGED
@@ -7,19 +7,45 @@ end
7
7
 
8
8
  Bundler::GemHelper.install_tasks
9
9
 
10
- require 'dropzonejs-rails'
11
10
  require 'open-uri'
11
+ require 'octokit'
12
+ require 'dropzonejs-rails'
12
13
 
13
14
  desc 'Get latest dropzone js build'
14
15
  task :get do
16
+ puts "Fetching dropzone v#{DropzonejsRails::DROPZONE_VERSION}..."
17
+
15
18
  download_dropzone_file 'dropzone.js', 'vendor/assets/javascripts/dropzone.js'
16
19
  download_dropzone_file 'css/basic.css', 'vendor/assets/stylesheets/dropzone/basic.css.scss'
17
20
  download_dropzone_file 'css/dropzone.css', 'vendor/assets/stylesheets/dropzone/dropzone.css.scss'
18
21
  download_dropzone_file 'images/spritemap.png', 'vendor/assets/images/dropzone/spritemap.png'
19
22
  download_dropzone_file 'images/spritemap@2x.png', 'vendor/assets/images/dropzone/spritemap@2x.png'
20
23
 
24
+ puts "Fixing image paths..."
21
25
  fix_image_links 'vendor/assets/stylesheets/dropzone/basic.css.scss'
22
26
  fix_image_links 'vendor/assets/stylesheets/dropzone/dropzone.css.scss'
27
+
28
+ puts "Done."
29
+ end
30
+
31
+ desc 'Find the latest dropzone js version and get it'
32
+ task :check do
33
+ latest_version = Octokit.tags('enyo/dropzone').first.name.gsub(/[^\d\.]/, '')
34
+
35
+ if latest_version != DropzonejsRails::DROPZONE_VERSION
36
+ version = File.join(File.dirname(__FILE__), 'lib', 'dropzonejs-rails', 'version.rb')
37
+ sed version, {
38
+ /DROPZONE_VERSION\s+=\s+'#{DropzonejsRails::DROPZONE_VERSION}'/ => "DROPZONE_VERSION = '#{latest_version}'",
39
+ /\sVERSION\s+=\s+'#{DropzonejsRails::VERSION}'/ => " VERSION = '#{new_version}'"
40
+ }
41
+
42
+ readme = File.join(File.dirname(__FILE__), 'README.md')
43
+ sed readme, { /\*\*Dropzone v#{DropzonejsRails::DROPZONE_VERSION}\*\*/ => "**Dropzone v#{latest_version}**" }
44
+
45
+ puts "A new version of dropzone (v#{latest_version}) has been found, and the source files have been accordingly updated.\nYou may now run: `rake get` to get it."
46
+ else
47
+ puts "The bundled version of dropzone (v#{DropzonejsRails::DROPZONE_VERSION}) already is the latest one."
48
+ end
23
49
  end
24
50
 
25
51
  def download_dropzone_file(source_file, target_file)
@@ -30,8 +56,23 @@ def download_dropzone_file(source_file, target_file)
30
56
  end
31
57
 
32
58
  def fix_image_links(css_file)
33
- file_name = DropzonejsRails::Engine.root.join(css_file)
59
+ file_name = DropzonejsRails::Engine.root.join(css_file)
34
60
  original_css = File.read(file_name)
35
- fixed_css = original_css.gsub(/url\(\"\.\.\/images\/(.+\.png)\"\)/, 'image-path("dropzone/\1")')
36
- File.open(file_name, "w") {|file| file << fixed_css}
61
+ fixed_css = original_css.gsub(/url\(\"\.\.\/images\/(.+\.png)\"\)/, 'image-path("dropzone/\1")')
62
+
63
+ File.open(file_name, 'w') { |file| file << fixed_css }
37
64
  end
65
+
66
+ def sed(filename, replacements)
67
+ contents = File.read(filename)
68
+ replacements.each_pair do |pattern, replacement|
69
+ contents.gsub!(pattern, replacement)
70
+ end
71
+ File.write filename, contents
72
+ end
73
+
74
+ def new_version
75
+ parts = DropzonejsRails::VERSION.split('.')
76
+ parts[2] = parts[2].to_i + 1
77
+ parts.join '.'
78
+ end
@@ -1,4 +1,4 @@
1
1
  module DropzonejsRails
2
- VERSION = '0.3.2'
2
+ VERSION = '0.4.0'
3
3
  DROPZONE_VERSION = '3.2.0'
4
4
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dropzonejs-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - José Nahuel Cuesta Luengo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-30 00:00:00.000000000 Z
11
+ date: 2013-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: octokit
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: rails
15
29
  requirement: !ruby/object:Gem::Requirement