texy 0.8.2 → 0.10.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cdca86ea26d9a7605a8f716e8f7278aedd1d8256bb81664c224b6f442f0083ba
4
- data.tar.gz: b057845534c305f485cc6e806f1952516d6effa118e4d1a393c6a935e5a7cccb
3
+ metadata.gz: 22c1b9c891f0747dc3c6a75d99c566e2f8cf0259d6f9451ea6401409e8cdf2f3
4
+ data.tar.gz: 6d830d3aad5706aa5a8213b265ae39bf24eb83935ba1e11e5638536dc511811e
5
5
  SHA512:
6
- metadata.gz: a9cc3f2789e889eb4a38213328ceb2c5f8dd3424869e9355d3a6feeab322a77f7864f99fdea1f67ac28de669cdff2c8e032f64e1c80669c92db680366b076be7
7
- data.tar.gz: 3cf5432aaf0ff3910d82661392445b8899b8868c1707300887c9403f714cdb744040934c997eb663e18db0677f5b9751cdaa3e7157d703b0c5b377db82e3348a
6
+ metadata.gz: 02be7094aab23b6308d775b303bc704101a1ad535642937b1cf4c3a08186d9071b4565c83ef959f9cdcdc65e913f5a92740dbaa3c33b35e67fecf9192a2725c0
7
+ data.tar.gz: 21376883ffe1ea73b79a7a52b3e2eeaf22a9bd4b6510356ff048e0ed47382b441b9218f24ab2b49177158d4e998e19cc5489216836a60c51aaafaf8ef21925dd
@@ -0,0 +1 @@
1
+ ruby 2.6.3
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- texy (0.8.2)
4
+ texy (0.10.2)
5
5
  activesupport (~> 6.0)
6
6
  thor (~> 0.20.3)
7
7
  zeitwerk (~> 2.1)
@@ -9,12 +9,12 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- activesupport (6.0.2.2)
12
+ activesupport (6.0.3)
13
13
  concurrent-ruby (~> 1.0, >= 1.0.2)
14
14
  i18n (>= 0.7, < 2)
15
15
  minitest (~> 5.1)
16
16
  tzinfo (~> 1.1)
17
- zeitwerk (~> 2.2)
17
+ zeitwerk (~> 2.2, >= 2.2.2)
18
18
  ast (2.4.0)
19
19
  coderay (1.1.2)
20
20
  concurrent-ruby (1.1.6)
@@ -40,19 +40,6 @@ module Texy
40
40
  exit
41
41
  end
42
42
 
43
- desc "new-change", "Create a new Change Order"
44
- def new_change
45
- @repository = Documents::ChangeOrder.repository
46
- @object = Documents::ChangeOrder.new
47
-
48
- set_up_environment
49
-
50
- populate_code(object: @object)
51
- rescue SystemExit, Interrupt
52
- say "Exiting"
53
- exit
54
- end
55
-
56
43
  desc "new-release-notes", "Create new Release Notes"
57
44
  def new_release_notes
58
45
  @repository = Documents::ReleaseNotes.repository
@@ -69,7 +56,7 @@ module Texy
69
56
  no_commands do
70
57
  # Dynamic placeholder file names in the .templates directory allow the object to define the main file's name
71
58
  def main_file_name
72
- @object.file
59
+ @object.file_no_extension
73
60
  end
74
61
  end
75
62
 
@@ -77,7 +64,7 @@ module Texy
77
64
 
78
65
  def populate_code(object:)
79
66
  create_folder(folder: object.folder)
80
- copy_template_files(template_name: object.type, folder: object.folder, file: object.file)
67
+ copy_template_files(template_name: object.type, folder: object.folder)
81
68
 
82
69
  say "Time to populate the LaTeX file..."
83
70
 
@@ -89,20 +76,22 @@ module Texy
89
76
  def create_folder(folder:)
90
77
  say "Creating folder structure..."
91
78
 
