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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 296451fb7d60ad509421f5bfdfa718e726a06f7377f063a4f27a5176fc3f8a8c
4
- data.tar.gz: 8291b661655aed0ccce7f24e085e26185e8f6a43d7bca101c4dfcc77a34911a7
3
+ metadata.gz: a54667ff7333cf94be1029c004996ebe09cd95b15f52be646865f4f125ef70e9
4
+ data.tar.gz: 6b90f19b743df4dc36c404a09476091478631c85399fedeb970d629710004b19
5
5
  SHA512:
6
- metadata.gz: a21a9851fb8b5961565423189306c44ee6189d18c101e5f0c690d97977c11418eb5bd09c04e3ca4b5b80a7a42a05264e1867bba1a4a28eb9c428cb2c5e138f98
7
- data.tar.gz: 94bcfc3960cc42798e5620f7bb391a10f6d945021e734ae1099bb2f88b333d71faf304aef964d16c324acd606ebe2533eff702be7f7164cffc18e46fab996a3b
6
+ metadata.gz: 144148c74b05c6c51391e9b56309506248f1d931349a34d7246cd295c375ce0525e2e71b1ea3f36215da0e1b29b21c3c32f9cad78e0e6d512137b92271352bd6
7
+ data.tar.gz: 9ed2ee35d692a339ba5b044f381f0cbbcd082d0e2b362b4bdfbdeb727e5c0403a1bd5255864b24d7354856665859a84907b7691c8ba06c7d4572c43b44345d71
@@ -1,3 +1,3 @@
1
1
  ---
2
2
  - ".sycersion/version"
3
- - 0.1.0
3
+ - 0.2.0
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sycersion (0.1.0)
4
+ sycersion (0.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -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: #{SYCERSION_DIR}"
46
- puts "Configuration file: #{SYCERSION_ENV}\n"
47
- puts "\nChange the configuration file only if you know what you are doing."
48
- puts 'Otherwise run `sycersion --init` again.'
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 version-files\n"
96
- puts "-------------------\n"
97
+ puts "\nFound files with versions\n"
98
+ puts "-------------------------\n"
97
99
  list_versions_and_version_files
98
- print "\nChoose version-file and version with number or hit return for [0]: "
100
+ print "\nChoose file and version with number or hit return for [0]: "
99
101
  selection = gets.chomp.to_i
100
- app_version_file = @version_files.keys[selection]
101
- @version = Sycersion::Semver.version(@version_files[app_version_file][0])
102
- @version_string = @version_files[@version_file[1]]
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
- the version you could do like so
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
- @version_file = SYCERSION_VER
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sycersion
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pierre Sugar