dev 2.1.45 → 2.1.46

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/apps/nuget.rb +49 -1
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 28527603829b18c30309067bc42bb5de53320e65
4
- data.tar.gz: ec7b396aa9afafef6e84de188b459f6544569b41
3
+ metadata.gz: b84cf27ca75bc38c925d66314f4760c101c96cf0
4
+ data.tar.gz: 558795518f743d4350b91ddd9364f7b88a9fbcbe
5
5
  SHA512:
6
- metadata.gz: 6ca7302e4df84568abde45665c330acae7a15118a08faa7fd9decda11f24dec4f8f6570f8176639ab4c84f485bc11967222cd664db78e782be325cc44539f587
7
- data.tar.gz: acdedcf9dce8e763c48c24db1dcbea009480a5f932d1a1b4e0194e68d7b5eab557f13305a13e9fc67890594354b1d07ab9749d6d69a64a26eec6738093193924
6
+ metadata.gz: 5e3cdf3941ec4aaf703225b8e6b111715a49a54d8caccfabb0ba3390832818b04010bdd6ff392a5ad6ee9e4c4c3b42a3b0f21571196b4a2a8a153e926a335193
7
+ data.tar.gz: fa18ed53bd6d3c341222b5d315832ea8a5c3e3e65d93fbf84f6925516e1cf55e6cb279b2998ce658835af0e5e00b2ab841ad74a31fc4de03fbd88f2f4d0dee81
data/lib/apps/nuget.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  puts __FILE__ if defined?(DEBUG)
2
2
 
3
3
  class Nuget
4
- def self.get_build_commands nuspec_file
4
+ def self.get_build_commands nuspec_file
5
5
  build_commands=nil
6
6
  if(File.exists?(nuspec_file))
7
7
  build_commands=Array.new if build_commands.nil?
@@ -13,4 +13,52 @@ class Nuget
13
13
  end
14
14
  build_commands
15
15
  end
16
+
17
+ def self.get_versions filename
18
+ versions=Hash.new
19
+ if(filename.include?('.nuspec'))
20
+ nuspec_text=File.read(filename,:encoding=>'UTF-8')
21
+ nuspec_text.scan(/<dependency[\s]+id="([\w\.]+)"[\s]+version="([\d\.]+)"/).each{|row|
22
+ versions[row[0]] = row[1]
23
+ }
24
+ return versions
25
+ end
26
+ if(filename.include?('packages.config'))
27
+ config_text=File.read(filename,:encoding=>'UTF-8')
28
+ config_text.scan(/<package[\s]+id="([\w\.]+)"[\s]+version="([\d\.]+)"/).each{|row|
29
+ versions[row[0]] = row[1]
30
+ }
31
+ return versions
32
+ end
33
+ versions
34
+ end
35
+
36
+ def self.set_versions filename,versions
37
+ text=File.read(filename,:encoding=>'UTF-8')
38
+ text_versions=text.scan(/id="[\w\.]+"[\s]+version="[\d\.]+"/)
39
+ text2=text
40
+ versions.each{|k,v|
41
+ text_versions.each{|line|
42
+ if(line.include?("\"#{k}\""))
43
+ new_line = "id=\"#{k}\" version=\"#{v}\""
44
+ text2 = text2.gsub(line,new_line)
45
+ end
46
+ }
47
+ }
48
+ unless text==text2
49
+ File.open(filename,"w") { |f| f.puts text2 }
50
+ end
51
+ end
52
+
53
+ def self.update_versions(source_filename,destination_filename)
54
+ old_versions=NuGet.get_versions(destination_filename)
55
+ source_versions=NuGet.get_versions(source_filename)
56
+ new_versions=Hash.new
57
+ old_versions.each{|k,v|
58
+ if(source_versions.has_key?(k))
59
+ new_versions[k]=source_versions[k]
60
+ end
61
+ }
62
+ NuGet.set_versions(destination_filename,new_versions)
63
+ end
16
64
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dev
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.45
4
+ version: 2.1.46
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lou Parslow
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-09 00:00:00.000000000 Z
11
+ date: 2017-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake