flumtter 5.2.1 → 5.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 298d63b96c4f805f2e6281a5f4ee4329b268d9ee
4
- data.tar.gz: 7d6c7ccbd8e8a3a1a7d13bbadb0113ac77d7d17c
3
+ metadata.gz: 172a58ccba1cebebba54f06578778897391e2655
4
+ data.tar.gz: 1978786bb8795ffad698c95201283478de4059f8
5
5
  SHA512:
6
- metadata.gz: 7139546b64535641c6f38e1987b3d54a4f0e6048a0c7a127687b3a14095c64c8bf41ed47c15f7418ffec5d2beac2f3a601a569d74c5843d07adec3b33b2a25e9
7
- data.tar.gz: d1cc3b92c14556bc3c1a9fd8f550195541c4a57955bc3019ce001d2898fc9b6cedbf1f3482da368d3d25bdb55107936b254ee0d2ead57a7a36ad208e91bebaab
6
+ metadata.gz: 9aaa57eff2459a530a89cd8eaa66a73881cdf313a0242565c20d789f4a54ab4635450f0651949773c113c51b95321e605a427ddea3492d0a330c23151246dc39
7
+ data.tar.gz: abca932b6739cb8f7c3442f338dd02d49466b81ea891a7a790fa3aaf8de873a2c0e5c0c7827f95c3db36c3ac32e1f390c9be0838a6988918405ace16d83345f8
@@ -24,6 +24,10 @@ module Flumtter
24
24
  @@account_list
25
25
  end
26
26
 
27
+ def list_to_s
28
+ @@account_list.map.with_index{|a,i|"#{i}: #{a.screen_name}"}.join("\n")
29
+ end
30
+
27
31
  def select(options={})
28
32
  if options[:id]
29
33
  @@account_list[options[:id]]
@@ -37,7 +41,7 @@ module Flumtter
37
41
  Please input your account number.
38
42
  Input 'regist' if you want to regist new account.
39
43
 
40
- #{@@account_list.map.with_index{|a,i|"#{i}: #{a.screen_name}"}.join("\n")}
44
+ #{list_to_s}
41
45
  EOF
42
46
  dialog.command(/^regist$/, "account registration"){|m|regist}
43
47
  dialog.command(/^([#{@@account_list.size.times.to_a.join(",")}])$/, "account index"){|m|@@account_list[m[1].to_i]}
@@ -0,0 +1,33 @@
1
+ module Flumtter
2
+ class Cli
3
+ class Command
4
+ def initialize(blk, args)
5
+ @blk = blk
6
+ @args = args
7
+ end
8
+
9
+ def run(twitter)
10
+ @blk.call(twitter, @args)
11
+ end
12
+ end
13
+
14
+ @@events = []
15
+ class << self
16
+ def add(*args, &blk)
17
+ Initializer.add_opt do |opt, options|
18
+ opt.on(*args){|v|options[args.first] = v}
19
+ end
20
+ Initializer.run(args.first) do |v, options|
21
+ @@events << Command.new(blk, v)
22
+ end
23
+ end
24
+
25
+ def run(client)
26
+ unless @@events.empty?
27
+ @@events.map{|event|event.run(client)}
28
+ exit
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -24,6 +24,7 @@ module Flumtter
24
24
  @queue = Queue.new
25
25
  @mutex = Mutex.new
26
26
  set(account)
27
+ Cli.run(self)
27
28
  start
28
29
  Keyboard.input(self)
29
30
  rescue NoSetAccount
@@ -0,0 +1,24 @@
1
+ module Flumtter
2
+ plugin do
3
+ Cli.add("--tweet VALUES", "new tweet") do |twitter, args|
4
+ twitter.rest.update(args)
5
+ end
6
+ Cli.add("--tweet_with_image=V,V", Array, "new tweet with image") do |twitter, (tweet, file)|
7
+ begin
8
+ twitter.rest.update_with_media(tweet, open(file))
9
+ rescue Twitter::Error::Forbidden => e
10
+ if e.message == "Error creating status."
11
+ STDERR.puts "This file is not supported."
12
+ else
13
+ raise e
14
+ end
15
+ end
16
+ end
17
+ add_opt do |opt, options|
18
+ opt.on('-l', '--list', 'user list') do
19
+ puts AccountSelector.list_to_s
20
+ exit
21
+ end
22
+ end
23
+ end
24
+ end
@@ -1,3 +1,3 @@
1
1
  module Flumtter
2
- VERSION = "5.2.1"
2
+ VERSION = "5.4.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flumtter
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.2.1
4
+ version: 5.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - flum1025
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-03-03 00:00:00.000000000 Z
11
+ date: 2017-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -132,6 +132,7 @@ files:
132
132
  - lib/flumtter/app/.flumtter/plugins/.gitkeep
133
133
  - lib/flumtter/app/.flumtter/setting/setting.rb
134
134
  - lib/flumtter/app/core/account_selector.rb
135
+ - lib/flumtter/app/core/cli.rb
135
136
  - lib/flumtter/app/core/client.rb
136
137
  - lib/flumtter/app/core/command.rb
137
138
  - lib/flumtter/app/core/command/dm.rb
@@ -163,6 +164,7 @@ files:
163
164
  - lib/flumtter/app/core/windows/tweetbase.rb
164
165
  - lib/flumtter/app/core/windows/userbase.rb
165
166
  - lib/flumtter/app/main.rb
167
+ - lib/flumtter/app/plugins/cli.rb
166
168
  - lib/flumtter/app/plugins/commands.rb
167
169
  - lib/flumtter/app/plugins/commands/account_changer.rb
168
170
  - lib/flumtter/app/plugins/commands/change_profile.rb