move-to-go 5.0.7 → 5.0.8

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
  SHA1:
3
- metadata.gz: 2d2b73e2b0e9c9080ec03808579ceabc8061071b
4
- data.tar.gz: cc02c544cae43e1537df432fab74bbf345037626
3
+ metadata.gz: c0d3687ccb133122091d0b3fa42fd14ef58ab8f9
4
+ data.tar.gz: a621d4f97575b296c8274e2d90770a4c50b1b86d
5
5
  SHA512:
6
- metadata.gz: b2fa9757d14809a3e62c748f2a987b911a0e0b00be5b218d67bc6fb3ea72e82b50d42d4282079541ac6dcda82a31ddcd171ee17384acfd1064efed7817e49cf8
7
- data.tar.gz: 3823343232c3d45f3b1c662ac99bf838042bf07a7427418d81642d4ddf63891c26945c65691c9611321e8cc8224b0859c42e35b68a549dfb57032398ed7d9ced
6
+ metadata.gz: 2628c3bf7350a2e882ea88d1e4c368093e2b9ac57b6751bb222c898dcd0d89083aa75578125f984e3299c7df781ef5f80d5de4323f89dd5bf7fb14b831346e75
7
+ data.tar.gz: bcfb26f06fab4f25758a546b35ad9d0668a74b27f4a4639a9280c44b23bc6cc2d7544f09552a7ac0ee67fba221a42008244e3cf8b14c9fc35f769457f7dd8c4d
data/bin/move-to-go CHANGED
@@ -3,6 +3,8 @@
3
3
  require "thor"
4
4
  require_relative '../lib/move-to-go'
5
5
  require 'progress'
6
+ require 'net/http'
7
+ require 'json'
6
8
 
7
9
 
8
10
  RUNNER_DIR = ".move-to-go"
@@ -11,13 +13,16 @@ class MoveToGoCommandLine < Thor
11
13
 
12
14
  desc "about", "About move-to-go"
13
15
  def about()
14
- puts "move-to-go is an migration tool for LIME Go. It can take virtually any input source and create import data files that LIME Go likes."
16
+ display_current_version()
17
+ puts "move-to-go is an migration tool for Lime Go. It can take virtually any input source and create import data files that Lime Go likes."
15
18
  puts "move-to-go has some predefined sources that will make it easy for you to migrate your data."
16
- puts ""
19
+ puts
17
20
  end
18
21
 
19
22
  desc "list-sources", "Lists the available sources"
20
23
  def list_sources()
24
+ display_current_version()
25
+
21
26
  puts "The following sources are available:"
22
27
  puts
23
28
 
@@ -26,31 +31,45 @@ class MoveToGoCommandLine < Thor
26
31
  puts "\t#{s}"
27
32
  end
28
33
 
29
- puts "\nCreate a new project with 'move-to-go new <PROJECT> <SOURCE>' with one of these sources."
34
+ puts
35
+ puts "Create a new project with 'move-to-go new <PROJECT> <SOURCE>' with one of these sources."
30
36
  puts "Use 'move-to-go about <SOURCE>' for more information about a specific source."
31
37
  end
32
38
 
33
39
  desc "about <SOURCE>", "Prints information about the specifed source"
34
40
  def about(source)
41
+ display_current_version()
42
+
35
43
  sources = MoveToGo::Sources.new(source_path)
36
44
 
37
45
  sources.about_source(source)
38
46
  end
39
47
 
40
48
  desc "new <PROJECT> <SOURCE>", "Creates a new migration project with a specifed name and source"
49
+ option(:force_current_version,
50
+ :desc => "Set this if you have an outdated version of move-to-go and still want to create a new migration. Old versions of move-to-go will not work with the current version of Lime Go.",
51
+ :type => :boolean,
52
+ :required => false)
41
53
  def new(project, source)
54
+ if options.force_current_version.nil?
55
+ check_current_version()
56
+ end
57
+
58
+ display_current_version()
59
+
42
60
  sources = MoveToGo::Sources.new(source_path)
43
61
 
44
62
  if sources.create_project_from_source(project, source)
45
- puts "\nProject '#{project}' created from source '#{source}'."
63
+ puts
64
+ puts "Project '#{project}' created from source '#{source}'."
46
65
  puts "Modify the #{project}/converter.rb script to suit your source."
47
- puts "Use 'move-to-go run' from the project directory to create the zip file for LIME Go."
66
+ puts "Use 'move-to-go run' from the project directory to create the zip file for Lime Go."
48
67
  end
