Skip to content

Commit 359f7ae

Browse files
Merge pull request #122 from bitflyer-tools/misc/fixReleaseAction
👍 Split version.rb
2 parents e0d443f + e1aeafe commit 359f7ae

6 files changed

Lines changed: 110 additions & 42 deletions

File tree

.gitignore

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Created by https://www.gitignore.io/api/ruby
2+
# Edit at https://www.gitignore.io/?templates=ruby
3+
4+
### Ruby ###
5+
*.gem
6+
*.rbc
7+
/.config
8+
/coverage/
9+
/InstalledFiles
10+
/pkg/
11+
/spec/reports/
12+
/spec/examples.txt
13+
/test/tmp/
14+
/test/version_tmp/
15+
/tmp/
16+
17+
# Used by dotenv library to load environment variables.
18+
# .env
19+
20+
## Specific to RubyMotion:
21+
.dat*
22+
.repl_history
23+
build/
24+
*.bridgesupport
25+
build-iPhoneOS/
26+
build-iPhoneSimulator/
27+
28+
## Specific to RubyMotion (use of CocoaPods):
29+
#
30+
# We recommend against adding the Pods directory to your .gitignore. However
31+
# you should judge for yourself, the pros and cons are mentioned at:
32+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
33+
#
34+
# vendor/Pods/
35+
36+
## Documentation cache and generated files:
37+
/.yardoc/
38+
/_yardoc/
39+
/doc/
40+
/rdoc/
41+
42+
## Environment normalization:
43+
/.bundle/
44+
/vendor/bundle
45+
/lib/bundler/man/
46+
vendor/bundle
47+
48+
# for a library or gem, you might want to ignore these files since the code is
49+
# intended to run in multiple environments; otherwise, check them in:
50+
# Gemfile.lock
51+
# .ruby-version
52+
# .ruby-gemset
53+
54+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
55+
.rvmrc
56+
57+
# End of https://www.gitignore.io/api/ruby

bitflyer-cli.gemspec

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# coding: utf-8
22
lib = File.expand_path('../lib', __FILE__)
33
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4+
require 'bitflyer/cli/version'
45

56
Gem::Specification.new do |spec|
67
spec.name = 'bitflyer-cli'
7-
spec.version = '0.5.0'
8+
spec.version = Bitflyer::Cli::VERSION
89
spec.required_ruby_version = '>= 3.1'
910
spec.authors = ['Yuji Ueki']
1011
spec.email = ['unhappychoice@gmail.com']

exe/bitflyer

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
require 'bitflyer/cli'
44

5-
Bitflyer::CLI.start
5+
Bitflyer::Cli::Runner.start

lib/bitflyer/cli.rb

Lines changed: 42 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -6,53 +6,56 @@
66
require 'bitflyer/cli/command/order_by_twap_command'
77
require 'bitflyer/cli/command/stop_by_range_command'
88
require 'bitflyer/cli/command/summary_command'
9+
require 'bitflyer/cli/version'
910

1011
module Bitflyer
11-
class CLI < Thor
12-
desc 'cancel_all', 'cancel all of orders'
13-
def cancel_all
14-
CancelAllCommand.new.run
15-
end
12+
module Cli
13+
class Runner < Thor
14+
desc 'cancel_all', 'cancel all of orders'
15+
def cancel_all
16+
CancelAllCommand.new.run
17+
end
1618

17-
desc 'counter_trade', 'clear all positions'
18-
def counter_trade
19-
CounterTradeCommand.new.run
20-
end
19+
desc 'counter_trade', 'clear all positions'
20+
def counter_trade
21+
CounterTradeCommand.new.run
22+
end
2123

22-
desc 'order_by_best', 'create limit order by best price in the board'
23-
method_option :amount, aliases: 'a', type: :numeric, banner: 'amount', required: true
24-
method_option :type, aliases: 't', type: :string, banner: 'buy/sell', required: true
25-
def order_by_best
26-
OrderByBestCommand.new.run(options)
27-
end
24+
desc 'order_by_best', 'create limit order by best price in the board'
25+
method_option :amount, aliases: 'a', type: :numeric, banner: 'amount', required: true
26+
method_option :type, aliases: 't', type: :string, banner: 'buy/sell', required: true
27+
def order_by_best
28+
OrderByBestCommand.new.run(options)
29+
end
2830

29-
desc 'order_by_twap', 'order by using TWAP algorithm'
30-
method_option :amount, aliases: 'a', type: :numeric, banner: 'amount', required: true
31-
method_option :type, aliases: 't', type: :string, banner: 'buy/sell', required: true
32-
method_option :number_of_times, aliases: 'n', type: :numeric, banner: 'N', required: true
33-
method_option :interval, aliases: 'i', type: :numeric, banner: 'second', required: true
34-
def order_by_twap
35-
OrderByTWAPCommand.new.run(options)
36-
end
31+
desc 'order_by_twap', 'order by using TWAP algorithm'
32+
method_option :amount, aliases: 'a', type: :numeric, banner: 'amount', required: true
33+
method_option :type, aliases: 't', type: :string, banner: 'buy/sell', required: true
34+
method_option :number_of_times, aliases: 'n', type: :numeric, banner: 'N', required: true
35+
method_option :interval, aliases: 'i', type: :numeric, banner: 'second', required: true
36+
def order_by_twap
37+
OrderByTWAPCommand.new.run(options)
38+
end
3739

38-
desc 'stop_by_range', 'create stop order by range based on current position'
39-
method_option :range, aliases: 'r', type: :numeric, banner: 'price range', required: true
40-
def stop_by_range
41-
StopByRangeCommand.new.run(options)
42-
end
40+
desc 'stop_by_range', 'create stop order by range based on current position'
41+
method_option :range, aliases: 'r', type: :numeric, banner: 'price range', required: true
42+
def stop_by_range
43+
StopByRangeCommand.new.run(options)
44+
end
4345

44-
desc 'ifdoco_by_range', 'create IFDOCO order by range based on current price'
45-
method_option :amount, aliases: 'a', type: :numeric, banner: 'amount', required: true
46-
method_option :type, aliases: 't', type: :string, banner: 'buy/sell', required: true
47-
method_option :range, aliases: 'r', type: :numeric, banner: 'price range', required: true
48-
method_option :percentage, aliases: 'p', type: :numeric, banner: 'price ratio percentage', required: true
49-
def ifdoco_by_range
50-
IFDOCOByRangeCommand.new.run(options)
51-
end
46+
desc 'ifdoco_by_range', 'create IFDOCO order by range based on current price'
47+
method_option :amount, aliases: 'a', type: :numeric, banner: 'amount', required: true
48+
method_option :type, aliases: 't', type: :string, banner: 'buy/sell', required: true
49+
method_option :range, aliases: 'r', type: :numeric, banner: 'price range', required: true
50+
method_option :percentage, aliases: 'p', type: :numeric, banner: 'price ratio percentage', required: true
51+
def ifdoco_by_range
52+
IFDOCOByRangeCommand.new.run(options)
53+
end
5254

53-
desc 'summary', 'show current balance information'
54-
def summary
55-
SummaryCommand.new.run
55+
desc 'summary', 'show current balance information'
56+
def summary
57+
SummaryCommand.new.run
58+
end
5659
end
5760
end
5861
end

lib/bitflyer/cli/version.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# frozen_string_literal: true
2+
3+
module Bitflyer
4+
module Cli
5+
VERSION = '0.5.0'
6+
end
7+
end

spec/bitflyer/cli_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
require 'spec_helper'
22

3-
describe Bitflyer::CLI do
3+
describe Bitflyer::Cli do
44
end

0 commit comments

Comments
 (0)