radikocopy 0.2.0 → 0.3.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: 7403095016e0db5737b4c43b33d3ea8d54743101
4
- data.tar.gz: bf8beaa481ba9b01bdae5de5901a07c1545fe3ec
3
+ metadata.gz: 1533e1092a18c3b600f09c5ee71740744f3364fe
4
+ data.tar.gz: a88eeccc97050581629a8596589640fbe9369d9f
5
5
  SHA512:
6
- metadata.gz: 55da42d6939ed1986c4baf1509b7ed23d96ab3e8b7093134e6ed1c9c6c65552b7fc93aa71ba0d121782012c3b4ff1e32effbdaedf6a2982df771049d423017e4
7
- data.tar.gz: d761c1c8df7dec9187a1affc988609366321d1b0658333d24fd77748ec99924d9f5dd7f7192b862ad07433a982cdeec4c505dd714a41721a728990da43ed5614
6
+ metadata.gz: 19620e88d9adea91b6e7d4aa4287a75be2396b101414d8646a5710c8cff42e7be589524f96d8f8d43eccb493d819479f0ca9b6491f407a177a22cb5b11de5c28
7
+ data.tar.gz: 43a7c14b14518a14dc678d6f36a766b4e09d1be6f3ed24d166b7f792f09b72eccd6f408645f9b42a390cd694c0ec2810d4dc802620c345c430d4ff23ec5b2954
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.4.2
data/build.sh ADDED
@@ -0,0 +1,18 @@
1
+ #!/bin/sh
2
+ # rmagick for sierra
3
+ #export PKG_CONFIG_PATH=/usr/local/opt/imagemagick@6/lib/pkgconfig
4
+ #export PATH=/usr/local/Cellar/imagemagick@6/6.9.7-5/bin:$PATH
5
+
6
+ bundle_dir=./vendor/bundle
7
+ if [ -d "$bundle_dir" ] ; then
8
+ /bin/rm -rf "$bundle_dir"
9
+ bundle update
10
+ else
11
+ /bin/rm -rf "$bundle_dir"
12
+ bundle install --path "$bundle_dir"
13
+ fi
14
+
15
+
16
+
17
+
18
+
@@ -1,3 +1,3 @@
1
1
  module Radikocopy
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
data/lib/radikocopy.rb CHANGED
@@ -47,6 +47,7 @@ module Radikocopy
47
47
  opts = {}
48
48
  opt = OptionParser.new(argv)
49
49
  opt.banner = "Usage: #{opt.program_name} [-h|--help] [config.yml]"
50
+ opt.version = Radikocopy::VERSION
50
51
  opt.separator('')
51
52
  opt.separator "Options:"
52
53
  opt.on_head('-h', '--help', 'Show this message') do |v|
@@ -112,28 +113,52 @@ module Radikocopy
112
113
  basename = File.basename(filename)
113
114
  local_file = File.join(@config.local_dir, basename)
114
115
  if FileTest.file?(local_file)
115
- puts "exists local_file #{local_file}"
116
+ # TODO -v option
117
+ # puts "exists local_file #{local_file}"
116
118
  return false
117
119
  end
118
120
  copy_command = "scp #{@config.remote_host}:\"'#{filename}'\" \"#{@config.local_dir}\""
119
- runcmd(copy_command)
121
+ runcmd_and_exit(copy_command)
120
122
  true
121
123
  end
122
124
 
123
125
  def import_files(files)
124
126
  files.each do |file|
125
- cmd = "osascript #{@config.import_scpt} \"#{file}\""
126
- runcmd(cmd)
127
+ import_ok = false
128
+ 3.times do |i|
129
+ if import_file(file, i)
130
+ import_ok = true
131
+ break
132
+ end
133
+ sleep(1)
134
+ end
135
+ unless import_ok
136
+ puts "import failed"
137
+ File.unlink(file)
138
+ end
127
139
  end
128
140
  end
129
141
 
130
- def runcmd(cmd)
131
- puts cmd
132
- unless system(cmd)
142
+ def import_file(file, i)
143
+ cmd = "osascript #{@config.import_scpt} \"#{file}\""
144
+ unless runcmd(cmd)
145
+ puts "import error[#{i}] #{file}"
146
+ return false
147
+ end
148
+ true
149
+ end
150
+
151
+ def runcmd_and_exit(cmd)
152
+ unless runcmd(cmd)
133
153
  puts "system error"
134
- exit(1)
154
+ exit(1)
135
155
  end
136
156
  end
157
+
158
+ def runcmd(cmd)
159
+ puts cmd
160
+ system(cmd)
161
+ end
137
162
  end
138
163
 
139
164
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: radikocopy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - src
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-11-21 00:00:00.000000000 Z
11
+ date: 2017-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -61,6 +61,7 @@ extensions: []
61
61
  extra_rdoc_files: []
62
62
  files:
63
63
  - ".gitignore"
64
+ - ".ruby-version"
64
65
  - ".travis.yml"
65
66
  - CODE_OF_CONDUCT.md
66
67
  - Gemfile
@@ -69,6 +70,7 @@ files:
69
70
  - Rakefile
70
71
  - bin/console
71
72
  - bin/setup
73
+ - build.sh
72
74
  - config/radikocopyrc
73
75
  - exe/radikocopy
74
76
  - lib/radikocopy.rb
@@ -96,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
98
  version: '0'
97
99
  requirements: []
98
100
  rubyforge_project:
99
- rubygems_version: 2.5.1
101
+ rubygems_version: 2.6.13
100
102
  signing_key:
101
103
  specification_version: 4
102
104
  summary: Radiko copy tool