twitter2vk 0.2.1 → 0.2.2

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.
data/ChangeLog CHANGED
@@ -1,3 +1,6 @@
1
+ == 0.2.2 (Багет)
2
+ * Installer can update previous config.
3
+
1
4
  == 0.2.1 (Оливье)
2
5
  * Fix UTF-8 support.
3
6
 
data/bin/i18n/en.yml CHANGED
@@ -5,6 +5,7 @@ vk:
5
5
  error: 'Error: VK e-mail or password is incorrect.'
6
6
  twitter: 'Twitter name: '
7
7
  config: 'Config path: '
8
+ update_error: Overwrite config, because previous version can be loaded.
8
9
  last_message: 'File with last message ID: '
9
10
  period: 'Check period in minutes: '
10
11
  cron: Install cron task?
data/bin/i18n/ru.yml CHANGED
@@ -5,6 +5,7 @@ vk:
5
5
  error: 'Ошибка: e-mail и пароль для В Контакте неправильны.'
6
6
  twitter: 'Имя в Twitter’е: '
7
7
  config: 'Путь к настройкам: '
8
+ update_error: Старые настройки будут перезаписаны, поскольку их не удалось загрузить.
8
9
  last_message: 'Файл с ID последнего сообщения: '
9
10
  period: 'Период проверки в минутах: '
10
11
  cron: Установить задачу в cron
data/bin/twitter2vk CHANGED
@@ -39,14 +39,18 @@ end
39
39
  config['vk_session'] = resource.body.match(/value='([a-z0-9]+)'/)[1]
40
40
  config['twitter'] = ask(i18n.twitter)
41
41
 
42
- config['exclude'] = ['#novk', :reply]
43
- config['include'] = ['#vk']
44
- config['format'] = '%status%'
45
- config['replace'] = []
46
-
47
42
  path = ask(i18n.config) { |q| q.default = "./#{config['twitter']}.yml" }
48
43
  path = File.expand_path(path)
49
44
 
45
+ if File.exists? path
46
+ (config = YAML.load_file(path).merge(config)) rescue puts i18n.update_error
47
+ end
48
+
49
+ config['exclude'] = ['#novk', :reply] unless config.has_key? 'exclude'
50
+ config['include'] = ['#vk'] unless config.has_key? 'include'
51
+ config['replace'] = [] unless config.has_key? 'replace'
52
+ config['format'] = '%status%' unless config.has_key? 'format'
53
+
50
54
  config['last_message'] = ask(i18n.last_message) do |q|
51
55
  q.default = "./#{config['twitter']}_last_message"
52
56
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twitter2vk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrey "A.I." Sitnik
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-13 00:00:00 +04:00
12
+ date: 2009-10-18 00:00:00 +04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - "="
22
22
  - !ruby/object:Gem::Version
23
- version: 0.2.1
23
+ version: 0.2.2
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: highline