subtitle_it 1.9.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +5 -0
- data/Gemfile +3 -0
- data/{README.rdoc → README.md} +22 -18
- data/Rakefile +13 -18
- data/bin/subtitle_it +4 -8
- data/lib/subtitle_it/bin.rb +50 -58
- data/lib/subtitle_it/fixes.rb +3 -4
- data/lib/subtitle_it/formats/ass.rb +5 -6
- data/lib/subtitle_it/formats/mpl.rb +9 -9
- data/lib/subtitle_it/formats/rsb.rb +9 -9
- data/lib/subtitle_it/formats/srt.rb +17 -14
- data/lib/subtitle_it/formats/sub.rb +7 -7
- data/lib/subtitle_it/formats/xml.rb +13 -12
- data/lib/subtitle_it/formats/yml.rb +5 -5
- data/lib/subtitle_it/generator.rb +2 -2
- data/lib/subtitle_it/languages.rb +52 -53
- data/lib/subtitle_it/movie.rb +26 -6
- data/lib/subtitle_it/platform_endl.rb +7 -5
- data/lib/subtitle_it/subdown.rb +30 -33
- data/lib/subtitle_it/subline.rb +5 -5
- data/lib/subtitle_it/substyle.rb +3 -9
- data/lib/subtitle_it/subtime.rb +19 -10
- data/lib/subtitle_it/subtitle.rb +20 -28
- data/lib/subtitle_it/version.rb +1 -7
- data/lib/subtitle_it.rb +7 -7
- data/spec/fixtures/movie.xml +2 -2
- data/spec/spec_helper.rb +6 -6
- data/spec/subtitle_it/bin_spec.rb +110 -98
- data/spec/subtitle_it/formats/ass_spec.rb +2 -3
- data/spec/subtitle_it/formats/mpl_spec.rb +26 -28
- data/spec/subtitle_it/formats/rsb_spec.rb +29 -30
- data/spec/subtitle_it/formats/srt_spec.rb +27 -30
- data/spec/subtitle_it/formats/sub_spec.rb +19 -21
- data/spec/subtitle_it/formats/xml_spec.rb +21 -21
- data/spec/subtitle_it/formats/yml_spec.rb +14 -15
- data/spec/subtitle_it/movie_spec.rb +24 -15
- data/spec/subtitle_it/subdown_spec.rb +58 -65
- data/spec/subtitle_it/subline_spec.rb +17 -18
- data/spec/subtitle_it/subtime_spec.rb +43 -44
- data/spec/subtitle_it/subtitle_spec.rb +28 -29
- data/spec/subtitle_it_spec.rb +4 -5
- data/subtitle_it.gemspec +25 -98
- metadata +121 -67
- data/.rspec +0 -2
- data/config/hoe.rb +0 -73
- data/config/requirements.rb +0 -15
- data/lib/subtitle_it/movie_hasher.rb +0 -30
- data/script/console +0 -10
- data/script/destroy +0 -14
- data/script/generate +0 -14
- data/script/txt2html +0 -82
- data/spec/subtitle_it/movie_hasher_spec.rb +0 -13
- data/tasks/deployment.rake +0 -34
- data/tasks/environment.rake +0 -7
- data/tasks/rspec.rake +0 -21
metadata
CHANGED
@@ -1,55 +1,100 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: subtitle_it
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
segments:
|
6
|
-
- 1
|
7
|
-
- 9
|
8
|
-
- 0
|
9
|
-
version: 1.9.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.0.0
|
10
5
|
platform: ruby
|
11
|
-
authors:
|
6
|
+
authors:
|
12
7
|
- Marcos Piccinini
|
13
8
|
autorequire:
|
14
9
|
bindir: bin
|
15
10
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
11
|
+
date: 2015-05-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: colorize
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: nokogiri
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
22
35
|
prerelease: false
|
23
|
-
|
24
|
-
|
25
|
-
requirements:
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
26
38
|
- - ">="
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
33
48
|
type: :development
|
34
|
-
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec-mocks
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.0'
|
35
83
|
description: Download, edit and create subtitles. Supports various formats.
|
36
84
|
email: x@nofxx.com
|
37
|
-
executables:
|
85
|
+
executables:
|
38
86
|
- subtitle_it
|
39
87
|
extensions: []
|
40
|
-
|
41
|
-
|
42
|
-
-
|
43
|
-
|
44
|
-
- .rspec
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- ".gitignore"
|
91
|
+
- Gemfile
|
45
92
|
- History.txt
|
46
93
|
- License.txt
|
47
|
-
- README.
|
94
|
+
- README.md
|
48
95
|
- Rakefile
|
49
96
|
- VERSION
|
50
97
|
- bin/subtitle_it
|
51
|
-
- config/hoe.rb
|
52
|
-
- config/requirements.rb
|
53
98
|
- lib/subtitle_it.rb
|
54
99
|
- lib/subtitle_it/bin.rb
|
55
100
|
- lib/subtitle_it/fixes.rb
|
@@ -63,7 +108,6 @@ files:
|
|
63
108
|
- lib/subtitle_it/generator.rb
|
64
109
|
- lib/subtitle_it/languages.rb
|
65
110
|
- lib/subtitle_it/movie.rb
|
66
|
-
- lib/subtitle_it/movie_hasher.rb
|
67
111
|
- lib/subtitle_it/platform_endl.rb
|
68
112
|
- lib/subtitle_it/subdown.rb
|
69
113
|
- lib/subtitle_it/subline.rb
|
@@ -71,10 +115,6 @@ files:
|
|
71
115
|
- lib/subtitle_it/subtime.rb
|
72
116
|
- lib/subtitle_it/subtitle.rb
|
73
117
|
- lib/subtitle_it/version.rb
|
74
|
-
- script/console
|
75
|
-
- script/destroy
|
76
|
-
- script/generate
|
77
|
-
- script/txt2html
|
78
118
|
- spec/fixtures/godfather.srt
|
79
119
|
- spec/fixtures/huge.ass
|
80
120
|
- spec/fixtures/movie.xml
|
@@ -94,7 +134,6 @@ files:
|
|
94
134
|
- spec/subtitle_it/formats/xml_spec.rb
|
95
135
|
- spec/subtitle_it/formats/yml_spec.rb
|
96
136
|
- spec/subtitle_it/generator_spec.rb
|
97
|
-
- spec/subtitle_it/movie_hasher_spec.rb
|
98
137
|
- spec/subtitle_it/movie_spec.rb
|
99
138
|
- spec/subtitle_it/subdown_spec.rb
|
100
139
|
- spec/subtitle_it/subline_spec.rb
|
@@ -103,40 +142,55 @@ files:
|
|
103
142
|
- spec/subtitle_it/subtitle_spec.rb
|
104
143
|
- spec/subtitle_it_spec.rb
|
105
144
|
- subtitle_it.gemspec
|
106
|
-
- tasks/deployment.rake
|
107
|
-
- tasks/environment.rake
|
108
|
-
- tasks/rspec.rake
|
109
|
-
has_rdoc: true
|
110
145
|
homepage: http://github.com/nofxx/subtitle_it
|
111
|
-
licenses:
|
112
|
-
|
146
|
+
licenses:
|
147
|
+
- MIT
|
148
|
+
metadata: {}
|
113
149
|
post_install_message:
|
114
150
|
rdoc_options: []
|
115
|
-
|
116
|
-
require_paths:
|
151
|
+
require_paths:
|
117
152
|
- lib
|
118
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
119
|
-
|
120
|
-
requirements:
|
153
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
154
|
+
requirements:
|
121
155
|
- - ">="
|
122
|
-
- !ruby/object:Gem::Version
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
|
-
none: false
|
128
|
-
requirements:
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '0'
|
158
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
159
|
+
requirements:
|
129
160
|
- - ">="
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
|
132
|
-
- 0
|
133
|
-
version: "0"
|
161
|
+
- !ruby/object:Gem::Version
|
162
|
+
version: '0'
|
134
163
|
requirements: []
|
135
|
-
|
136
164
|
rubyforge_project:
|
137
|
-
rubygems_version:
|
165
|
+
rubygems_version: 2.4.5
|
138
166
|
signing_key:
|
139
|
-
specification_version:
|
167
|
+
specification_version: 4
|
140
168
|
summary: Download, edit and create subtitles.
|
141
|
-
test_files:
|
142
|
-
|
169
|
+
test_files:
|
170
|
+
- spec/fixtures/godfather.srt
|
171
|
+
- spec/fixtures/huge.ass
|
172
|
+
- spec/fixtures/movie.xml
|
173
|
+
- spec/fixtures/movie.yml
|
174
|
+
- spec/fixtures/pseudo.rsb
|
175
|
+
- spec/fixtures/pulpfiction.sub
|
176
|
+
- spec/fixtures/puplfiction.mpl
|
177
|
+
- spec/fixtures/sincity.yml
|
178
|
+
- spec/spec_helper.rb
|
179
|
+
- spec/subtitle_it/bin_spec.rb
|
180
|
+
- spec/subtitle_it/fixes_spec.rb
|
181
|
+
- spec/subtitle_it/formats/ass_spec.rb
|
182
|
+
- spec/subtitle_it/formats/mpl_spec.rb
|
183
|
+
- spec/subtitle_it/formats/rsb_spec.rb
|
184
|
+
- spec/subtitle_it/formats/srt_spec.rb
|
185
|
+
- spec/subtitle_it/formats/sub_spec.rb
|
186
|
+
- spec/subtitle_it/formats/xml_spec.rb
|
187
|
+
- spec/subtitle_it/formats/yml_spec.rb
|
188
|
+
- spec/subtitle_it/generator_spec.rb
|
189
|
+
- spec/subtitle_it/movie_spec.rb
|
190
|
+
- spec/subtitle_it/subdown_spec.rb
|
191
|
+
- spec/subtitle_it/subline_spec.rb
|
192
|
+
- spec/subtitle_it/substyle_spec.rb
|
193
|
+
- spec/subtitle_it/subtime_spec.rb
|
194
|
+
- spec/subtitle_it/subtitle_spec.rb
|
195
|
+
- spec/subtitle_it_spec.rb
|
196
|
+
has_rdoc:
|
data/.rspec
DELETED
data/config/hoe.rb
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
require 'subtitle_it/version'
|
2
|
-
|
3
|
-
AUTHOR = 'FIXME full name' # can also be an array of Authors
|
4
|
-
EMAIL = "FIXME email"
|
5
|
-
DESCRIPTION = "description of gem"
|
6
|
-
GEM_NAME = 'subtitle_it' # what ppl will type to install your gem
|
7
|
-
RUBYFORGE_PROJECT = 'subtitle_it' # The unix name for your project
|
8
|
-
HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
|
9
|
-
DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
|
10
|
-
EXTRA_DEPENDENCIES = [
|
11
|
-
# ['activesupport', '>= 1.3.1']
|
12
|
-
] # An array of rubygem dependencies [name, version]
|
13
|
-
|
14
|
-
@config_file = "~/.rubyforge/user-config.yml"
|
15
|
-
@config = nil
|
16
|
-
RUBYFORGE_USERNAME = "unknown"
|
17
|
-
def rubyforge_username
|
18
|
-
unless @config
|
19
|
-
begin
|
20
|
-
@config = YAML.load(File.read(File.expand_path(@config_file)))
|
21
|
-
rescue
|
22
|
-
puts <<-EOS
|
23
|
-
ERROR: No rubyforge config file found: #{@config_file}
|
24
|
-
Run 'rubyforge setup' to prepare your env for access to Rubyforge
|
25
|
-
- See http://newgem.rubyforge.org/rubyforge.html for more details
|
26
|
-
EOS
|
27
|
-
exit
|
28
|
-
end
|
29
|
-
end
|
30
|
-
RUBYFORGE_USERNAME.replace @config["username"]
|
31
|
-
end
|
32
|
-
|
33
|
-
|
34
|
-
REV = nil
|
35
|
-
# UNCOMMENT IF REQUIRED:
|
36
|
-
# REV = YAML.load(`svn info`)['Revision']
|
37
|
-
VERS = SubtitleIt::VERSION::STRING + (REV ? ".#{REV}" : "")
|
38
|
-
RDOC_OPTS = ['--quiet', '--title', 'subtitle_it documentation',
|
39
|
-
"--opname", "index.html",
|
40
|
-
"--line-numbers",
|
41
|
-
"--main", "README",
|
42
|
-
"--inline-source"]
|
43
|
-
|
44
|
-
class Hoe
|
45
|
-
def extra_deps
|
46
|
-
@extra_deps.reject! { |x| Array(x).first == 'hoe' }
|
47
|
-
@extra_deps
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
# Generate all the Rake tasks
|
52
|
-
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
53
|
-
$hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
54
|
-
p.developer(AUTHOR, EMAIL)
|
55
|
-
p.description = DESCRIPTION
|
56
|
-
p.summary = DESCRIPTION
|
57
|
-
p.url = HOMEPATH
|
58
|
-
p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
|
59
|
-
p.test_globs = ["test/**/test_*.rb"]
|
60
|
-
p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
|
61
|
-
|
62
|
-
# == Optional
|
63
|
-
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
64
|
-
#p.extra_deps = EXTRA_DEPENDENCIES
|
65
|
-
|
66
|
-
#p.spec_extras = {} # A hash of extra values to set in the gemspec.
|
67
|
-
end
|
68
|
-
|
69
|
-
CHANGES = $hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
|
70
|
-
PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
|
71
|
-
$hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
|
72
|
-
$hoe.rsync_args = '-av --delete --ignore-errors'
|
73
|
-
$hoe.spec.post_install_message = File.open(File.dirname(__FILE__) + "/../PostInstall.txt").read rescue ""
|
data/config/requirements.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
include FileUtils
|
3
|
-
|
4
|
-
require 'rubygems'
|
5
|
-
%w[rake hoe newgem rubigen].each do |req_gem|
|
6
|
-
begin
|
7
|
-
require req_gem
|
8
|
-
rescue LoadError
|
9
|
-
puts "This Rakefile requires the '#{req_gem}' RubyGem."
|
10
|
-
puts "Installation: gem install #{req_gem} -y"
|
11
|
-
exit
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
$:.unshift(File.join(File.dirname(__FILE__), %w[.. lib]))
|
@@ -1,30 +0,0 @@
|
|
1
|
-
# downsub - github.com/johanlunds/downsub
|
2
|
-
module SubtitleIt
|
3
|
-
module MovieHasher
|
4
|
-
|
5
|
-
CHUNK_SIZE = 64 * 1024 # in bytes
|
6
|
-
|
7
|
-
def self.compute_haxx(filename)
|
8
|
-
filesize = File.size(filename)
|
9
|
-
haxx = filesize
|
10
|
-
|
11
|
-
# Read 64 kbytes, divide up into 64 bits and add each
|
12
|
-
# to hash. Do for beginning and end of file.
|
13
|
-
File.open(filename, 'rb') do |f|
|
14
|
-
# Q = unsigned long long = 64 bit
|
15
|
-
f.read(CHUNK_SIZE).unpack("Q*").each do |n|
|
16
|
-
haxx = haxx + n & 0xffffffffffffffff # to remain as 64 bit number
|
17
|
-
end
|
18
|
-
|
19
|
-
f.seek([0, filesize - CHUNK_SIZE].max, IO::SEEK_SET)
|
20
|
-
|
21
|
-
# And again for the end of the file
|
22
|
-
f.read(CHUNK_SIZE).unpack("Q*").each do |n|
|
23
|
-
haxx = haxx + n & 0xffffffffffffffff
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
sprintf("%016x", haxx)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
data/script/console
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# File: script/console
|
3
|
-
irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
|
4
|
-
|
5
|
-
libs = " -r irb/completion"
|
6
|
-
# Perhaps use a console_lib to store any extra methods I may want available in the cosole
|
7
|
-
# libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
|
8
|
-
libs << " -r #{File.dirname(__FILE__) + '/../lib/subtitle_it.rb'}"
|
9
|
-
puts "Loading subtitle_it gem"
|
10
|
-
exec "#{irb} #{libs} --simple-prompt"
|
data/script/destroy
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'rubigen'
|
6
|
-
rescue LoadError
|
7
|
-
require 'rubygems'
|
8
|
-
require 'rubigen'
|
9
|
-
end
|
10
|
-
require 'rubigen/scripts/destroy'
|
11
|
-
|
12
|
-
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
-
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
-
RubiGen::Scripts::Destroy.new.run(ARGV)
|
data/script/generate
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'rubigen'
|
6
|
-
rescue LoadError
|
7
|
-
require 'rubygems'
|
8
|
-
require 'rubigen'
|
9
|
-
end
|
10
|
-
require 'rubigen/scripts/generate'
|
11
|
-
|
12
|
-
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
-
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
-
RubiGen::Scripts::Generate.new.run(ARGV)
|
data/script/txt2html
DELETED
@@ -1,82 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
GEM_NAME = 'subtitle_it' # what ppl will type to install your gem
|
4
|
-
RUBYFORGE_PROJECT = 'subtitle_it'
|
5
|
-
|
6
|
-
require 'rubygems'
|
7
|
-
begin
|
8
|
-
require 'newgem'
|
9
|
-
require 'rubyforge'
|
10
|
-
rescue LoadError
|
11
|
-
puts "\n\nGenerating the website requires the newgem RubyGem"
|
12
|
-
puts "Install: gem install newgem\n\n"
|
13
|
-
exit(1)
|
14
|
-
end
|
15
|
-
require 'redcloth'
|
16
|
-
require 'syntax/convertors/html'
|
17
|
-
require 'erb'
|
18
|
-
require File.dirname(__FILE__) + "/../lib/#{GEM_NAME}/version.rb"
|
19
|
-
|
20
|
-
version = SubtitleIt::VERSION::STRING
|
21
|
-
download = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
|
22
|
-
|
23
|
-
def rubyforge_project_id
|
24
|
-
RubyForge.new.autoconfig["group_ids"][RUBYFORGE_PROJECT]
|
25
|
-
end
|
26
|
-
|
27
|
-
class Fixnum
|
28
|
-
def ordinal
|
29
|
-
# teens
|
30
|
-
return 'th' if (10..19).include?(self % 100)
|
31
|
-
# others
|
32
|
-
case self % 10
|
33
|
-
when 1: return 'st'
|
34
|
-
when 2: return 'nd'
|
35
|
-
when 3: return 'rd'
|
36
|
-
else return 'th'
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
class Time
|
42
|
-
def pretty
|
43
|
-
return "#{mday}#{mday.ordinal} #{strftime('%B')} #{year}"
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
def convert_syntax(syntax, source)
|
48
|
-
return Syntax::Convertors::HTML.for_syntax(syntax).convert(source).gsub(%r!^<pre>|</pre>$!,'')
|
49
|
-
end
|
50
|
-
|
51
|
-
if ARGV.length >= 1
|
52
|
-
src, template = ARGV
|
53
|
-
template ||= File.join(File.dirname(__FILE__), '/../website/template.html.erb')
|
54
|
-
else
|
55
|
-
puts("Usage: #{File.split($0).last} source.txt [template.html.erb] > output.html")
|
56
|
-
exit!
|
57
|
-
end
|
58
|
-
|
59
|
-
template = ERB.new(File.open(template).read)
|
60
|
-
|
61
|
-
title = nil
|
62
|
-
body = nil
|
63
|
-
File.open(src) do |fsrc|
|
64
|
-
title_text = fsrc.readline
|
65
|
-
body_text_template = fsrc.read
|
66
|
-
body_text = ERB.new(body_text_template).result(binding)
|
67
|
-
syntax_items = []
|
68
|
-
body_text.gsub!(%r!<(pre|code)[^>]*?syntax=['"]([^'"]+)[^>]*>(.*?)</\1>!m){
|
69
|
-
ident = syntax_items.length
|
70
|
-
element, syntax, source = $1, $2, $3
|
71
|
-
syntax_items << "<#{element} class='syntax'>#{convert_syntax(syntax, source)}</#{element}>"
|
72
|
-
"syntax-temp-#{ident}"
|
73
|
-
}
|
74
|
-
title = RedCloth.new(title_text).to_html.gsub(%r!<.*?>!,'').strip
|
75
|
-
body = RedCloth.new(body_text).to_html
|
76
|
-
body.gsub!(%r!(?:<pre><code>)?syntax-temp-(\d+)(?:</code></pre>)?!){ syntax_items[$1.to_i] }
|
77
|
-
end
|
78
|
-
stat = File.stat(src)
|
79
|
-
created = stat.ctime
|
80
|
-
modified = stat.mtime
|
81
|
-
|
82
|
-
$stdout << template.result(binding)
|
@@ -1,13 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
-
|
3
|
-
describe MovieHasher do
|
4
|
-
|
5
|
-
it "should generate a beatiful hash for us" do
|
6
|
-
MovieHasher::CHUNK_SIZE.should eql(65536)
|
7
|
-
|
8
|
-
File.should_receive(:size).with('onefile').and_return(1020)
|
9
|
-
File.should_receive(:open).with("onefile", "rb")
|
10
|
-
|
11
|
-
MovieHasher.compute_haxx('onefile').should eql("00000000000003fc")
|
12
|
-
end
|
13
|
-
end
|
data/tasks/deployment.rake
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
desc 'Release the website and new gem version'
|
2
|
-
task :deploy => [:check_version, :website, :release] do
|
3
|
-
puts "Remember to create SVN tag:"
|
4
|
-
puts "svn copy svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/trunk " +
|
5
|
-
"svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/tags/REL-#{VERS} "
|
6
|
-
puts "Suggested comment:"
|
7
|
-
puts "Tagging release #{CHANGES}"
|
8
|
-
end
|
9
|
-
|
10
|
-
desc 'Runs tasks website_generate and install_gem as a local deployment of the gem'
|
11
|
-
task :local_deploy => [:website_generate, :install_gem]
|
12
|
-
|
13
|
-
task :check_version do
|
14
|
-
unless ENV['VERSION']
|
15
|
-
puts 'Must pass a VERSION=x.y.z release version'
|
16
|
-
exit
|
17
|
-
end
|
18
|
-
unless ENV['VERSION'] == VERS
|
19
|
-
puts "Please update your version.rb to match the release version, currently #{VERS}"
|
20
|
-
exit
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
desc 'Install the package as a gem, without generating documentation(ri/rdoc)'
|
25
|
-
task :install_gem_no_doc => [:clean, :package] do
|
26
|
-
sh "#{'sudo ' unless Hoe::WINDOZE }gem install pkg/*.gem --no-rdoc --no-ri"
|
27
|
-
end
|
28
|
-
|
29
|
-
namespace :manifest do
|
30
|
-
desc 'Recreate Manifest.txt to include ALL files'
|
31
|
-
task :refresh do
|
32
|
-
`rake check_manifest | patch -p0 > Manifest.txt`
|
33
|
-
end
|
34
|
-
end
|
data/tasks/environment.rake
DELETED
data/tasks/rspec.rake
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
begin
|
2
|
-
require 'spec'
|
3
|
-
rescue LoadError
|
4
|
-
require 'rubygems'
|
5
|
-
require 'spec'
|
6
|
-
end
|
7
|
-
begin
|
8
|
-
require 'spec/rake/spectask'
|
9
|
-
rescue LoadError
|
10
|
-
puts <<-EOS
|
11
|
-
To use rspec for testing you must install rspec gem:
|
12
|
-
gem install rspec
|
13
|
-
EOS
|
14
|
-
exit(0)
|
15
|
-
end
|
16
|
-
|
17
|
-
desc "Run the specs under spec/models"
|
18
|
-
Spec::Rake::SpecTask.new do |t|
|
19
|
-
t.spec_opts = ['--options', "spec/spec.opts"]
|
20
|
-
t.spec_files = FileList['spec/**/*_spec.rb']
|
21
|
-
end
|