picturama 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,2 +1,3 @@
1
1
  .rvmrc
2
2
  config/config.yml
3
+ coverage/
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 1.9.3p286
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 1.9.2
5
+ - 2.0.0
data/Gemfile CHANGED
@@ -1,7 +1,11 @@
1
- source :rubygems
1
+ source 'https://rubygems.org'
2
2
 
3
- gem "mini_magick", "~> 3.6.0"
3
+ gem 'rake'
4
4
 
5
5
  group :test, :development do
6
6
  gem 'rspec'
7
- end
7
+ end
8
+
9
+ gem 'coveralls', require: false
10
+
11
+ gemspec
data/Gemfile.lock CHANGED
@@ -1,9 +1,28 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ picturama (0.0.2)
5
+ mini_magick (~> 3.6.0)
6
+ stringex (~> 2.0.2)
7
+
1
8
  GEM
2
- remote: http://rubygems.org/
9
+ remote: https://rubygems.org/
3
10
  specs:
11
+ colorize (0.5.8)
12
+ coveralls (0.6.7)
13
+ colorize
14
+ multi_json (~> 1.3)
15
+ rest-client
16
+ simplecov (>= 0.7)
17
+ thor
4
18
  diff-lcs (1.2.4)
19
+ mime-types (1.23)
5
20
  mini_magick (3.6.0)
6
21
  subexec (~> 0.2.1)
22
+ multi_json (1.7.6)
23
+ rake (10.0.3)
24
+ rest-client (1.6.7)
25
+ mime-types (>= 1.16)
7
26
  rspec (2.13.0)
8
27
  rspec-core (~> 2.13.0)
9
28
  rspec-expectations (~> 2.13.0)
@@ -12,11 +31,19 @@ GEM
12
31
  rspec-expectations (2.13.0)
13
32
  diff-lcs (>= 1.1.3, < 2.0)
14
33
  rspec-mocks (2.13.1)
34
+ simplecov (0.7.1)
35
+ multi_json (~> 1.0)
36
+ simplecov-html (~> 0.7.1)
37
+ simplecov-html (0.7.1)
38
+ stringex (2.0.2)
15
39
  subexec (0.2.3)
40
+ thor (0.18.1)
16
41
 
17
42
  PLATFORMS
18
43
  ruby
19
44
 
20
45
  DEPENDENCIES
21
- mini_magick (~> 3.6.0)
46
+ coveralls
47
+ picturama!
48
+ rake
22
49
  rspec
data/README.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Pictorama
2
2
 