92
- empty_directory folder
79
+ empty_directory "#{TOP_LEVEL_DIRECTORY}/#{folder}"
93
80
 
94
81
  say "Folder #{folder} created", :green
95
82
  end
96
83
 
97
- def copy_template_files(template_name:, folder:, file:)
84
+ def copy_template_files(template_name:, folder:)
98
85
  say "Copying template files..."
99
86
 
100
- directory template_name, folder, recursive: true
87
+ directory template_name, "#{TOP_LEVEL_DIRECTORY}/#{folder}", recursive: true
101
88
 
102
89
  say "Template files copied", :green
103
90
  end
104
91
 
105
92
  def push_to_git(branch:)
93
+ return if ENV["DEBUG"]
94
+
106
95
  say "Ensuring that branch exists..."
107
96
 
108
97
  unless system_no_output("git rev-parse --verify #{branch}")
@@ -6,7 +6,7 @@ module Texy
6
6
  include Thor::Actions
7
7
 
8
8
  attr_reader :configuration
9
- attr_reader :nead_werx
9
+ attr_reader :company
10
10
  attr_reader :client
11
11
 
12
12
  CONFIGURATION_FILE_NAME = "customers.yml"
@@ -21,8 +21,8 @@ module Texy
21
21
  exit
22
22
  end
23
23
 
24
- @nead_werx = Configuration::NeadWerx.new(configuration.dig(:nead_werx))
25
- @client = Configuration::Client.new(configuration.dig(:client))
24
+ @company = Configuration::Company.new(configuration.dig(:company))
25
+ @client = Configuration::Client.new(configuration.dig(:client))
26
26
  end
27
27
  end
28
28
  end
@@ -23,20 +23,20 @@ module Texy
23
23
 
24
24
  def extract_people
25
25
  @principal = Configuration::Person.new(**configuration.dig(:principal))
26
- @signer = Configuration::Person.new(**configuration.dig(:signer))
26
+ @signer = Configuration::Person.new(**configuration.dig(:signer))
27
27
  end
28
28
 
29
29
  def extract_rate
30
- @rate = configuration.dig(:rate)
30
+ @rate = configuration.dig(:rate)
31
31
  @rate_multiplier = configuration.dig(:rate_multiplier)
32
32
  end
33
33
 
34
34
  def extract_basic_info
35
- @name = configuration.dig(:name)
36
- @short_name = configuration.dig(:short_name)
37
- @abbreviation = configuration.dig(:abbreviation)
38
- @number = configuration.dig(:number)
39
- @system_name = configuration.dig(:system_name)
35
+ @name = configuration.dig(:name)
36
+ @short_name = configuration.dig(:short_name)
37
+ @abbreviation = configuration.dig(:abbreviation)
38
+ @number = configuration.dig(:number)
39
+ @system_name = configuration.dig(:system_name)
40
40
  end
41
41
  end
42
42
  end
@@ -2,12 +2,12 @@
2
2
 
3
3
  module Texy
4
4
  class Configuration
5
- class NeadWerx
5
+ class Company
6
6
  attr_reader :configuration
7
7
  attr_reader :principal, :signer
8
8
 
9
- def initialize(nead_werx_configuration)
10
- @configuration = nead_werx_configuration
9
+ def initialize(company_configuration)
10
+ @configuration = company_configuration
11
11
 
12
12
  extract_people
13
13
  end
@@ -16,7 +16,7 @@ module Texy
16
16
 
17
17
  def extract_people
18
18
  @principal = Configuration::Person.new(**configuration.dig(:principal))
19
- @signer = Configuration::Person.new(**configuration.dig(:signer))
19
+ @signer = Configuration::Person.new(**configuration.dig(:signer))
20
20
  end
21
21
  end
22
22
  end
@@ -13,7 +13,7 @@ module Texy
13
13
  def initialize
14
14
  @client = ask("Which client folder will this #{type_humanized} be in?", :yellow)
