moco-ruby 1.0.0.alpha → 1.1.0
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/CHANGELOG.md +43 -5
- data/Gemfile +1 -0
- data/Gemfile.lock +6 -4
- data/README.md +38 -2
- data/copy_project.rb +337 -0
- data/lib/moco/client.rb +2 -2
- data/lib/moco/collection_proxy.rb +10 -0
- data/lib/moco/connection.rb +8 -2
- data/lib/moco/entities/activity.rb +6 -1
- data/lib/moco/entities/base_entity.rb +14 -5
- data/lib/moco/entities/expense.rb +10 -2
- data/lib/moco/entities/holiday.rb +1 -1
- data/lib/moco/entities/project.rb +31 -14
- data/lib/moco/entities/web_hook.rb +1 -1
- data/lib/moco/entity_collection.rb +3 -3
- data/lib/moco/nested_collection_proxy.rb +4 -1
- data/lib/moco/sync.rb +411 -71
- data/lib/moco/version.rb +1 -1
- data/lib/moco-ruby.rb +6 -0
- data/lib/moco.rb +5 -3
- data/sync_activity.rb +16 -4
- metadata +12 -10
data/sync_activity.rb
CHANGED
|
@@ -10,7 +10,9 @@ options = {
|
|
|
10
10
|
to: nil,
|
|
11
11
|
project: nil,
|
|
12
12
|
match_project_threshold: 0.8,
|
|
13
|
-
match_task_threshold: 0.45
|
|
13
|
+
match_task_threshold: 0.45,
|
|
14
|
+
debug: false,
|
|
15
|
+
default_task: nil
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
OptionParser.new do |opts|
|
|
@@ -47,6 +49,14 @@ OptionParser.new do |opts|
|
|
|
47
49
|
opts.on("--match-task-threshold VALUE", Float, "Task matching threshold (0.0 - 1.0), default 0.45") do |val|
|
|
48
50
|
options[:match_task_threshold] = val
|
|
49
51
|
end
|
|
52
|
+
|
|
53
|
+
opts.on("-d", "--debug", "Enable debug output") do
|
|
54
|
+
options[:debug] = true
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
opts.on("--default-task TASK_NAME", "Default task name to map unmatched tasks to (avoids creating new tasks)") do |task_name|
|
|
58
|
+
options[:default_task] = task_name
|
|
59
|
+
end
|
|
50
60
|
end.parse!
|
|
51
61
|
|
|
52
62
|
source_instance = ARGV.shift
|
|
@@ -64,8 +74,8 @@ config = YAML.load_file("config.yml")
|
|
|
64
74
|
source_config = config["instances"].fetch(source_instance, nil)
|
|
65
75
|
target_config = config["instances"].fetch(target_instance, nil)
|
|
66
76
|
|
|
67
|
-
source_client = MOCO::Client.new(subdomain: source_instance, api_key: source_config["api_key"])
|
|
68
|
-
target_client = MOCO::Client.new(subdomain: target_instance, api_key: target_config["api_key"])
|
|
77
|
+
source_client = MOCO::Client.new(subdomain: source_instance, api_key: source_config["api_key"], debug: options[:debug])
|
|
78
|
+
target_client = MOCO::Client.new(subdomain: target_instance, api_key: target_config["api_key"], debug: options[:debug])
|
|
69
79
|
|
|
70
80
|
syncer = MOCO::Sync.new(
|
|
71
81
|
source_client,
|
|
@@ -76,7 +86,9 @@ syncer = MOCO::Sync.new(
|
|
|
76
86
|
source: options.slice(:from, :to, :project_id, :company_id, :term),
|
|
77
87
|
target: options.slice(:from, :to)
|
|
78
88
|
},
|
|
79
|
-
dry_run: options[:dry_run]
|
|
89
|
+
dry_run: options[:dry_run],
|
|
90
|
+
debug: options[:debug],
|
|
91
|
+
default_task_name: options[:default_task]
|
|
80
92
|
)
|
|
81
93
|
|
|
82
94
|
syncer.source_projects.each do |project|
|
metadata
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: moco-ruby
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Teal Bauer
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-01-09 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- - "
|
|
17
|
+
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
19
|
version: '7.0'
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
|
-
- - "
|
|
24
|
+
- - ">="
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: '7.0'
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: faraday
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
|
-
- - "
|
|
31
|
+
- - ">="
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: 2.
|
|
33
|
+
version: '2.0'
|
|
34
34
|
type: :runtime
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
|
-
- - "
|
|
38
|
+
- - ">="
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: 2.
|
|
40
|
+
version: '2.0'
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: fuzzy_match
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -69,7 +69,9 @@ files:
|
|
|
69
69
|
- README.md
|
|
70
70
|
- Rakefile
|
|
71
71
|
- config.yml.sample
|
|
72
|
+
- copy_project.rb
|
|
72
73
|
- examples/v2_api_example.rb
|
|
74
|
+
- lib/moco-ruby.rb
|
|
73
75
|
- lib/moco.rb
|
|
74
76
|
- lib/moco/client.rb
|
|
75
77
|
- lib/moco/collection_proxy.rb
|
|
@@ -115,9 +117,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
115
117
|
version: 3.2.0
|
|
116
118
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
117
119
|
requirements:
|
|
118
|
-
- - "
|
|
120
|
+
- - ">="
|
|
119
121
|
- !ruby/object:Gem::Version
|
|
120
|
-
version:
|
|
122
|
+
version: '0'
|
|
121
123
|
requirements: []
|
|
122
124
|
rubygems_version: 3.4.1
|
|
123
125
|
signing_key:
|