49
68
  end
50
69
 
51
70
  desc "run", "Executes the current project and create a go.zip file with data and files. Existing go.zip will be overwritten, use --output to specify a different filename."
52
71
  option(:output,
53
- :desc => "Name of the file where the converted source will be saved. This file should be sent to LIME Go. If the file already exist it will be replaced.",
72
+ :desc => "Name of the file where the converted source will be saved. This file should be sent to Lime Go. If the file already exist it will be replaced.",
54
73
  :type => :string,
55
74
  :required => false)
56
75
  option(:ignore_invalid_files,
@@ -73,7 +92,17 @@ class MoveToGoCommandLine < Thor
73
92
  :desc => "Large imports are sharded into several zip-files. This property sets how many objects each zip-file should contain. Default is 25 000",
74
93
  :type => :numeric,
75
94
  :required => false)
95
+ option(:force_current_version,
96
+ :desc => "Set this if you have an outdated version of move-to-go and still want to run the migration. Old versions of move-to-go will not work with the current version of Lime Go.",
97
+ :type => :boolean,
98
+ :required => false)
76
99
  def run_import()
100
+ if options.force_current_version.nil?
101
+ check_current_version()
102
+ end
103
+
104
+ display_current_version()
105
+
77
106
  if !options.log_to_file.nil?
78
107
  $stdout = File.new(options.log_to_file == "log_to_file" ? "move-to-go.log" : options.log_to_file, 'w')
79
108
  $stdout.sync = true
@@ -209,6 +238,35 @@ class MoveToGoCommandLine < Thor
209
238
  def source_path()
210
239
  File.expand_path("../sources", File.dirname(__FILE__))
211
240
  end
241
+
242
+ private
243
+ def check_current_version()
244
+ uri = URI('https://rubygems.org/api/v1/versions/move-to-go/latest.json')
245
+
246
+ Net::HTTP.start(uri.host, uri.port,
247
+ :verify_mode => OpenSSL::SSL::VERIFY_NONE,
248
+ :use_ssl => true) do |http|
249
+
250
+ request = Net::HTTP::Get.new uri
251
+ response = http.request request
252
+
253
+ latest_version = Gem::Version.new(JSON.parse(response.body)['version'])
254
+ current_version = Gem.loaded_specs["move-to-go"].version
255
+ outdated = latest_version > current_version
256
+
257
+ if outdated
258
+ puts "You are running an old version of move-to-go (#{current_version})"
259
+ puts "Please upgrade by running 'gem install move-to-go'"
260
+ exit
261
+ end
262
+ end
263
+ end
264
+
265
+ private
266
+ def display_current_version()
267
+ puts "Version: #{Gem.loaded_specs["move-to-go"].version}"
268
+ puts
269
+ end
212
270
  end
213
271
 
214
272
  MoveToGoCommandLine.start(ARGV)
@@ -41,7 +41,7 @@ class Converter
41
41
 
42
42
  #Creates a custom field to add invoicing data
43
43
  rootmodel.settings.with_organization do |org|
44
- org.set_custom_field( { :integrationid => 'ackoms', :title => 'Fakturerat', :type => :String } )
44
+ org.set_custom_field( { :integration_id => 'ackoms', :title => 'Fakturerat', :type => :String } )
45
45
  end
46
46
  end
47
47
 
@@ -46,7 +46,7 @@ class Converter
46
46
  # :String and :Link. If no type is specified :String is used
47
47
  # as default.
48
48
  rootmodel.settings.with_organization do |organization|
49
- organization.set_custom_field( { :integrationid => 'external_url', :title => 'Link to external system', :type => :Link } )
49
+ organization.set_custom_field( { :integration_id => 'external_url', :title => 'Link to external system', :type => :Link } )
50
50
  end
51
51
 
52
52
  rootmodel.settings.with_deal do |deal|
@@ -47,7 +47,7 @@ class Converter
47
47
 
48
48
 
49
49
  # rootmodel.settings.with_organization do |organization|
50
- # organization.set_custom_field( { :integrationid => 'external_url', :title => 'Link to external system', :type => :Link } )
50
+ # organization.set_custom_field( { :integration_id => 'external_url', :title => 'Link to external system', :type => :Link } )
51
51
  # end
52
52
  end
53
53
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: move-to-go
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.7
4
+ version: 5.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Petter Sandholdt
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2017-01-17 00:00:00.000000000 Z
16
+ date: 2017-02-23 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: iso_country_codes