twitter2vk 0.3 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,3 +1,8 @@
1
+ == 0.3.1 (Рис)
2
+ * Installer use log file in cron task.
3
+ * Check required options in reposter.
4
+ * Fix issue on empty last message ID file.
5
+
1
6
  == 0.3 (Суп)
2
7
  * Repost retweets.
3
8
  * Add last format, which will be add to status after trimmed text.
data/README.markdown CHANGED
@@ -1,57 +1,8 @@
1
1
  # twitter2vk
2
2
 
3
- ## English
4
- Automatic script to repost statuses from Twitter to VK. It also contain in
5
- separated package CLI tool to create config and add cron task.
6
-
7
- Warning: config contain session ID for VK, which can be used to get full access.
8
- Make sure that outsiders don’t have access to this file.
9
-
10
- By default, reply and statuses with #novk willn’t be reposted to VK (but you may
11
- use #vk to repost any status).
12
-
13
- You may install on server only twitter2vk_reposter package and create config
14
- on home computer (don’t remember to add cron task). Or you can uninstall
15
- twitter2vk after you create config.
16
-
17
- You can follow author @andrey_sitnik to receive last updates info.
18
-
19
- ### Install
20
- 1. Install Ruby and Rubygems. For example, on Ubuntu:
21
-
22
- sudo apt-get install rubygems
23
-
24
- 2. Install twitter2vk gem:
25
-
26
- sudo gem install twitter2vk
27
-
28
- 3. Run master to create config and add crom task:
29
-
30
- twitter2vk
31
-
32
- ### Config
33
- Config is a YAML files with options:
34
-
35
- * `vk_session` – session ID to access to VK.
36
- * `twitter_token`, `twitter_secret` — data to access to Twitter by OAuth.
37
- * `exclude` – list of text or regexp patterns to exclude statuses from your VK.
38
- Code `:reply` will exclude your replies to another users, `:retweet` will
39
- exclude retweets by you.
40
- * `include` – list of text or regexp patterns to repost excluded statuses.
41
- * `format` – format reposted status. `%status%` will be replaced by status text,
42
- `%url%` by status link on Twitter.
43
- * `last` — text after `format`. If status will be longer that VK allow,
44
- `format` will be trim first. So `last` it useful, to set link to Twitter
45
- status.
46
- * `retweet` — format of retweet. `%status%` will be replaced by text,
47
- `%author%` will be replace by tweet author.
48
- * `replace` – list of array with 2 elements to replace text in status. Code
49
- `:user_to_url` will replace user name to his Twitter link.
50
- * `last_message` – file to contain ID of last reposted message.
51
-
52
3
  ## По-русски
53
4
 
54
- Автоматический скрипт для публикации статусов Twitter’а во В Контакте. Так же
5
+ Скрипт для автоматической публикации статусов Twitter’а во В Контакте. Так же
55
6
  в отдельном пакете есть консольная утилита для создания настроек и добавления
56
7
  задачи в cron.
57
8
 
@@ -68,6 +19,13 @@ Config is a YAML files with options:
68
19
  Вы можете последовать за автором @andrey_sitnik, чтобы получать информацию
69
20
  о последних обновлениях.
70
21
 
22
+ Подробная статья — http://habrahabr.ru/blogs/twitter/88386/ .
23
+
24
+ ### Возможности
25
+ - Не хранит пароли в настройках.
26
+ - Поддерживает ретвиты.
27
+ - Имеет гибкие настройки формата статуса и игнорирования статусов.
28
+
71
29
  ### Установка
72
30
  1. Установите Ruby и Rubygems. Например, для Ubuntu:
73
31
 
@@ -101,3 +59,57 @@ Config is a YAML files with options:
101
59
  * `replace` — список массивов из двух элементов для замены текста в статусе. Код
102
60
  `:user_to_url` заменит имена пользователей на ссылку на их Twitter.
103
61
  * `last_message` — файл, чтобы хранить ID последнего полученного сообщения.
