latex-project-template 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 399ff2b891da165425fb62391e762c774ff594fd1b6e1f3ffe5bb7205470d38e
4
+ data.tar.gz: 9db9dae8bedb29f4533bef84ab5bfb0fd699b445c1834903298e721f69863255
5
+ SHA512:
6
+ metadata.gz: 4d4cd7fba20c75dcf44380e673dc35e08861a238c57f0785209996610974cc087bcd993566c5f2baeb52c704a090194319d9a9dfb0886c85c429c4a7b86fc4a7
7
+ data.tar.gz: 570a64442f11e8660f314aa81ff5fbc92c20a16ffe343c519e45139d9403a27f0ac6ccd82ac3e8619cc8ac74070aa11bfc681e05bad3e357f2d9b46ea3ce465e
data/Gemfile CHANGED
@@ -10,7 +10,6 @@ group :development do
10
10
  gem "yard", ">= 0.7.2"
11
11
  gem "bundler", ">= 1.0.0"
12
12
  gem "jeweler", ">= 1.6.4"
13
- gem "rcov", ">= 0"
14
13
  gem "filename", ">= 0.1.0"
15
14
  gem "user_config", ">= 0.0.2"
16
15
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.4
1
+ 0.0.5
@@ -27,6 +27,9 @@ begin
27
27
  opt.on("--init", "Initialize configuration directory.") do |v|
28
28
  options[:mode] = :init
29
29
  end
30
+ opt.on("--no-git", "Create project without git repository.") do |v|
31
+ options[:no_git] = true
32
+ end
30
33
  opt.on("--home DIR", "Set the directory having '.latex_project_template'.") do |v|
31
34
  options[:home] = v
32
35
  end
@@ -65,7 +68,7 @@ when :create
65
68
  dir = ARGV[0]
66
69
  template = ARGV[1] || 'default'
67
70
  if dir
68
- LaTeXProjectTemplate.new(dir, template, options[:home]).create(:io => $stdout)
71
+ LaTeXProjectTemplate.new(dir, template, options[:home]).create(:io => $stdout, :no_git => options[:no_git])
69
72
  else
70
73
  exit(1)
71
74
  end
@@ -10,4 +10,7 @@ LaTeXProjectTemplate::Task.new(MAIN_TEX_FILE) do |task|
10
10
  # * Default task to compile tex file. You can set :dvi, :ps, :pdf, :pdfdvi, or :pdfps.
11
11
  # The default is :pdf.
12
12
  # task.default = :dvi
13
+ #
14
+ # * Add dependency of task
15
+ # task.dependency[:pdf] << :some_task
13
16
  end
@@ -2,18 +2,19 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
+ # stub: latex-project-template 0.0.5 ruby lib
5
6
 
6
7
  Gem::Specification.new do |s|
7
- s.name = %q{latex-project-template}
8
- s.version = "0.0.4"
8
+ s.name = "latex-project-template".freeze
9
+ s.version = "0.0.5".freeze
9
10
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Takayuki YAMAGUCHI"]
12
- s.date = %q{2011-07-08}
13
- s.default_executable = %q{latex-project-template}
14
- s.description = %q{Create LaTeX project with git from template, which uses latexmk.}
15
- s.email = %q{d@ytak.info}
16
- s.executables = ["latex-project-template"]
11
+ s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
+ s.require_paths = ["lib".freeze]
13
+ s.authors = ["Takayuki YAMAGUCHI".freeze]
14
+ s.date = "2025-03-28"
15
+ s.description = "Create LaTeX project with git from template, which uses latexmk.".freeze
16
+ s.email = "d@ytak.info".freeze
17
+ s.executables = ["latex-project-template".freeze]
17
18
  s.extra_rdoc_files = [
18
19
  "LICENSE.txt",
19
20
  "README.md"
@@ -44,49 +45,21 @@ Gem::Specification.new do |s|
44
45
  "spec/spec_helper.rb",
45
46
  "spec/task_spec.rb"
46
47
  ]