15
15
  @number = ask("Which #{type_humanized} number is this?", :yellow).rjust(3, "0")
16
- @title = ask("What is the title of this document?", :yellow)
16
+ @title = ask("What is the title of this document?", :yellow)
17
17
  end
18
18
 
19
19
  def branch
@@ -24,8 +24,16 @@ module Texy
24
24
  "#{client}/#{number}"
25
25
  end
26
26
 
27
+ def file_no_extension
28
+ "#{client}_#{number}"
29
+ end
30
+
27
31
  def file
28
- "#{client}_#{number}.tex"
32
+ "#{file_no_extension}.tex"
33
+ end
34
+
35
+ def definition_file
36
+ "lib/commands_and_definitions.tex"
29
37
  end
30
38
 
31
39
  def substitute_placeholders(configuration:)
@@ -37,31 +45,31 @@ module Texy
37
45
  # Placeholders dependent on the client configuration
38
46
  def config_placeholders
39
47
  {
40
- /TEMPLATE-PLACEHOLDER-CLIENT-NAME/ => ->(config) { config.client.name },
41
- /TEMPLATE-PLACEHOLDER-CLIENT-NUMBER/ => ->(config) { config.client.number },
42
- /TEMPLATE-PLACEHOLDER-CLIENT-SHORT-NAME/ => ->(config) { config.client.short_name },
43
- /TEMPLATE-PLACEHOLDER-CLIENT-PRINCIPAL-NAME/ => ->(config) { config.client.principal.name },
44
- /TEMPLATE-PLACEHOLDER-CLIENT-SIGNER-NAME/ => ->(config) { config.client.signer.name },
45
- /TEMPLATE-PLACEHOLDER-CLIENT-SIGNER-ROLE/ => ->(config) { config.client.signer.role },
46
- /TEMPLATE-PLACEHOLDER-NEAD-WERX-PRINCIPAL-NAME/ => ->(config) { config.nead_werx.principal.name },
47
- /TEMPLATE-PLACEHOLDER-NEAD-WERX-SIGNER-NAME/ => ->(config) { config.nead_werx.signer.name },
48
- /TEMPLATE-PLACEHOLDER-NEAD-WERX-SIGNER-ROLE/ => ->(config) { config.nead_werx.signer.role },
48
+ /TEMPLATE-PLACEHOLDER-CLIENT-NAME/ => ->(config) { config.client.name },
49
+ /TEMPLATE-PLACEHOLDER-CLIENT-NUMBER/ => ->(config) { config.client.number },
50
+ /TEMPLATE-PLACEHOLDER-CLIENT-SHORT-NAME/ => ->(config) { config.client.short_name },
51
+ /TEMPLATE-PLACEHOLDER-CLIENT-PRINCIPAL-NAME/ => ->(config) { config.client.principal.name },
52
+ /TEMPLATE-PLACEHOLDER-CLIENT-SIGNER-NAME/ => ->(config) { config.client.signer.name },
53
+ /TEMPLATE-PLACEHOLDER-CLIENT-SIGNER-ROLE/ => ->(config) { config.client.signer.role },
54
+ /TEMPLATE-PLACEHOLDER-NEAD-WERX-PRINCIPAL-NAME/ => ->(config) { config.company.principal.name },
55
+ /TEMPLATE-PLACEHOLDER-NEAD-WERX-SIGNER-NAME/ => ->(config) { config.company.signer.name },
56
+ /TEMPLATE-PLACEHOLDER-NEAD-WERX-SIGNER-ROLE/ => ->(config) { config.company.signer.role }
49
57
  }
50
58
  end
51
59
 
52
60
  # Placeholders dependent on this specific document, not the client in general
53
61
  def base_placeholders