62
+
63
+ ## English
64
+ Script to automatically repost statuses from Twitter to VK. It also contain in
65
+ separated package CLI tool to create config and add cron task.
66
+
67
+ Warning: config contain session ID for VK, which can be used to get full access.
68
+ Make sure that outsiders don’t have access to this file.
69
+
70
+ By default, reply and statuses with #novk willn’t be reposted to VK (but you may
71
+ use #vk to repost any status).
72
+
73
+ You may install on server only twitter2vk_reposter package and create config
74
+ on home computer (don’t remember to add cron task). Or you can uninstall
75
+ twitter2vk after you create config.
76
+
77
+ You can follow author @andrey_sitnik to receive last updates info.
78
+
79
+ ### Features
80
+ * Don’t store passwords in config.
81
+ * Retweet support.
82
+ * Flexible status format and ignore rules.
83
+
84
+ ### Install
85
+ 1. Install Ruby and Rubygems. For example, on Ubuntu:
86
+
87
+ sudo apt-get install rubygems
88
+
89
+ 2. Install twitter2vk gem:
90
+
91
+ sudo gem install twitter2vk
92
+
93
+ 3. Run master to create config and add crom task:
94
+
95
+ twitter2vk
96
+
97
+ ### Config
98
+ Config is a YAML files with options:
99
+
100
+ * `vk_session` – session ID to access to VK.
101
+ * `twitter_token`, `twitter_secret` — data to access to Twitter by OAuth.
102
+ * `exclude` – list of text or regexp patterns to exclude statuses from your VK.
103
+ Code `:reply` will exclude your replies to another users, `:retweet` will
104
+ exclude retweets by you.
105
+ * `include` – list of text or regexp patterns to repost excluded statuses.
106
+ * `format` – format reposted status. `%status%` will be replaced by status text,
107
+ `%url%` by status link on Twitter.
108
+ * `last` — text after `format`. If status will be longer that VK allow,
109
+ `format` will be trim first. So `last` it useful, to set link to Twitter
110
+ status.
111
+ * `retweet` — format of retweet. `%status%` will be replaced by text,
112
+ `%author%` will be replace by tweet author.
113
+ * `replace` – list of array with 2 elements to replace text in status. Code
114
+ `:user_to_url` will replace user name to his Twitter link.
115
+ * `last_message` – file to contain ID of last reposted message.
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: "Open in browser %1\nAnd enter the number they give you: "
7
7
  config: 'Config path: '
8
+ log: 'Log path: '
8
9
  update_error: Overwrite config, because previous version can be loaded.
9
10
  last_message: 'File with last message ID: '
10
11
  period: 'Check period in minutes: '
@@ -12,5 +13,6 @@ cron: Install cron task?
12
13
  success:
13
14
  cron: Config and cron task are created.
14
15
  print:
15
- Config are created. To check your twitter automatically print `crontab -e`
16
- and add `%1`
16
+ "Config are created.
17
+ \nTo check your twitter automatically print `crontab -e` and add:
18
+ \n%1"
data/bin/i18n/ru.yml CHANGED
@@ -6,6 +6,7 @@ vk:
6
6
 
7
7
  twitter: "Откройте в браузере %1\nИ введите число, которое вам дали: "
8
8
  config: 'Путь к настройкам: '
9
+ log: 'Путь к журналу ошибок: '
9
10
  update_error: Старые настройки будут перезаписаны, поскольку их не удалось загрузить.
10
11
  last_message: 'Файл с ID последнего сообщения: '
11
12
  period: 'Период проверки в минутах: '
@@ -13,5 +14,6 @@ cron: Установить задачу в cron
13
14
  success:
14
15
  cron: Настройки и задача для cron созданы.
15
16
  print:
16
- Настройки созданы. Для автоматический проверки введите `crontab -e` и
17
- добавьте туда `%1`
17
+ "Настройки созданы.
18
+ \nДля автоматический проверки введите `crontab -e` и добавьте туда:
19
+ \n%1"
data/bin/twitter2vk CHANGED
@@ -54,11 +54,13 @@ config['twitter_secret'] = access.secret
54
54
  twitter = TwitterOAuth::Client.new(:consumer_key => KEY,
55
55
  :consumer_secret => SECRET, :token => access.token, :secret => access.secret)
56
56
 
57
- path = ask(i18n.config) { |q|
58
- q.default = "./#{twitter.info['screen_name']}.yml"
59
- }
57
+ screen_name = twitter.info['screen_name']
58
+ path = ask(i18n.config) { |q| q.default = "./#{screen_name}.yml" }
60
59
  path = File.expand_path(path)
61
60
 
61
+ log = ask(i18n.log) { |q| q.default = "./#{screen_name}.log" }
62
+ log = File.expand_path(log)
63
+
62
64
  if File.exists? path
63
65
  (config = YAML.load_file(path).merge(config)) rescue puts i18n.update_error
64
66
  end
@@ -74,7 +76,7 @@ default = {
74
76
  config = default.merge(config)
75
77
 
76
78
  config['last_message'] = ask(i18n.last_message) do |q|
77
- q.default = "./#{config['twitter']}_last_message"
79
+ q.default = "./#{screen_name}_last_message"
78
80
  end
79
81
  config['last_message'] = File.expand_path(config['last_message'])
80
82
 
@@ -91,7 +93,7 @@ else
91
93
  'twitter2vk_reposter'
92
94
  end
93
95
 
94
- task = "*/#{period} * * * * #{reposter} #{path}"
96
+ task = "*/#{period} * * * * #{reposter} #{path} 2>> #{log}"
95
97
 
96
98
  if agree(i18n.cron) { |q| q.default = 'yes' }
97
99
  tasks = `crontab -l`
@@ -106,4 +108,3 @@ if agree(i18n.cron) { |q| q.default = 'yes' }
106
108
  else
107
109
  say i18n.success.print(task)
108
110
  end
109
-
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.3"
4
+ version: 0.3.1
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: 2010-03-22 00:00:00 +03:00
12
+ date: 2010-03-26 00:00:00 +03: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.3"
23
+ version: 0.3.1
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: activesupport