47
- s.homepage = %q{http://github.com/ytaka/latex-project-template}
48
- s.licenses = ["GPLv3"]
49
- s.require_paths = ["lib"]
50
- s.rubygems_version = %q{1.6.2}
51
- s.summary = %q{LaTeX Project Template}
48
+ s.homepage = "http://github.com/ytaka/latex-project-template".freeze
49
+ s.licenses = ["GPLv3".freeze]
50
+ s.rubygems_version = "3.6.2".freeze
51
+ s.summary = "LaTeX Project Template".freeze
52
52
 
53
- if s.respond_to? :specification_version then
54
- s.specification_version = 3
53
+ s.specification_version = 4
55
54
 
56
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
57
- s.add_development_dependency(%q<rspec>, [">= 2.6.0"])
58
- s.add_development_dependency(%q<yard>, [">= 0.7.2"])
59
- s.add_development_dependency(%q<bundler>, [">= 1.0.0"])
60
- s.add_development_dependency(%q<jeweler>, [">= 1.6.4"])
61
- s.add_development_dependency(%q<rcov>, [">= 0"])
62
- s.add_development_dependency(%q<filename>, [">= 0.1.0"])
63
- s.add_development_dependency(%q<user_config>, [">= 0.0.2"])
64
- s.add_runtime_dependency(%q<git>, [">= 1.2.5"])
65
- s.add_runtime_dependency(%q<filename>, [">= 0.1.0"])
66
- s.add_runtime_dependency(%q<user_config>, [">= 0.0.2"])
67
- else
68
- s.add_dependency(%q<rspec>, [">= 2.6.0"])
69
- s.add_dependency(%q<yard>, [">= 0.7.2"])
70
- s.add_dependency(%q<bundler>, [">= 1.0.0"])
71
- s.add_dependency(%q<jeweler>, [">= 1.6.4"])
72
- s.add_dependency(%q<rcov>, [">= 0"])
73
- s.add_dependency(%q<filename>, [">= 0.1.0"])
74
- s.add_dependency(%q<user_config>, [">= 0.0.2"])
75
- s.add_dependency(%q<git>, [">= 1.2.5"])
76
- s.add_dependency(%q<filename>, [">= 0.1.0"])
77
- s.add_dependency(%q<user_config>, [">= 0.0.2"])
78
- end
79
- else
80
- s.add_dependency(%q<rspec>, [">= 2.6.0"])
81
- s.add_dependency(%q<yard>, [">= 0.7.2"])
82
- s.add_dependency(%q<bundler>, [">= 1.0.0"])
83
- s.add_dependency(%q<jeweler>, [">= 1.6.4"])
84
- s.add_dependency(%q<rcov>, [">= 0"])
85
- s.add_dependency(%q<filename>, [">= 0.1.0"])
86
- s.add_dependency(%q<user_config>, [">= 0.0.2"])
87
- s.add_dependency(%q<git>, [">= 1.2.5"])
88
- s.add_dependency(%q<filename>, [">= 0.1.0"])
89
- s.add_dependency(%q<user_config>, [">= 0.0.2"])
90
- end
55
+ s.add_development_dependency(%q<rspec>.freeze, [">= 2.6.0".freeze])
56
+ s.add_development_dependency(%q<yard>.freeze, [">= 0.7.2".freeze])
57
+ s.add_development_dependency(%q<bundler>.freeze, [">= 1.0.0".freeze])
58
+ s.add_development_dependency(%q<jeweler>.freeze, [">= 1.6.4".freeze])
59
+ s.add_development_dependency(%q<filename>.freeze, [">= 0.1.0".freeze])
60
+ s.add_development_dependency(%q<user_config>.freeze, [">= 0.0.2".freeze])
61
+ s.add_runtime_dependency(%q<git>.freeze, [">= 1.2.5".freeze])
62
+ s.add_runtime_dependency(%q<filename>.freeze, [">= 0.1.0".freeze])
63
+ s.add_runtime_dependency(%q<user_config>.freeze, [">= 0.0.2".freeze])
91
64
  end
92
65
 
@@ -8,7 +8,7 @@ class LaTeXProjectTemplate
8
8
 
9
9
  attr_reader :temporary, :product, :pattern
10
10
 
11
- DEFAULT_PATTERN = ["**/*~", "**/*.bak"]
11
+ DEFAULT_PATTERN = ["**/*~", "**/*.bak", "**/*-SAVE-ERROR"]
12
12
 
13
13
  def initialize
14
14
  @pattern = Rake::FileList.new(DEFAULT_PATTERN)
@@ -77,13 +77,15 @@ class LaTeXProjectTemplate
77
77
  end
78
78
 
79
79
  class Task < Rake::TaskLib
80
- attr_accessor :latexmk, :clean, :default
80
+ attr_accessor :latexmk, :clean, :default, :dependency
81
81
 
82
82
  def initialize(target, &block)
83
83
  @target = target
84
84
  @latexmk = Latexmk.new
85
85
  @clean = Cleaning.new
86
86
  @default = :pdf
87
+ @dependency = Hash.new { |h, k| h[k] = [] }
88
+
87
89
  yield(self) if block_given?
88
90
  define_task
89
91
  end
@@ -101,7 +103,7 @@ class LaTeXProjectTemplate
101
103
  path = FileName.create(@target, :add => :prohibit, :extension => extension_from_command_type(type))
102
104
  snapshot_path = FileName.create("snapshot", File.basename(path),
103
105
  :type => :time, :directory => :parent, :position => :middle,
104
- :delimiter => '', :add => :always, :format => "%Y%m%d_%H%M%S")
106
+ :delimiter => '', :add => :always, :format => "_%Y%m%d_%H%M%S")
105
107
  begin
