aoc_generator 0.1.7 → 0.1.9
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 +4 -4
- data/CHANGELOG.md +8 -0
- data/Gemfile.lock +1 -1
- data/README.md +27 -4
- data/lib/advent_of_code_generator/generator.rb +15 -10
- data/lib/advent_of_code_generator.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 209a280e6279d13cc27d005359020122010c13663798c8cde7b6ae381ce682e2
|
4
|
+
data.tar.gz: 20bdcc796e05cc57fbc083636b37fd28b79e5424c6d8afac0471f36936fdb952
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfe0ed279f24ea63b3cc9d03328a1036c391ad6c20db56649b8b1fc4e384a11c7052d3d91c197f33a3eddebc850a0d85fdaf149acdd6c8d8bd44b2a0132d161b
|
7
|
+
data.tar.gz: 0b37f8320f04605a1e6ef7c5bc1d2bc0c541a1c7c33c45d1eac19965bb99a299bc0f4baa1e6a4bb047375945fc43676c013f7c65eb140dcb3c742c496f982249
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -75,11 +75,11 @@ The generator creates the following files with basic templates:
|
|
75
75
|
```ruby
|
76
76
|
class DayXX
|
77
77
|
def part_one(input)
|
78
|
-
# Your solution for
|
78
|
+
# Your solution for Part One
|
79
79
|
end
|
80
80
|
|
81
81
|
def part_two(input)
|
82
|
-
# Your solution for
|
82
|
+
# Your solution for Part Two
|
83
83
|
end
|
84
84
|
end
|
85
85
|
```
|
@@ -87,8 +87,31 @@ end
|
|
87
87
|
### `day_XX_spec.rb`
|
88
88
|
|
89
89
|
```ruby
|
90
|
-
RSpec.describe DayXX do
|
91
|
-
|
90
|
+
RSpec.describe Cheddachedda::YearXXXX::DayXX do
|
91
|
+
it "solves Part One" do
|
92
|
+
input = <<~INPUT
|
93
|
+
1abc2
|
94
|
+
pqr3stu8vwx
|
95
|
+
a1b2c3d4e5f
|
96
|
+
treb7uchet
|
97
|
+
INPUT
|
98
|
+
|
99
|
+
expect(described_class.part_one(input)).to eq(142)
|
100
|
+
end
|
101
|
+
|
102
|
+
# it "solves Part Two" do
|
103
|
+
# input = <<~INPUT
|
104
|
+
# two1nine
|
105
|
+
# eightwothree
|
106
|
+
# abcone2threexyz
|
107
|
+
# xtwone3four
|
108
|
+
# 4nineeightseven2
|
109
|
+
# zoneight234
|
110
|
+
# 7pqrstsixteen
|
111
|
+
# INPUT
|
112
|
+
|
113
|
+
# expect(described_class.part_two(input)).to eq(281)
|
114
|
+
# end
|
92
115
|
end
|
93
116
|
```
|
94
117
|
|
@@ -43,10 +43,15 @@ module AdventOfCodeGenerator
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def generate_file(file_data)
|
46
|
-
return if file_data.require_session && @session.nil?
|
47
|
-
return if File.exist?(file_data.path) && !file_data.allow_overwrite
|
46
|
+
return skip_file(file_data.path) if file_data.require_session && @session.nil?
|
47
|
+
return skip_file(file_data.path) if File.exist?(file_data.path) && !file_data.allow_overwrite
|
48
48
|
|
49
49
|
File.write(file_data.path, file_data.content)
|
50
|
+
puts " \e[32mcreate\e[0m #{file_data.path}"
|
51
|
+
end
|
52
|
+
|
53
|
+
def skip_file(path)
|
54
|
+
puts " \e[33mskip\e[0m #{path}"
|
50
55
|
end
|
51
56
|
|
52
57
|
def puzzle_description
|
@@ -72,11 +77,11 @@ module AdventOfCodeGenerator
|
|
72
77
|
module Year#{@year}
|
73
78
|
class Day#{@day}
|
74
79
|
def self.part_one(input)
|
75
|
-
|
80
|
+
# Your solution for Part One
|
76
81
|
end
|
77
82
|
|
78
83
|
def self.part_two(input)
|
79
|
-
|
84
|
+
# Your solution for Part Two
|
80
85
|
end
|
81
86
|
end
|
82
87
|
end
|
@@ -104,13 +109,13 @@ module AdventOfCodeGenerator
|
|
104
109
|
expect(described_class.part_one(input)).to eq(#{expectations[0]})
|
105
110
|
end
|
106
111
|
|
107
|
-
it "solves Part Two"
|
108
|
-
|
109
|
-
|
110
|
-
|
112
|
+
# it "solves Part Two" do
|
113
|
+
# input = <<~INPUT
|
114
|
+
# #{input[1]&.gsub("\n", "\n # ")}
|
115
|
+
# INPUT
|
111
116
|
|
112
|
-
|
113
|
-
end
|
117
|
+
# expect(described_class.part_two(input)).to eq(#{expectations[1]})
|
118
|
+
# end
|
114
119
|
end
|
115
120
|
RUBY
|
116
121
|
|