3
+ [![Build Status](https://travis-ci.org/aboyon/pictorama.png?branch=master)](https://travis-ci.org/aboyon/pictorama)
4
+ [![Code Climate](https://codeclimate.com/github/aboyon/pictorama.png)](https://codeclimate.com/github/aboyon/pictorama)
5
+ [![Coverage Status](https://coveralls.io/repos/aboyon/pictorama/badge.png)](https://coveralls.io/r/aboyon/pictorama)
6
+
7
+
3
8
  Welcome to *Pictorama*. An easy picture gallery based on directory and files
4
9
 
5
10
  ### How to install
@@ -35,9 +40,9 @@ and then you'll get an answer like this:
35
40
  ```
36
41
  Generating 30 thumbnails for folder /some/folder/ ...
37
42
  Size: 200x200
38
- Thumbnail generated for source 1.JPG. Target destination thumb_1.JPG
39
- Thumbnail generated for source 2.JPG. Target destination thumb_2.JPG
43
+ Thumbnail generated from source 1.JPG. Target destination thumb_1.JPG
44
+ Thumbnail generated from source 2.JPG. Target destination thumb_2.JPG
40
45
  ```
41
46
  # License
42
47
 
43
- Please [see licence file](https://github.com/aboyon/pictorama/blob/master/LICENCE) for further reading.
48
+ Please [see licence file](https://github.com/aboyon/pictorama/blob/master/LICENCE) for further reading.
data/lib/ext/string.rb CHANGED
@@ -1,13 +1,9 @@
1
1
  class String
2
2
 
3
- def humanize(options)
3
+ def humanize
4
4
 
5
5
  if include?("-")
6
- split("-").join(" ").downcase
7
- end
8
-
9
- if (options == :all_caps)
10
- capitalize!
6
+ self.split("-").join(" ").downcase
11
7
  end
12
8
 
13
9
  end
data/lib/picturama.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'ext/string'
2
+ require 'stringex'
1
3
  require 'fileutils'
2
4
  require 'picturama/album'
3
5
  require 'picturama/picture'
@@ -18,7 +20,7 @@ module Picturama
18
20
  Dir["#{album_source}/*"].each { |album|
19
21
  if File.directory?(album)
20
22
  potential_album = Picturama::Album.new(:folder => album)
21
- albums.push(album)
23
+ albums.push(potential_album)
22
24
  end
23
25
  }
24
26
  albums
@@ -24,8 +24,16 @@ module Picturama
24
24
  end
25
25
  end
26
26
 
27
+ def folder
28
+ File.basename(@folder)
29
+ end
30
+
27
31
  def name
28
- File.basename(@folder).humanize
32
+ folder.humanize
33
+ end
34
+
35
+ def slug
36
+ name.to_url
29
37
  end
30
38
 
31
39
  def count_pictures
@@ -1,3 +1,3 @@
1
1
  module Picturama
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
data/picturama.gemspec CHANGED
@@ -12,6 +12,7 @@ Gem::Specification.new do |s|
12
12
  s.homepage = 'http://davidsilveira.me/picturama'
13
13
 
14
14
  s.add_dependency('mini_magick', '~> 3.6.0')
15
+ s.add_dependency('stringex', '~> 2.0.2')
15
16
 
16
17
  s.add_development_dependency 'rspec'
17
18
 
data/rakefile CHANGED
@@ -1,9 +1,14 @@
1
+ # encoding: utf-8
2
+ #!/usr/bin/env rake
1
3
  $:.push File.expand_path("../lib", __FILE__)
2
4
 
3
5
  require 'rubygems'
4
6
  require 'fileutils'
5
7
  require 'picturama'
6
8
  require 'mini_magick'
9
+ require "bundler/gem_tasks"
10
+ require "rake"
11
+ require "rake/testtask"
7
12
 
8
13
  namespace :thumbnail do
9
14
 
@@ -32,4 +37,21 @@ namespace :thumbnail do
32
37
  end
33
38
  end
34
39
 
35
- end
40
+ end
41
+
42
+ namespace :url do
43
+ desc "Normalize album names name for URL format"
44
+ task :sluglify, :source do |t, args|
45
+ albums = Picturama::albums(args[:source])
46
+ puts "In folder #{args[:source].inspect} I'm moving..."
47
+ albums.each do |album|
48
+ target_folder = "#{args[:source]}/#{album.folder.to_url}"
49
+ unless File.directory?(target_folder)
50
+ FileUtils.mv "#{args[:source]}/#{album.folder}", "#{target_folder}"
51
+ puts "#{album.folder.inspect} to #{album.folder.to_url.inspect}"
52
+ end
53
+ end
54
+ end
55
+ end
56
+
57
+ task :default
data/spec/album_spec.rb CHANGED
@@ -1,4 +1,4 @@
1
- require_relative '../lib/picturama'
1
+ require_relative 'spec_helper'
2
2
 
3
3
  describe "For a given folder" do
4
4
 
@@ -30,5 +30,13 @@ describe "For a given folder" do
30
30
  Picturama::albums(File.dirname(@target_exists_folder)).size.should > 0
31
31
  end
32
32
 
33
+ it "verifies the album name is correct based on folder name" do
34
+ expected_album_name = "dummy album"
35
+ expected_album_folder = "dummy-album"
36
+ Picturama::albums(@target_exists_folder).first.name.should == expected_album_name
37
+ Picturama::albums(@target_exists_folder).first.folder.should == expected_album_folder
38
+ Picturama::albums(@target_exists_folder).first.slug.should == expected_album_folder
39
+ end
40
+
33
41
 
34
42
  end
data/spec/picture_spec.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  require 'mini_magick'
2
- require_relative '../lib/picturama'
2
+ require_relative 'spec_helper'
3
3
 
4
4
  describe "For a given picture in a given album" do
5
5
 
@@ -0,0 +1,6 @@
1
+ $:.push File.expand_path("../lib", __FILE__)
2
+
3
+ require 'coveralls'
4
+ require 'picturama'
5
+
6
+ Coveralls.wear!
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: picturama
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-05 00:00:00.000000000 Z
12
+ date: 2013-06-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mini_magick
@@ -27,6 +27,22 @@ dependencies:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
29
  version: 3.6.0
30
+ - !ruby/object:Gem::Dependency
31
+ name: stringex
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: 2.0.2
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 2.0.2
30
46
  - !ruby/object:Gem::Dependency
31
47
  name: rspec
32
48
  requirement: !ruby/object:Gem::Requirement
@@ -50,6 +66,8 @@ extensions: []
50
66
  extra_rdoc_files: []
51
67
  files:
52
68
  - .gitignore
69
+ - .ruby-version
70
+ - .travis.yml
53
71
  - Gemfile
54
72
  - Gemfile.lock
55
73
  - LICENCE
@@ -70,6 +88,7 @@ files:
70
88
  - spec/pictures/quimby.gif
71
89
  - spec/pictures/vote-quimby.jpg
72
90
  - spec/pictures/vote_quimby.jpg
91
+ - spec/spec_helper.rb
73
92
  homepage: http://davidsilveira.me/picturama
74
93
  licenses: []
75
94
  post_install_message:
@@ -82,12 +101,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
82
101
  - - ! '>='
83
102
  - !ruby/object:Gem::Version
84
103
  version: '0'
104
+ segments:
105
+ - 0
106
+ hash: -698139313
85
107
  required_rubygems_version: !ruby/object:Gem::Requirement
86
108
  none: false
87
109
  requirements:
88
110
  - - ! '>='
89
111
  - !ruby/object:Gem::Version
90
112
  version: '0'
113
+ segments:
114
+ - 0
115
+ hash: -698139313
91
116
  requirements: []
92
117
  rubyforge_project:
93
118
  rubygems_version: 1.8.24