sycersion 0.1.0 → 0.2.0
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/.sycersion/environment.yml +1 -1
- data/Gemfile.lock +1 -1
- data/lib/sycersion/version_environment.rb +39 -19
- 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: a54667ff7333cf94be1029c004996ebe09cd95b15f52be646865f4f125ef70e9
|
4
|
+
data.tar.gz: 6b90f19b743df4dc36c404a09476091478631c85399fedeb970d629710004b19
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 144148c74b05c6c51391e9b56309506248f1d931349a34d7246cd295c375ce0525e2e71b1ea3f36215da0e1b29b21c3c32f9cad78e0e6d512137b92271352bd6
|
7
|
+
data.tar.gz: 9ed2ee35d692a339ba5b044f381f0cbbcd082d0e2b362b4bdfbdeb727e5c0403a1bd5255864b24d7354856665859a84907b7691c8ba06c7d4572c43b44345d71
|
data/.sycersion/environment.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -42,10 +42,12 @@ module Sycersion
|
|
42
42
|
def summary_of_environment
|
43
43
|
puts "\nWhere to find the configuration files"
|
44
44
|
puts "-------------------------------------\n"
|
45
|
-
puts "\nDirectory:
|
46
|
-
puts "Configuration file:
|
47
|
-
puts "
|
48
|
-
puts
|
45
|
+
puts "\nDirectory: #{SYCERSION_DIR}"
|
46
|
+
puts "Configuration file: #{SYCERSION_ENV}\n"
|
47
|
+
puts "Application version-file: #{@app_ver_file}" if @app_ver_file
|
48
|
+
puts "Application version assignment: #{@version_string}" if @version_string
|
49
|
+
puts "\nIf you change the configuration file and encounter odd behaviour,"
|
50
|
+
puts 're-run `sycersion --init`.'
|
49
51
|
end
|
50
52
|
|
51
53
|
def determine_version_and_version_file
|
@@ -92,14 +94,14 @@ module Sycersion
|
|
92
94
|
end
|
93
95
|
|
94
96
|
def select_version_and_version_file
|
95
|
-
puts "\nFound
|
96
|
-
puts "
|
97
|
+
puts "\nFound files with versions\n"
|
98
|
+
puts "-------------------------\n"
|
97
99
|
list_versions_and_version_files
|
98
|
-
print "\nChoose
|
100
|
+
print "\nChoose file and version with number or hit return for [0]: "
|
99
101
|
selection = gets.chomp.to_i
|
100
|
-
|
101
|
-
@version = Sycersion::Semver.version(@version_files[
|
102
|
-
@version_string = @version_files[@
|
102
|
+
@app_ver_file = @version_files.keys[selection]
|
103
|
+
@version = Sycersion::Semver.version(@version_files[@app_ver_file][0])
|
104
|
+
@version_string = @version_files[@app_ver_file][1].strip
|
103
105
|
end
|
104
106
|
|
105
107
|
def list_versions_and_version_files
|
@@ -130,15 +132,28 @@ module Sycersion
|
|
130
132
|
|
131
133
|
In your application you can now access the version with
|
132
134
|
|
133
|
-
> File.read(#{version_file})
|
135
|
+
> File.read('#{version_file}')
|
134
136
|
|
135
|
-
If you application framework has a defined place to assign
|
136
|
-
|
137
|
+
If you application framework has a defined place to assign the version you
|
138
|
+
could do like so
|
137
139
|
|
138
|
-
> version = File.read(#{version_file})
|
140
|
+
> version = if File.exist? ? File.read('#{version_file}') : 'No VERSION!'
|
141
|
+
#{describe_adoption_of_version_file}
|
139
142
|
CODE_SNIP
|
140
143
|
end
|
141
144
|
|
145
|
+
def describe_adoption_of_version_file
|
146
|
+
return unless @app_ver_file && @version_string
|
147
|
+
|
148
|
+
<<-PROPOSAL
|
149
|
+
|
150
|
+
In #{@app_ver_file} you can change the version assignment to read from
|
151
|
+
#{@version_file} and change it accordingly.
|
152
|
+
|
153
|
+
#{@version_string}
|
154
|
+
PROPOSAL
|
155
|
+
end
|
156
|
+
|
142
157
|
def save
|
143
158
|
create_environment
|
144
159
|
end
|
@@ -147,7 +162,7 @@ module Sycersion
|
|
147
162
|
FileUtils.mkdir(SYCERSION_DIR) unless Dir.exist?(SYCERSION_DIR)
|
148
163
|
File.open(@version_file, 'w') { |f| f.write(@version) }
|
149
164
|
File.open(SYCERSION_ENV, 'w') do |f|
|
150
|
-
YAML.dump([@version_file, @version], f)
|
165
|
+
YAML.dump([@version_file, @version, @app_ver_file, @version_string], f)
|
151
166
|
end
|
152
167
|
rescue IOError => e
|
153
168
|
puts e.message
|
@@ -158,12 +173,17 @@ module Sycersion
|
|
158
173
|
@version_file, @version = YAML.load_file(SYCERSION_ENV)
|
159
174
|
true
|
160
175
|
else
|
161
|
-
|
162
|
-
@version = '0.1.0'
|
163
|
-
@version_files = {}
|
164
|
-
@version_string = ''
|
176
|
+
load_environment_default
|
165
177
|
false
|
166
178
|
end
|
167
179
|
end
|
180
|
+
|
181
|
+
def load_environment_default
|
182
|
+
@version_file = SYCERSION_VER
|
183
|
+
@version = '0.1.0'
|
184
|
+
@version_files = {}
|
185
|
+
@app_ver_file = ''
|
186
|
+
@version_string = ''
|
187
|
+
end
|
168
188
|
end
|
169
189
|
end
|