texy 0.8.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +82 -0
- data/README.md +35 -0
- data/Rakefile +8 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/exe/texy +13 -0
- data/lib/texy.rb +158 -0
- data/lib/texy/configuration.rb +28 -0
- data/lib/texy/configuration/client.rb +43 -0
- data/lib/texy/configuration/company.rb +23 -0
- data/lib/texy/configuration/person.rb +15 -0
- data/lib/texy/document.rb +109 -0
- data/lib/texy/documents/change_order.rb +30 -0
- data/lib/texy/documents/release_notes.rb +23 -0
- data/lib/texy/documents/statement_of_work.rb +30 -0
- data/lib/texy/version.rb +5 -0
- data/texy.gemspec +42 -0
- metadata +178 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: dbc336b802cc6399c4aacfb79cfc95f745f1f582f2763b3ff08709d2a28ae811
|
4
|
+
data.tar.gz: 58a2ee34ea84b662b3bfe433ebd6b0df9d87e2b084bc81fcd36f05590a3e9854
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8e70e345718dfc974e82b8d5b16c7497e6e66c55ccc736b6d05316024800f072ea2c39cff0045679c7624e0779d9ba7ab27390237ee4715e327996122242802b
|
7
|
+
data.tar.gz: 2f56c11c16e76058c4f342292dbea416cbdc24c356cf14643f2f24c965ffe69f354790de9b61a011a310122fcfdd3768b36dccb89e3b39bf4d2255eb5ff054e7
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.6.3
|
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
texy (0.8.3)
|
5
|
+
activesupport (~> 6.0)
|
6
|
+
thor (~> 0.20.3)
|
7
|
+
zeitwerk (~> 2.1)
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: https://rubygems.org/
|
11
|
+
specs:
|
12
|
+
activesupport (6.0.2.2)
|
13
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
|
+
i18n (>= 0.7, < 2)
|
15
|
+
minitest (~> 5.1)
|
16
|
+
tzinfo (~> 1.1)
|
17
|
+
zeitwerk (~> 2.2)
|
18
|
+
ast (2.4.0)
|
19
|
+
coderay (1.1.2)
|
20
|
+
concurrent-ruby (1.1.6)
|
21
|
+
diff-lcs (1.3)
|
22
|
+
i18n (1.8.2)
|
23
|
+
concurrent-ruby (~> 1.0)
|
24
|
+
jaro_winkler (1.5.4)
|
25
|
+
method_source (1.0.0)
|
26
|
+
minitest (5.14.0)
|
27
|
+
parallel (1.19.1)
|
28
|
+
parser (2.7.1.1)
|
29
|
+
ast (~> 2.4.0)
|
30
|
+
pry (0.13.1)
|
31
|
+
coderay (~> 1.1)
|
32
|
+
method_source (~> 1.0)
|
33
|
+
rainbow (3.0.0)
|
34
|
+
rake (10.5.0)
|
35
|
+
rexml (3.2.4)
|
36
|
+
rspec (3.9.0)
|
37
|
+
rspec-core (~> 3.9.0)
|
38
|
+
rspec-expectations (~> 3.9.0)
|
39
|
+
rspec-mocks (~> 3.9.0)
|
40
|
+
rspec-core (3.9.1)
|
41
|
+
rspec-support (~> 3.9.1)
|
42
|
+
rspec-expectations (3.9.1)
|
43
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
44
|
+
rspec-support (~> 3.9.0)
|
45
|
+
rspec-mocks (3.9.1)
|
46
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
47
|
+
rspec-support (~> 3.9.0)
|
48
|
+
rspec-support (3.9.2)
|
49
|
+
rubocop (0.80.1)
|
50
|
+
jaro_winkler (~> 1.5.1)
|
51
|
+
parallel (~> 1.10)
|
52
|
+
parser (>= 2.7.0.1)
|
53
|
+
rainbow (>= 2.2.2, < 4.0)
|
54
|
+
rexml
|
55
|
+
ruby-progressbar (~> 1.7)
|
56
|
+
unicode-display_width (>= 1.4.0, < 1.7)
|
57
|
+
rubocop-performance (1.5.2)
|
58
|
+
rubocop (>= 0.71.0)
|
59
|
+
ruby-progressbar (1.10.1)
|
60
|
+
standard (0.2.5)
|
61
|
+
rubocop (~> 0.80.1)
|
62
|
+
rubocop-performance (~> 1.5.2)
|
63
|
+
thor (0.20.3)
|
64
|
+
thread_safe (0.3.6)
|
65
|
+
tzinfo (1.2.7)
|
66
|
+
thread_safe (~> 0.1)
|
67
|
+
unicode-display_width (1.6.1)
|
68
|
+
zeitwerk (2.3.0)
|
69
|
+
|
70
|
+
PLATFORMS
|
71
|
+
ruby
|
72
|
+
|
73
|
+
DEPENDENCIES
|
74
|
+
bundler (~> 2.0)
|
75
|
+
pry (~> 0.12)
|
76
|
+
rake (~> 10.0)
|
77
|
+
rspec (~> 3.0)
|
78
|
+
standard (~> 0.2.5)
|
79
|
+
texy!
|
80
|
+
|
81
|
+
BUNDLED WITH
|
82
|
+
2.1.4
|
data/README.md
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# Texy
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/texy`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'texy'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install texy
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/texy.
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "bundler/setup"
|
5
|
+
require "texy"
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require "irb"
|
15
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/exe/texy
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "texy"
|
5
|
+
|
6
|
+
# Add functionality to print the CLI version number.
|
7
|
+
# Added outside of Thor to exclude from --help output.
|
8
|
+
if ARGV[0] == "--version" || ARGV[0] == "-v"
|
9
|
+
puts "Texy #{Texy::VERSION}"
|
10
|
+
exit
|
11
|
+
end
|
12
|
+
|
13
|
+
Texy::CLI.start(ARGV)
|
data/lib/texy.rb
ADDED
@@ -0,0 +1,158 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "thor"
|
4
|
+
require "active_support/core_ext/hash/keys"
|
5
|
+
require "yaml"
|
6
|
+
|
7
|
+
require "zeitwerk"
|
8
|
+
loader = Zeitwerk::Loader.for_gem
|
9
|
+
loader.setup
|
10
|
+
|
11
|
+
require "pry" if ENV["DEBUG"]
|
12
|
+
|
13
|
+
module Texy
|
14
|
+
TOP_LEVEL_DIRECTORY = `git rev-parse --show-toplevel`.strip
|
15
|
+
PROTECTED_BRANCH_NAME = "master"
|
16
|
+
|
17
|
+
class CLI < Thor
|
18
|
+
include Thor::Actions
|
19
|
+
|
20
|
+
attr_reader :repository
|
21
|
+
|
22
|
+
def self.source_root
|
23
|
+
"#{TOP_LEVEL_DIRECTORY}/.templates"
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.destination_root
|
27
|
+
TOP_LEVEL_DIRECTORY
|
28
|
+
end
|
29
|
+
|
30
|
+
desc "new-sow", "Create a new Statement of Work"
|
31
|
+
def new_sow
|
32
|
+
@repository = Documents::StatementOfWork.repository
|
33
|
+
@object = Documents::StatementOfWork.new
|
34
|
+
|
35
|
+
set_up_environment
|
36
|
+
|
37
|
+
populate_code(object: @object)
|
38
|
+
rescue SystemExit, Interrupt
|
39
|
+
say "Exiting"
|
40
|
+
exit
|
41
|
+
end
|
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
|
+
desc "new-release-notes", "Create new Release Notes"
|
57
|
+
def new_release_notes
|
58
|
+
@repository = Documents::ReleaseNotes.repository
|
59
|
+
@object = Documents::ReleaseNotes.new
|
60
|
+
|
61
|
+
set_up_environment
|
62
|
+
|
63
|
+
populate_code(object: @object)
|
64
|
+
rescue SystemExit, Interrupt
|
65
|
+
say "Exiting"
|
66
|
+
exit
|
67
|
+
end
|
68
|
+
|
69
|
+
no_commands do
|
70
|
+
# Dynamic placeholder file names in the .templates directory allow the object to define the main file's name
|
71
|
+
def main_file_name
|
72
|
+
@object.file
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
private
|
77
|
+
|
78
|
+
def populate_code(object:)
|
79
|
+
create_folder(folder: object.folder)
|
80
|
+
copy_template_files(template_name: object.type, folder: object.folder, file: object.file)
|
81
|
+
|
82
|
+
say "Time to populate the LaTeX file..."
|
83
|
+
|
84
|
+
object.substitute_placeholders(configuration: Configuration.new(client_name: object.client))
|
85
|
+
|
86
|
+
push_to_git(branch: PROTECTED_BRANCH_NAME) unless ENV["DEBUG"]
|
87
|
+
end
|
88
|
+
|
89
|
+
def create_folder(folder:)
|
90
|
+
say "Creating folder structure..."
|
91
|
+
|
92
|
+
empty_directory folder
|
93
|
+
|
94
|
+
say "Folder #{folder} created", :green
|
95
|
+
end
|
96
|
+
|
97
|
+
def copy_template_files(template_name:, folder:, file:)
|
98
|
+
say "Copying template files..."
|
99
|
+
|
100
|
+
directory template_name, folder, recursive: true
|
101
|
+
|
102
|
+
say "Template files copied", :green
|
103
|
+
end
|
104
|
+
|
105
|
+
def push_to_git(branch:)
|
106
|
+
say "Ensuring that branch exists..."
|
107
|
+
|
108
|
+
unless system_no_output("git rev-parse --verify #{branch}")
|
109
|
+
puts "Branch does not exists"
|
110
|
+
exit
|
111
|
+
end
|
112
|
+
|
113
|
+
say "Branch exists", :green
|
114
|
+
|
115
|
+
say "Committing code..."
|
116
|
+
|
117
|
+
system("git add .")
|
118
|
+
system("git commit --no-verify -m '[ci skip] Automated commit from texy'")
|
119
|
+
|
120
|
+
say "Code committed..."
|
121
|
+
|
122
|
+
say "Pushing branch to remote..."
|
123
|
+
|
124
|
+
system("git push --set-upstream origin #{branch}")
|
125
|
+
|
126
|
+
say "Branch #{branch} pushed to remote", :green
|
127
|
+
end
|
128
|
+
|
129
|
+
def set_up_environment
|
130
|
+
check_run_location!
|
131
|
+
end
|
132
|
+
|
133
|
+
def check_run_location!
|
134
|
+
return if ENV["DEBUG"]
|
135
|
+
|
136
|
+
return if in_correct_repository? && on_protected_branch? && porcelain_status?
|
137
|
+
|
138
|
+
say "Run this in the #{repository} repository on a clean master branch.", :red
|
139
|
+
exit
|
140
|
+
end
|
141
|
+
|
142
|
+
def in_correct_repository?
|
143
|
+
repository == `git remote get-url origin`.strip
|
144
|
+
end
|
145
|
+
|
146
|
+
def on_protected_branch?
|
147
|
+
PROTECTED_BRANCH_NAME == `git rev-parse --abbrev-ref HEAD`.strip
|
148
|
+
end
|
149
|
+
|
150
|
+
def porcelain_status?
|
151
|
+
`git status --porcelain`.strip.empty?
|
152
|
+
end
|
153
|
+
|
154
|
+
def system_no_output(command)
|
155
|
+
system("#{command} > /dev/null 2>&1")
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Texy
|
4
|
+
class Configuration
|
5
|
+
include Thor::Base
|
6
|
+
include Thor::Actions
|
7
|
+
|
8
|
+
attr_reader :configuration
|
9
|
+
attr_reader :company
|
10
|
+
attr_reader :client
|
11
|
+
|
12
|
+
CONFIGURATION_FILE_NAME = "customers.yml"
|
13
|
+
|
14
|
+
def initialize(client_name:)
|
15
|
+
configuration_file = File.read("#{TOP_LEVEL_DIRECTORY}/#{CONFIGURATION_FILE_NAME}")
|
16
|
+
full_configuration = YAML.safe_load(configuration_file, aliases: true)
|
17
|
+
@configuration = full_configuration.dig(client_name)&.deep_symbolize_keys
|
18
|
+
|
19
|
+
unless @configuration
|
20
|
+
say "No configuration in #{TOP_LEVEL_DIRECTORY}/#{CONFIGURATION_FILE_NAME} for '#{client_name}'", :red
|
21
|
+
exit
|
22
|
+
end
|
23
|
+
|
24
|
+
@company = Configuration::Company.new(configuration.dig(:company))
|
25
|
+
@client = Configuration::Client.new(configuration.dig(:client))
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Texy
|
4
|
+
class Configuration
|
5
|
+
class Client
|
6
|
+
attr_reader :configuration
|
7
|
+
|
8
|
+
attr_reader :name, :short_name, :abbreviation
|
9
|
+
attr_reader :number
|
10
|
+
attr_reader :system_name
|
11
|
+
attr_reader :rate, :rate_multiplier
|
12
|
+
attr_reader :principal, :signer
|
13
|
+
|
14
|
+
def initialize(client_configuration)
|
15
|
+
@configuration = client_configuration
|
16
|
+
|
17
|
+
extract_basic_info
|
18
|
+
extract_people
|
19
|
+
extract_rate
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def extract_people
|
25
|
+
@principal = Configuration::Person.new(**configuration.dig(:principal))
|
26
|
+
@signer = Configuration::Person.new(**configuration.dig(:signer))
|
27
|
+
end
|
28
|
+
|
29
|
+
def extract_rate
|
30
|
+
@rate = configuration.dig(:rate)
|
31
|
+
@rate_multiplier = configuration.dig(:rate_multiplier)
|
32
|
+
end
|
33
|
+
|
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)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Texy
|
4
|
+
class Configuration
|
5
|
+
class Company
|
6
|
+
attr_reader :configuration
|
7
|
+
attr_reader :principal, :signer
|
8
|
+
|
9
|
+
def initialize(company_configuration)
|
10
|
+
@configuration = company_configuration
|
11
|
+
|
12
|
+
extract_people
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def extract_people
|
18
|
+
@principal = Configuration::Person.new(**configuration.dig(:principal))
|
19
|
+
@signer = Configuration::Person.new(**configuration.dig(:signer))
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,109 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "thor"
|
4
|
+
require "pry"
|
5
|
+
|
6
|
+
module Texy
|
7
|
+
class Document
|
8
|
+
include Thor::Base
|
9
|
+
include Thor::Actions
|
10
|
+
|
11
|
+
attr_reader :client, :number, :title
|
12
|
+
|
13
|
+
def initialize
|
14
|
+
@client = ask("Which client folder will this #{type_humanized} be in?", :yellow)
|
15
|
+
@number = ask("Which #{type_humanized} number is this?", :yellow).rjust(3, "0")
|
16
|
+
@title = ask("What is the title of this document?", :yellow)
|
17
|
+
end
|
18
|
+
|
19
|
+
def branch
|
20
|
+
"#{type}/#{client}-#{number}"
|
21
|
+
end
|
22
|
+
|
23
|
+
def folder
|
24
|
+
"#{client}/#{number}"
|
25
|
+
end
|
26
|
+
|
27
|
+
def file
|
28
|
+
"#{client}_#{number}.tex"
|
29
|
+
end
|
30
|
+
|
31
|
+
def substitute_placeholders(configuration:)
|
32
|
+
perform_index_file_substitutions
|
33
|
+
perform_base_substitutions
|
34
|
+
perform_configuration_substitutions(configuration: configuration)
|
35
|
+
end
|
36
|
+
|
37
|
+
# Placeholders dependent on the client configuration
|
38
|
+
def config_placeholders
|
39
|
+
{
|
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.company.principal.name },
|
47
|
+
/TEMPLATE-PLACEHOLDER-NEAD-WERX-SIGNER-NAME/ => ->(config) { config.company.signer.name },
|
48
|
+
/TEMPLATE-PLACEHOLDER-NEAD-WERX-SIGNER-ROLE/ => ->(config) { config.company.signer.role }
|
49
|
+
}
|
50
|
+
end
|
51
|
+
|
52
|
+
# Placeholders dependent on this specific document, not the client in general
|
53
|
+
def base_placeholders
|
54
|
+
{
|
55
|
+
/TEMPLATE-PLACEHOLDER-PROJECT-NUMBER/ => ->(document) { document.number },
|
56
|
+
/TEMPLATE-PLACEHOLDER-PROJECT-TITLE/ => ->(document) { document.title },
|
57
|
+
/TEMPLATE-PLACEHOLDER-DOCUMENT-VERSION/ => ->(_document) { "1.0" }
|
58
|
+
}
|
59
|
+
end
|
60
|
+
|
61
|
+
# Placeholders located in the index file, not the LaTeX file
|
62
|
+
def index_file_placeholders
|
63
|
+
{
|
64
|
+
/TEMPLATE-PLACEHOLDER-INDEX-TITLE/ => ->(document) { document.title }
|
65
|
+
}
|
66
|
+
end
|
67
|
+
|
68
|
+
private
|
69
|
+
|
70
|
+
def perform_index_file_substitutions
|
71
|
+
index_file_placeholders.each do |regex, document_method|
|
72
|
+
placeholder_value = document_method.call(self)
|
73
|
+
|
74
|
+
substitute(file: "#{folder}/index", pattern: regex, replacement: placeholder_value)
|
75
|
+
end
|
76
|
+
|
77
|
+
say "Index file substitutions complete", :green
|
78
|
+
end
|
79
|
+
|
80
|
+
def perform_base_substitutions
|
81
|
+
base_placeholders.each do |regex, document_method|
|
82
|
+
placeholder_value = document_method.call(self)
|
83
|
+
|
84
|
+
substitute(file: "#{folder}/#{file}", pattern: regex, replacement: placeholder_value)
|
85
|
+
end
|
86
|
+
|
87
|
+
say "Base file substitutions complete", :green
|
88
|
+
end
|
89
|
+
|
90
|
+
def perform_configuration_substitutions(configuration:)
|
91
|
+
config_placeholders.each do |regex, config_method|
|
92
|
+
placeholder_value = config_method.call(configuration)
|
93
|
+
|
94
|
+
substitute(file: "#{folder}/#{file}", pattern: regex, replacement: placeholder_value)
|
95
|
+
end
|
96
|
+
|
97
|
+
say "Configuration file substitutions complete", :green
|
98
|
+
end
|
99
|
+
|
100
|
+
def substitute(file:, pattern:, replacement:)
|
101
|
+
say "Substituting '#{pattern.inspect}' for '#{replacement}' in #{file.split("/").last}"
|
102
|
+
|
103
|
+
path = "#{TOP_LEVEL_DIRECTORY}/#{file}"
|
104
|
+
content = File.binread(path)
|
105
|
+
content.gsub!(pattern, replacement.to_s)
|
106
|
+
File.open(path, "wb") { |handle| handle.write(content) }
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
@@ -0,0 +1,30 @@
|
|
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
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Texy
|
4
|
+
module Documents
|
5
|
+
class ReleaseNotes < Document
|
6
|
+
def initialize
|
7
|
+
super
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.repository
|
11
|
+
"git@bitbucket.org:neadwerx/release-notes.git"
|
12
|
+
end
|
13
|
+
|
14
|
+
def type_humanized
|
15
|
+
"Release Notes version"
|
16
|
+
end
|
17
|
+
|
18
|
+
def type
|
19
|
+
"release_notes"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Texy
|
4
|
+
module Documents
|
5
|
+
class StatementOfWork < 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
|
+
"SoW"
|
16
|
+
end
|
17
|
+
|
18
|
+
def type
|
19
|
+
"sow"
|
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
|
data/lib/texy/version.rb
ADDED
data/texy.gemspec
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path("lib", __dir__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require "texy/version"
|
6
|
+
|
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"]
|
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"
|
16
|
+
|
17
|
+
raise "RubyGems 2.0 or newer is required to protect against public gem pushes." unless spec.respond_to?(:metadata)
|
18
|
+
|
19
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
20
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
21
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
22
|
+
|
23
|
+
# Specify which files should be added to the gem when it is released.
|
24
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
25
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
26
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
27
|
+
end
|
28
|
+
|
29
|
+
spec.bindir = "exe"
|
30
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
31
|
+
spec.require_paths = ["lib"]
|
32
|
+
|
33
|
+
spec.add_dependency "activesupport", "~> 6.0"
|
34
|
+
spec.add_dependency "thor", "~> 0.20.3"
|
35
|
+
spec.add_dependency "zeitwerk", "~> 2.1"
|
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"
|
41
|
+
spec.add_development_dependency "standard", "~> 0.2.5"
|
42
|
+
end
|
metadata
ADDED
@@ -0,0 +1,178 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: texy
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.8.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Stephen Dolan
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-04-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '6.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '6.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: thor
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.20.3
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.20.3
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: zeitwerk
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.1'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.1'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.12'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.12'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '10.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '10.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rspec
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '3.0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '3.0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: standard
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 0.2.5
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 0.2.5
|
125
|
+
description: Command line tool for SoW writing
|
126
|
+
email:
|
127
|
+
- stephen@neadwerx.com
|
128
|
+
executables:
|
129
|
+
- texy
|
130
|
+
extensions: []
|
131
|
+
extra_rdoc_files: []
|
132
|
+
files:
|
133
|
+
- ".gitignore"
|
134
|
+
- ".rspec"
|
135
|
+
- ".ruby-version"
|
136
|
+
- CHANGELOG.md
|
137
|
+
- Gemfile
|
138
|
+
- Gemfile.lock
|
139
|
+
- README.md
|
140
|
+
- Rakefile
|
141
|
+
- bin/console
|
142
|
+
- bin/setup
|
143
|
+
- exe/texy
|
144
|
+
- lib/texy.rb
|
145
|
+
- lib/texy/configuration.rb
|
146
|
+
- lib/texy/configuration/client.rb
|
147
|
+
- lib/texy/configuration/company.rb
|
148
|
+
- lib/texy/configuration/person.rb
|
149
|
+
- lib/texy/document.rb
|
150
|
+
- lib/texy/documents/change_order.rb
|
151
|
+
- lib/texy/documents/release_notes.rb
|
152
|
+
- lib/texy/documents/statement_of_work.rb
|
153
|
+
- lib/texy/version.rb
|
154
|
+
- texy.gemspec
|
155
|
+
homepage: https://neadwerx.com
|
156
|
+
licenses: []
|
157
|
+
metadata:
|
158
|
+
homepage_uri: https://neadwerx.com
|
159
|
+
post_install_message:
|
160
|
+
rdoc_options: []
|
161
|
+
require_paths:
|
162
|
+
- lib
|
163
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
164
|
+
requirements:
|
165
|
+
- - ">="
|
166
|
+
- !ruby/object:Gem::Version
|
167
|
+
version: '0'
|
168
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
169
|
+
requirements:
|
170
|
+
- - ">="
|
171
|
+
- !ruby/object:Gem::Version
|
172
|
+
version: '0'
|
173
|
+
requirements: []
|
174
|
+
rubygems_version: 3.1.2
|
175
|
+
signing_key:
|
176
|
+
specification_version: 4
|
177
|
+
summary: Command line tool for SoW writing
|
178
|
+
test_files: []
|