54
62
  {
55
- /TEMPLATE-PLACEHOLDER-PROJECT-NUMBER/ => ->(document) { document.number },
56
- /TEMPLATE-PLACEHOLDER-PROJECT-TITLE/ => ->(document) { document.title },
57
- /TEMPLATE-PLACEHOLDER-DOCUMENT-VERSION/ => ->(_document) { "1.0" },
63
+ /TEMPLATE-PLACEHOLDER-PROJECT-NUMBER/ => ->(document) { document.number },
64
+ /TEMPLATE-PLACEHOLDER-PROJECT-TITLE/ => ->(document) { document.title },
65
+ /TEMPLATE-PLACEHOLDER-DOCUMENT-VERSION/ => ->(_document) { "1.0" }
58
66
  }
59
67
  end
60
68
 
61
69
  # Placeholders located in the index file, not the LaTeX file
62
70
  def index_file_placeholders
63
71
  {
64
- /TEMPLATE-PLACEHOLDER-INDEX-TITLE/ => ->(document) { document.title },
72
+ /TEMPLATE-PLACEHOLDER-INDEX-TITLE/ => ->(document) { document.title }
65
73
  }
66
74
  end
67
75
 
@@ -81,7 +89,7 @@ module Texy
81
89
  base_placeholders.each do |regex, document_method|
82
90
  placeholder_value = document_method.call(self)
83
91
 
84
- substitute(file: "#{folder}/#{file}", pattern: regex, replacement: placeholder_value)
92
+ substitute(file: "#{folder}/#{definition_file}", pattern: regex, replacement: placeholder_value)
85
93
  end
86
94
 
87
95
  say "Base file substitutions complete", :green
@@ -91,7 +99,7 @@ module Texy
91
99
  config_placeholders.each do |regex, config_method|
92
100
  placeholder_value = config_method.call(configuration)
93
101
 
94
- substitute(file: "#{folder}/#{file}", pattern: regex, replacement: placeholder_value)
102
+ substitute(file: "#{folder}/#{definition_file}", pattern: regex, replacement: placeholder_value)
95
103
  end
96
104
 
97
105
  say "Configuration file substitutions complete", :green
@@ -11,6 +11,11 @@ module Texy
11
11
  "git@bitbucket.org:neadwerx/release-notes.git"
12
12
  end
13
13
 
14
+ # We don't have definitions extracted for release notes yet
15
+ def definition_file
16
+ file
17
+ end
18
+
14
19
  def type_humanized
15
20
  "Release Notes version"
16
21
  end
@@ -21,8 +21,8 @@ module Texy
21
21
 
22
22
  def config_placeholders
23
23
  super.merge(
24
- /TEMPLATE-PLACEHOLDER-CLIENT-HOURLY-RATE/ => ->(config) { config.client.rate },
25
- /TEMPLATE-PLACEHOLDER-CLIENT-RATE-MULTIPLIER/ => ->(config) { config.client.rate_multiplier },
24
+ /TEMPLATE-PLACEHOLDER-CLIENT-HOURLY-RATE/ => ->(config) { config.client.rate },
25
+ /TEMPLATE-PLACEHOLDER-CLIENT-RATE-MULTIPLIER/ => ->(config) { config.client.rate_multiplier }
26
26
  )
27
27
  end
28
28
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Texy
4
- VERSION = "0.8.2"
4
+ VERSION = "0.10.2"
5
5
  end
@@ -5,14 +5,14 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
  require "texy/version"
6
6
 
7
7
  Gem::Specification.new do |spec|
8
- spec.name = "texy"
9
- spec.version = Texy::VERSION
10
- spec.authors = ["Stephen Dolan"]
11
- spec.email = ["stephen@neadwerx.com"]
8
+ spec.name = "texy"
9
+ spec.version = Texy::VERSION
10
+ spec.authors = ["Stephen Dolan"]
11
+ spec.email = ["stephen@neadwerx.com"]
12
12
 
13
- spec.summary = "Command line tool for SoW writing"
14
- spec.description = "Command line tool for SoW writing"
15
- spec.homepage = "https://neadwerx.com"
13
+ spec.summary = "Command line tool for SoW writing"
14
+ spec.description = "Command line tool for SoW writing"
15
+ spec.homepage = "https://neadwerx.com"
16
16
 
