comfortable_mexican_loveseat 0.0.15 → 0.0.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.rdoc +4 -0
- data/lib/tasks/comfortable_mexican_loveseat.rake +32 -1
- data/lib/tasks/zip_file_generator.rb +47 -0
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8c2de24c439357928057bae05de5f3ff1892a9a
|
4
|
+
data.tar.gz: 31f3218daed30ca792b35a26df5948db0eebed4a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2025dd316c454b94250b0ea78e502ce3319af7a75c0d63a22c4f01696a7c7488aa8268b96a778351964f56c7d1f580cdfd0db3de0d93efb878283dc5b481c7d0
|
7
|
+
data.tar.gz: 1171c863ec90be0823a4b7b0319ca47d24211ffd4754f698eb6c937163d7dc0d3b4cc4cdb57d7f71f4f5b676159a13fd7259c7cd20057f165f26ed4621685fc8
|
data/README.rdoc
CHANGED
@@ -4,6 +4,10 @@ The Comfortable Mexican Loveseat is an expansion pack to the Comfortable Mexican
|
|
4
4
|
|
5
5
|
The Loveseat references a fixed version of the CMS (currently 1.12.8) and latest releases are pulled in occasionally.
|
6
6
|
|
7
|
+
== CMS Usage Notes
|
8
|
+
====== When you are adding new models and/or controllers and links are not showing up, do not forget to click the "Sync" button!
|
9
|
+
|
10
|
+
|
7
11
|
== Simplified Fixture Import/Export
|
8
12
|
|
9
13
|
When you want to import fixtures you can now use the following commands:
|
@@ -1,3 +1,7 @@
|
|
1
|
+
# require 'zip'
|
2
|
+
require 'fileutils'
|
3
|
+
require_relative 'zip_file_generator'
|
4
|
+
|
1
5
|
namespace :comfortable_mexican_loveseat do
|
2
6
|
namespace :fixtures do
|
3
7
|
|
@@ -59,10 +63,37 @@ namespace :comfortable_mexican_loveseat do
|
|
59
63
|
|
60
64
|
ComfortableMexicanSofa.logger = logger
|
61
65
|
end
|
66
|
+
|
67
|
+
desc 'Zip fixtures and save in a public dir'
|
68
|
+
task zip: :environment do
|
69
|
+
directoryToZip = ComfortableMexicanSofa.config.fixtures_path
|
70
|
+
fileName = "cms_fixtures_#{Time.now.to_i}.zip"
|
71
|
+
outputPath = File.expand_path('public/downloads', Rails.root)
|
72
|
+
|
73
|
+
begin
|
74
|
+
FileUtils.mkdir_p(outputPath)
|
75
|
+
rescue
|
76
|
+
puts 'rescued in mkdir'
|
77
|
+
else
|
78
|
+
begin
|
79
|
+
FileUtils.chmod_R(0755, outputPath)
|
80
|
+
rescue
|
81
|
+
puts 'rescued in chmod'
|
82
|
+
else
|
83
|
+
outputFile = [outputPath, fileName].join('/')
|
84
|
+
zf = ZipFileGenerator.new(directoryToZip, outputFile)
|
85
|
+
zf.write()
|
86
|
+
FileUtils.chmod_R(0777, outputFile)
|
87
|
+
puts "Zipped to #{fileName}"
|
88
|
+
puts outputPath
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
62
92
|
end
|
63
93
|
end
|
64
94
|
|
65
95
|
namespace :cms do
|
66
96
|
task import: 'comfortable_mexican_loveseat:fixtures:import'
|
67
97
|
task export: 'comfortable_mexican_loveseat:fixtures:export'
|
68
|
-
|
98
|
+
task zip: 'comfortable_mexican_loveseat:fixtures:zip'
|
99
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'zip'
|
2
|
+
|
3
|
+
class ZipFileGenerator
|
4
|
+
# Initialize with the directory to zip and the location of the output archive.
|
5
|
+
def initialize(input_dir, output_file)
|
6
|
+
@input_dir = input_dir
|
7
|
+
@output_file = output_file
|
8
|
+
end
|
9
|
+
|
10
|
+
# Zip the input directory.
|
11
|
+
def write
|
12
|
+
entries = Dir.entries(@input_dir) - %w(. ..)
|
13
|
+
|
14
|
+
::Zip::File.open(@output_file, ::Zip::File::CREATE) do |io|
|
15
|
+
write_entries entries, '', io
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
# A helper method to make the recursion work.
|
22
|
+
def write_entries(entries, path, io)
|
23
|
+
entries.each do |e|
|
24
|
+
zip_file_path = path == '' ? e : File.join(path, e)
|
25
|
+
disk_file_path = File.join(@input_dir, zip_file_path)
|
26
|
+
puts "Deflating #{disk_file_path}"
|
27
|
+
|
28
|
+
if File.directory? disk_file_path
|
29
|
+
recursively_deflate_directory(disk_file_path, io, zip_file_path)
|
30
|
+
else
|
31
|
+
put_into_archive(disk_file_path, io, zip_file_path)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def recursively_deflate_directory(disk_file_path, io, zip_file_path)
|
37
|
+
io.mkdir zip_file_path
|
38
|
+
subdir = Dir.entries(disk_file_path) - %w(. ..)
|
39
|
+
write_entries subdir, zip_file_path, io
|
40
|
+
end
|
41
|
+
|
42
|
+
def put_into_archive(disk_file_path, io, zip_file_path)
|
43
|
+
io.get_output_stream(zip_file_path) do |f|
|
44
|
+
f.puts(File.open(disk_file_path, 'rb').read)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: comfortable_mexican_loveseat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Bahlke
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-09-
|
12
|
+
date: 2015-09-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -53,6 +53,20 @@ dependencies:
|
|
53
53
|
- - ~>
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: 1.5.1
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: rubyzip
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ~>
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '1.1'
|
63
|
+
type: :runtime
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '1.1'
|
56
70
|
- !ruby/object:Gem::Dependency
|
57
71
|
name: sqlite3
|
58
72
|
requirement: !ruby/object:Gem::Requirement
|
@@ -131,6 +145,7 @@ files:
|
|
131
145
|
- lib/comfortable_mexican_loveseat/fixture.rb
|
132
146
|
- lib/comfortable_mexican_loveseat/form_builder.rb
|
133
147
|
- lib/tasks/comfortable_mexican_loveseat.rake
|
148
|
+
- lib/tasks/zip_file_generator.rb
|
134
149
|
- test/comfortable_mexican_loveseat_test.rb
|
135
150
|
- test/dummy/README.rdoc
|
136
151
|
- test/dummy/Rakefile
|