106
108
  Rake::Task[type].execute
107
109
  rescue
@@ -165,26 +167,26 @@ class LaTeXProjectTemplate
165
167
  task :default => @default
166
168
 
167
169
  desc "Clean up temporary files."
168
- task :clean do |t|
170
+ task :clean => @dependency[:clean] do |t|
169
171
  @latexmk.clean(@target)
170
172
  @clean.clean
171
173
  end
172
174
 
173
175
  desc "Clean up all files."
174
- task :distclean do |t|
176
+ task :distclean => @dependency[:distclean] do |t|
175
177
  @latexmk.distclean(@target)
176
178
  @clean.clean
177
179
  end
178
180
 
179
181
  Latexmk::COMMAND_TO_PRODUCE_FILE.each do |type|
180
182
  desc "Create #{type.to_s}."
181
- task type => [@target] do |t|
183
+ task type => @dependency[type] do |t|
182
184
  @latexmk.__send__(type, @target)
183
185
  end
184
186
  end
185
187
 
186
188
  desc "Create snapshot file."
187
- task :snapshot, [:type,:commit] do |t, args|
189
+ task :snapshot, [:type, :commit] do |t, args|
188
190
  type = args.type && args.type.size > 0 ? args.type.intern : :pdf
189
191
  unless Latexmk::COMMAND_TO_PRODUCE_FILE.include?(type)
190
192
  raise "Invalid option to produce file: #{type}."
@@ -237,19 +237,31 @@ class LaTeXProjectTemplate
237
237
  end
238
238
  private :create_files
239
239
 
240
- def create(opts = {})
241
- FileUtils.mkdir_p(@target_dir)
240
+ def create_git
242
241
  git = Git.init(@target_dir)
243
- files = create_files
244
242
  git.add
245
243
  git.commit("Copy template: #{@template.name}.")
244
+ end
245
+ private :create_git
246
+
247
+ # opts[:io] is an IO to which progress are outputed.
248
+ # If opts[:io] is nil then no outputting.
249
+ # If opts[:no_git] is true then the project is not managed by git repository.
250
+ def create(opts = {})
251
+ FileUtils.mkdir_p(@target_dir)
252
+ files = create_files
246
253
  if io = opts[:io]