17
17
  raise "RubyGems 2.0 or newer is required to protect against public gem pushes." unless spec.respond_to?(:metadata)
18
18
 
@@ -26,17 +26,17 @@ Gem::Specification.new do |spec|
26
26
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
27
27
  end
28
28
 
29
- spec.bindir = "exe"
30
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
29
+ spec.bindir = "exe"
30
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
31
  spec.require_paths = ["lib"]
32
32
 
33
33
  spec.add_dependency "activesupport", "~> 6.0"
34
34
  spec.add_dependency "thor", "~> 0.20.3"
35
35
  spec.add_dependency "zeitwerk", "~> 2.1"
36
36
 
37
- spec.add_development_dependency "bundler", "~> 2.0"
38
- spec.add_development_dependency "pry", "~> 0.12"
39
- spec.add_development_dependency "rake", "~> 10.0"
40
- spec.add_development_dependency "rspec", "~> 3.0"
37
+ spec.add_development_dependency "bundler", "~> 2.0"
38
+ spec.add_development_dependency "pry", "~> 0.12"
39
+ spec.add_development_dependency "rake", "~> 10.0"
40
+ spec.add_development_dependency "rspec", "~> 3.0"
41
41
  spec.add_development_dependency "standard", "~> 0.2.5"
42
42
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: texy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.10.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Dolan
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-04-28 00:00:00.000000000 Z
11
+ date: 2020-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -133,6 +133,7 @@ files:
133
133
  - ".gitignore"
134
134
  - ".rspec"
135
135
  - ".ruby-version"
136
+ - ".tool-versions"
136
137
  - CHANGELOG.md
137
138
  - Gemfile
138
139
  - Gemfile.lock
@@ -144,10 +145,9 @@ files:
144
145
  - lib/texy.rb
145
146
  - lib/texy/configuration.rb
146
147
  - lib/texy/configuration/client.rb
147
- - lib/texy/configuration/nead_werx.rb
148
+ - lib/texy/configuration/company.rb
148
149
  - lib/texy/configuration/person.rb
149
150
  - lib/texy/document.rb
150
- - lib/texy/documents/change_order.rb
151
151
  - lib/texy/documents/release_notes.rb
152
152
  - lib/texy/documents/statement_of_work.rb
153
153
  - lib/texy/version.rb
@@ -156,7 +156,7 @@ homepage: https://neadwerx.com
156
156
  licenses: []
157
157
  metadata:
158
158
  homepage_uri: https://neadwerx.com
159
- post_install_message:
159
+ post_install_message:
160
160
  rdoc_options: []
161
161
  require_paths:
162
162
  - lib
@@ -171,8 +171,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
171
171
  - !ruby/object:Gem::Version
172
172
  version: '0'
173
173
  requirements: []
174
- rubygems_version: 3.1.2
175
- signing_key:
174
+ rubygems_version: 3.0.3
175
+ signing_key:
176
176
  specification_version: 4
177
177
  summary: Command line tool for SoW writing
178
178
  test_files: []
@@ -1,30 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Texy
4
- module Documents
5
- class ChangeOrder < Document
6
- def initialize
7
- super
8
- end
9
-
10
- def self.repository
11
- "git@bitbucket.org:neadwerx/leads.git"
12
- end
13
-
14
- def type_humanized
15
- "Change Order"
16
- end
17
-
18
- def type
19
- "change_order"
20
- end
21
-
22
- def config_placeholders
23
- super.merge(
24
- /TEMPLATE-PLACEHOLDER-CLIENT-HOURLY-RATE/ => ->(config) { config.client.rate },
25
- /TEMPLATE-PLACEHOLDER-CLIENT-RATE-MULTIPLIER/ => ->(config) { config.client.rate_multiplier },
26
- )
27
- end
28
- end
29
- end
30
- end