tachikoma 2.1.2 → 2.1.3
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +15 -0
- data/bin/tachikoma +47 -0
- data/lib/tachikoma/settings.rb +23 -2
- data/lib/tachikoma/version.rb +1 -1
- data/lib/tasks/app.rake +9 -11
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a32e1d702b5baafdfecf917ea7cdfd0fc293118f
|
4
|
+
data.tar.gz: acf32ce8b0590fd9e699297431925bd643b42aac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1abdac5ca5fbc25b42225ded13513cb4e2aafdd1371991442b2cce67ebefa1ed80445202b400845547c97c9c4db680dc2f8ee557ea5a88277b86071074a44b16
|
7
|
+
data.tar.gz: 8d2ca9119ea4e617a7fc38d97f28b471b120b25472883b92a64d1ba9df6c06c2c1d3bcd8890a98bbdeeb205288bcf92b3837a08cc1af28663e44fde4024fa373
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -38,6 +38,21 @@ NOTE: other environment variables such as `BUILD_FOR` are also required
|
|
38
38
|
$ bundle exec rake tachikoma:fetch_data tachikoma:load tachikoma:fetch tachikoma:bundle tachikoma:pull_request
|
39
39
|
```
|
40
40
|
|
41
|
+
## Usage as gem (experimental)
|
42
|
+
|
43
|
+
Above description is _inside_ tachikoma, below is usage not _inside_ but _outside_ tachikoma, as gem.
|
44
|
+
|
45
|
+
https://github.com/sanemat/bot-motoko-tachikoma
|
46
|
+
|
47
|
+
```
|
48
|
+
$ mkdir -p my-tachikoma
|
49
|
+
$ cd my-tachikoma
|
50
|
+
$ bundle init
|
51
|
+
$ echo "gem 'tachikoma'" >> Gemfile
|
52
|
+
$ bundle
|
53
|
+
$ bundle exec tachikoma init
|
54
|
+
```
|
55
|
+
|
41
56
|
## Contributing
|
42
57
|
|
43
58
|
1. Fork it
|
data/bin/tachikoma
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
case ARGV[0]
|
3
|
+
when 'init'
|
4
|
+
require 'fileutils'
|
5
|
+
File.open('.gitignore', 'a') do |f|
|
6
|
+
f << <<-EOS
|
7
|
+
/repos/*
|
8
|
+
!/repos/.gitkeep
|
9
|
+
EOS
|
10
|
+
end
|
11
|
+
File.open('Rakefile', 'a') do |f|
|
12
|
+
f << <<-EOS
|
13
|
+
require 'bundler/setup'
|
14
|
+
require 'tachikoma'
|
15
|
+
require 'tachikoma/tasks'
|
16
|
+
EOS
|
17
|
+
end
|
18
|
+
FileUtils.mkdir_p('data')
|
19
|
+
File.open(File.join('data', '__example__.yaml'), 'w') do |f|
|
20
|
+
f << <<-EOS
|
21
|
+
url:
|
22
|
+
'https://github.com/sanemat/bot-motoko-tachikoma.git'
|
23
|
+
frequency:
|
24
|
+
"every 1.day, :at => '6:30 am'"
|
25
|
+
type:
|
26
|
+
'fork'
|
27
|
+
language:
|
28
|
+
'ruby'
|
29
|
+
version:
|
30
|
+
'2.0.0'
|
31
|
+
EOS
|
32
|
+
end
|
33
|
+
FileUtils.mkdir_p('repos')
|
34
|
+
FileUtils.touch(File.join('repos', '.gitkeep'))
|
35
|
+
puts 'tachikoma init completed!'
|
36
|
+
puts 'You might want to see README!'
|
37
|
+
else
|
38
|
+
puts <<-EOS
|
39
|
+
Command Lists
|
40
|
+
tachikoma init # Initialize files
|
41
|
+
|
42
|
+
rake tachikoma:bundle # bundle
|
43
|
+
rake tachikoma:fetch # fetch
|
44
|
+
rake tachikoma:fetch_data # fetch another `/data` directory from another location
|
45
|
+
rake tachikoma:pull_request # pull_request
|
46
|
+
EOS
|
47
|
+
end
|
data/lib/tachikoma/settings.rb
CHANGED
@@ -1,6 +1,27 @@
|
|
1
1
|
require 'pathname'
|
2
|
+
|
2
3
|
module Tachikoma
|
3
|
-
def self.
|
4
|
-
Pathname.new(File.dirname(File.dirname(File.dirname(__FILE__))))
|
4
|
+
def self.root_path
|
5
|
+
@root_path ||= Pathname.new(File.dirname(File.dirname(File.dirname(__FILE__))))
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.root_path=(root_path)
|
9
|
+
@root_path = Pathname.new File.expand_path(root_path)
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.data_path
|
13
|
+
@data_path ||= root_path.parent.join('data')
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.data_path=(data_path)
|
17
|
+
@data_path = Pathname.new File.expand_path(data_path)
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.repos_path
|
21
|
+
@repos_path ||= root_path.parent.join('repos')
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.repos_path=(repos_path)
|
25
|
+
@repos_path = Pathname.new File.expand_path(repos_path)
|
5
26
|
end
|
6
27
|
end
|
data/lib/tachikoma/version.rb
CHANGED
data/lib/tasks/app.rake
CHANGED
@@ -2,12 +2,10 @@ require 'httparty'
|
|
2
2
|
require 'multi_json'
|
3
3
|
require 'safe_yaml'
|
4
4
|
require 'uri'
|
5
|
+
require 'tachikoma'
|
5
6
|
|
6
7
|
namespace :tachikoma do
|
7
8
|
@default_timestamp_format = '%Y%m%d%H%M%S'
|
8
|
-
@root_path = File.expand_path(File.join(__FILE__, '..', '..', '..'))
|
9
|
-
@data_path = File.join(@root_path, 'data')
|
10
|
-
@repos_path = File.join(@root_path, 'repos')
|
11
9
|
|
12
10
|
# build_for = fenix-knight, github_token_key = TOKEN_FENIX_KNIGHT
|
13
11
|
def github_token_key(build_for)
|
@@ -50,9 +48,9 @@ namespace :tachikoma do
|
|
50
48
|
if ENV['LOCAL_DATA_PATH'] && ENV['LOCAL_DATA_REMOTE_URL']
|
51
49
|
raise "local data path is empty" if ENV['LOCAL_DATA_PATH'] == ''
|
52
50
|
raise "remote git repository of local data is empty" if ENV['LOCAL_DATA_REMOTE_URL'] == ''
|
53
|
-
|
54
|
-
rm_rf(
|
55
|
-
sh "git clone #{ENV['LOCAL_DATA_REMOTE_URL']} #{
|
51
|
+
Tachikoma.data_path = File.absolute_path(ENV['LOCAL_DATA_PATH'])
|
52
|
+
rm_rf(Tachikoma.data_path) if Dir.exists?(Tachikoma.data_path)
|
53
|
+
sh "git clone #{ENV['LOCAL_DATA_REMOTE_URL']} #{Tachikoma.data_path}"
|
56
54
|
raise "failed to clone remote repo: perhaps wrong git clone URL? #{ENV['LOCAL_DATA_REMOTE_URL']}" unless $?.success?
|
57
55
|
else
|
58
56
|
warn "`fetch_data` task requires LOCAL_DATA_PATH and LOCAL_DATA_REMOTE_URL environment variables"
|
@@ -65,7 +63,7 @@ namespace :tachikoma do
|
|
65
63
|
@git_name = 'bot-motoko'
|
66
64
|
@git_email = 'bot-motoko@al.sane.jp'
|
67
65
|
@configure =
|
68
|
-
YAML.load_file(File.join(
|
66
|
+
YAML.load_file(File.join(Tachikoma.data_path, "#{@build_for}.yaml"))
|
69
67
|
@fetch_url = @configure['url']
|
70
68
|
@base_remote_branch = 'origin/master'
|
71
69
|
@authorized_url = authorized_url_with_type(@fetch_url, @configure['type'], @github_token, @git_name)
|
@@ -90,18 +88,18 @@ namespace :tachikoma do
|
|
90
88
|
end
|
91
89
|
|
92
90
|
task :clean do
|
93
|
-
rm_rf(Dir.glob(
|
91
|
+
rm_rf(Dir.glob(Tachikoma.repos_path.to_s))
|
94
92
|
end
|
95
93
|
|
96
94
|
desc 'fetch'
|
97
95
|
task fetch: :clean do
|
98
|
-
mkdir_p(
|
99
|
-
sh "git clone #{@fetch_url}
|
96
|
+
mkdir_p(Tachikoma.repos_path.to_s)
|
97
|
+
sh "git clone #{@fetch_url} #{Tachikoma.repos_path.to_s}/#{@build_for}"
|
100
98
|
end
|
101
99
|
|
102
100
|
desc 'bundle'
|
103
101
|
task :bundle do
|
104
|
-
Dir.chdir("
|
102
|
+
Dir.chdir("#{Tachikoma.repos_path.to_s}/#{@build_for}") do
|
105
103
|
Bundler.with_clean_env do
|
106
104
|
sh %Q!sed -i -e 's/^ruby/#ruby/' Gemfile!
|
107
105
|
sh "git config user.name #{@git_name}"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tachikoma
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sanemat
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -97,7 +97,8 @@ dependencies:
|
|
97
97
|
description: Interval pull requester with bundle update.
|
98
98
|
email:
|
99
99
|
- o.gata.ken@gmail.com
|
100
|
-
executables:
|
100
|
+
executables:
|
101
|
+
- tachikoma
|
101
102
|
extensions: []
|
102
103
|
extra_rdoc_files: []
|
103
104
|
files:
|
@@ -109,6 +110,7 @@ files:
|
|
109
110
|
- NOTE.txt
|
110
111
|
- README.md
|
111
112
|
- Rakefile
|
113
|
+
- bin/tachikoma
|
112
114
|
- lib/tachikoma.rb
|
113
115
|
- lib/tachikoma/settings.rb
|
114
116
|
- lib/tachikoma/tasks.rb
|