247
- files.map! do |path|
248
- path.sub!(@target_dir, '')
249
- path.sub!(/^\//, '')
254
+ file_paths = files.map do |path|
255
+ path.sub(@target_dir, '').sub(/^\//, '')
256
+ end
257
+ io.puts "Create the following files from template '#{@template.name}'"
258
+ io.puts file_paths.join("\n")
259
+ end
260
+ if !opts[:no_git]
261
+ create_git
262
+ if opts[:io]
263
+ opts[:io].puts "Create git repository and commit all files."
250
264
  end
251
- io.puts "Create the following files from template '#{@template.name}' and commit to git."
252
- io.puts files.join("\n")
253
265
  end
254
266
  end
255
267
  end
@@ -57,13 +57,27 @@ describe LaTeXProjectTemplate do
57
57
  end
58
58
 
59
59
  it "should copy 'default' template." do
60
- template = LaTeXProjectTemplate.new(File.join(@home_directory, 'new_tex'), 'default', @home_directory)
60
+ target = File.join(@home_directory, 'new_tex')
61
+ template = LaTeXProjectTemplate.new(target, 'default', @home_directory)
61
62
  template.create
63
+ File.directory?(target).should be_true
64
+ File.directory?(File.join(target, '.git')).should be_true
62
65
  end
63
66
 
64
67
  it "should copy 'japanese' template." do
65
- template = LaTeXProjectTemplate.new(File.join(@home_directory, 'new_japanese'), 'japanese', @home_directory)
68
+ target = File.join(@home_directory, 'new_japanese')
69
+ template = LaTeXProjectTemplate.new(target, 'japanese', @home_directory)
66
70
  template.create
71
+ File.directory?(target).should be_true
72
+ File.directory?(File.join(target, '.git')).should be_true
73
+ end
74
+
75
+ it "should copy 'default' template without git." do
76
+ target = File.join(@home_directory, 'new_tex_no_git')
77
+ template = LaTeXProjectTemplate.new(target, 'default', @home_directory)
78
+ template.create(:no_git => true)
79
+ File.directory?(target).should be_true
80
+ File.directory?(File.join(target, '.git')).should_not be_true
67
81
  end
68
82
 
69
83
  after(:all) do
metadata CHANGED
@@ -1,140 +1,151 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: latex-project-template
3
- version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.0.4
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.5
6
5
  platform: ruby
7
- authors:
6
+ authors:
8
7
  - Takayuki YAMAGUCHI
9
- autorequire:
10
8
  bindir: bin
11
9
  cert_chain: []
12
-
13
- date: 2011-07-08 00:00:00 +09:00
14
- default_executable: latex-project-template
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
10
+ date: 2025-03-28 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
17
13
  name: rspec
18
- requirement: &id001 !ruby/object:Gem::Requirement
19
- none: false
20
- requirements:
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
21
16
  - - ">="
22
- - !ruby/object:Gem::Version
17
+ - !ruby/object:Gem::Version
23
18
  version: 2.6.0
24
19
  type: :development
25
20
  prerelease: false
26
- version_requirements: *id001
27
- - !ruby/object:Gem::Dependency
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: 2.6.0
26
+ - !ruby/object:Gem::Dependency
28
27
  name: yard
29
- requirement: &id002 !ruby/object:Gem::Requirement
30
- none: false
31
- requirements:
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
32
30
  - - ">="
33
- - !ruby/object:Gem::Version
31
+ - !ruby/object:Gem::Version
34
32
  version: 0.7.2
35
33
  type: :development
36
34
  prerelease: false
37
- version_requirements: *id002
38
- - !ruby/object:Gem::Dependency
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: 0.7.2
40
+ - !ruby/object:Gem::Dependency
39
41
  name: bundler
40
- requirement: &id003 !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
43
44
  - - ">="
44
- - !ruby/object:Gem::Version
45
+ - !ruby/object:Gem::Version
45
46
  version: 1.0.0
46
47
  type: :development
47
48
  prerelease: false
48
- version_requirements: *id003
49
- - !ruby/object:Gem::Dependency
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: 1.0.0
54
+ - !ruby/object:Gem::Dependency
50
55
  name: jeweler
51
- requirement: &id004 !ruby/object:Gem::Requirement
52
- none: false
53
- requirements:
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
54
58
  - - ">="
55
- - !ruby/object:Gem::Version
59
+ - !ruby/object:Gem::Version
56
60
  version: 1.6.4
57
61
  type: :development
58
62
  prerelease: false
59
- version_requirements: *id004
60
- - !ruby/object:Gem::Dependency
61
- name: rcov
62
- requirement: &id005 !ruby/object:Gem::Requirement
63
- none: false
64
- requirements:
65
- - - ">="
66
- - !ruby/object:Gem::Version
67
- version: "0"
68
- type: :development
69
- prerelease: false
70
- version_requirements: *id005
71
- - !ruby/object:Gem::Dependency
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: 1.6.4
68
+ - !ruby/object:Gem::Dependency
72
69
  name: filename
73
- requirement: &id006 !ruby/object:Gem::Requirement
74
- none: false
75
- requirements:
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
76
72
  - - ">="
77
- - !ruby/object:Gem::Version
73
+ - !ruby/object:Gem::Version
78
74
  version: 0.1.0
79
75
  type: :development
80
76
  prerelease: false
81
- version_requirements: *id006
82
- - !ruby/object:Gem::Dependency
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: 0.1.0
82
+ - !ruby/object:Gem::Dependency
83
83
  name: user_config
84
- requirement: &id007 !ruby/object:Gem::Requirement
85
- none: false
86
- requirements:
84
+ requirement: !ruby/object:Gem::Requirement
85
+ requirements:
87
86
  - - ">="
88
- - !ruby/object:Gem::Version
87
+ - !ruby/object:Gem::Version
89
88
  version: 0.0.2
90
89
  type: :development
91
90
  prerelease: false
92
- version_requirements: *id007
93
- - !ruby/object:Gem::Dependency
91
+ version_requirements: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: 0.0.2
96
+ - !ruby/object:Gem::Dependency
94
97
  name: git
95
- requirement: &id008 !ruby/object:Gem::Requirement
96
- none: false
97
- requirements:
98
+ requirement: !ruby/object:Gem::Requirement
99
+ requirements:
98
100
  - - ">="
99
- - !ruby/object:Gem::Version
101
+ - !ruby/object:Gem::Version
100
102
  version: 1.2.5
101
103
  type: :runtime
102
104
  prerelease: false
103
- version_requirements: *id008
104
- - !ruby/object:Gem::Dependency
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: 1.2.5
110
+ - !ruby/object:Gem::Dependency
105
111
  name: filename
106
- requirement: &id009 !ruby/object:Gem::Requirement
107
- none: false
108
- requirements:
112
+ requirement: !ruby/object:Gem::Requirement
113
+ requirements:
109
114
  - - ">="
110
- - !ruby/object:Gem::Version
115
+ - !ruby/object:Gem::Version
111
116
  version: 0.1.0
112
117
  type: :runtime
113
118
  prerelease: false
114
- version_requirements: *id009
115
- - !ruby/object:Gem::Dependency
119
+ version_requirements: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ version: 0.1.0
124
+ - !ruby/object:Gem::Dependency
116
125
  name: user_config
117
- requirement: &id010 !ruby/object:Gem::Requirement
118
- none: false
119
- requirements:
126
+ requirement: !ruby/object:Gem::Requirement
127
+ requirements:
120
128
  - - ">="
121
- - !ruby/object:Gem::Version
129
+ - !ruby/object:Gem::Version
122
130
  version: 0.0.2
123
131
  type: :runtime
124
132
  prerelease: false
125
- version_requirements: *id010
133
+ version_requirements: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - ">="
136
+ - !ruby/object:Gem::Version
137
+ version: 0.0.2
126
138
  description: Create LaTeX project with git from template, which uses latexmk.
127
139
  email: d@ytak.info
128
- executables:
140
+ executables:
129
141
  - latex-project-template
130
142
  extensions: []
131
-
132
- extra_rdoc_files:
143
+ extra_rdoc_files:
133
144
  - LICENSE.txt
134
145
  - README.md
135
- files:
136
- - .document
137
- - .rspec
146
+ files:
147
+ - ".document"
148
+ - ".rspec"
138
149
  - Gemfile
139
150
  - LICENSE.txt
140
151
  - README.md
@@ -157,36 +168,25 @@ files:
157
168
  - spec/latex_project_template_spec.rb
158
169
  - spec/spec_helper.rb
159
170
  - spec/task_spec.rb
160
- has_rdoc: true
161
171
  homepage: http://github.com/ytaka/latex-project-template
162
- licenses:
172
+ licenses:
163
173
  - GPLv3
164
- post_install_message:
174
+ metadata: {}
165
175
  rdoc_options: []
166
-
167
- require_paths:
176
+ require_paths:
168
177
  - lib
169
- required_ruby_version: !ruby/object:Gem::Requirement
170
- none: false
171
- requirements:
178
+ required_ruby_version: !ruby/object:Gem::Requirement
179
+ requirements:
172
180
  - - ">="
173
- - !ruby/object:Gem::Version
174
- hash: -161505429239603935
175
- segments:
176
- - 0
177
- version: "0"
178
- required_rubygems_version: !ruby/object:Gem::Requirement
179
- none: false
180
- requirements:
181
+ - !ruby/object:Gem::Version
182
+ version: '0'
183
+ required_rubygems_version: !ruby/object:Gem::Requirement
184
+ requirements:
181
185
  - - ">="
182
- - !ruby/object:Gem::Version
183
- version: "0"
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
184
188
  requirements: []
185
-
186
- rubyforge_project:
187
- rubygems_version: 1.6.2
188
- signing_key:
189
- specification_version: 3
189
+ rubygems_version: 3.6.2
190
+ specification_version: 4
190
191
  summary: LaTeX Project Template
191
192
  test_files: []
192
-