manifestly 1.0.2 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -4
- data/lib/manifestly/cli.rb +114 -10
- data/lib/manifestly/manifest.rb +5 -0
- data/lib/manifestly/repository.rb +8 -0
- data/lib/manifestly/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 722ffef1df06266d067ba5b96f2ee8a27acd0b88
|
4
|
+
data.tar.gz: bca5c8ae71fe0bfd625aa8e6a3a9e8f9833f032d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15d56f3af994efd7879ff98b86b2754b076c7ade392be6379b63b2c2f22743e6f9bcef9bdbf40303e29000185c8e6bf8c01cec294af11ee7850e6571879fd07e
|
7
|
+
data.tar.gz: 68557cf67c367588dac6c96bcbb290ef8ba01f92bdde112faf208757a0f2c5215885f5adc8637d66b5c97d10858972e0657b1321baa2c6c213a336f3cb034436
|
data/README.md
CHANGED
@@ -33,19 +33,19 @@ To create a new manifest, run
|
|
33
33
|
|
34
34
|
Both `create` and `apply` take a `--search-paths` option to specify where the repositories of interest can be found. The default search path is the current directory.
|
35
35
|
|
36
|
-
`create` will
|
36
|
+
`create` by default is non-interactive (see `$>manifestly help create`) but there is an interactive option that will show you a blank manifest and give you options to add or remove repositories, or to choose the manifest commit for an existing repository. When repositories are added, their latest commit is listed. All commits seen during manifest creation are local commits only -- this tool does not look up remote commits.
|
37
37
|
|
38
38
|
### push
|
39
39
|
|
40
40
|
To push a manifest file you have created, call:
|
41
41
|
|
42
|
-
$ manifestly
|
42
|
+
$ manifestly upload --local=my_file.manifest --mfrepo=myorg/myrepo --remote=foo
|
43
43
|
|
44
44
|
This will take your local file and push it as the latest commit on top of the `foo` file at github.com/myorg/myrepo.
|
45
45
|
|
46
|
-
###
|
46
|
+
### download
|
47
47
|
|
48
|
-
To
|
48
|
+
To download a manifest file... see built-in help (`$>manifestly help download`)
|
49
49
|
|
50
50
|
### apply
|
51
51
|
|
data/lib/manifestly/cli.rb
CHANGED
@@ -64,8 +64,66 @@ module Manifestly
|
|
64
64
|
type: :string,
|
65
65
|
banner: '',
|
66
66
|
required: false
|
67
|
+
method_option :interactive,
|
68
|
+
desc: "Use interactive creation",
|
69
|
+
banner: '',
|
70
|
+
aliases: "-i",
|
71
|
+
type: :boolean,
|
72
|
+
default: false,
|
73
|
+
required: false
|
74
|
+
method_option :add,
|
75
|
+
desc: "Paths to repositories to add (non-interactive only)",
|
76
|
+
type: :array,
|
77
|
+
banner: '',
|
78
|
+
required: false,
|
79
|
+
default: []
|
80
|
+
method_option :remove,
|
81
|
+
desc: "Paths to repositories to remove (before any `add`ed, non-interactive only)",
|
82
|
+
type: :array,
|
83
|
+
banner: '',
|
84
|
+
required: false,
|
85
|
+
default: []
|
86
|
+
method_option :save_as,
|
87
|
+
desc: "The name to use for the created manifest file",
|
88
|
+
type: :string,
|
89
|
+
banner: '',
|
90
|
+
required: false,
|
91
|
+
default: ''
|
67
92
|
long_desc <<-DESC
|
68
|
-
|
93
|
+
Creates a manifest.
|
94
|
+
|
95
|
+
NON-INTERACTIVE CREATION
|
96
|
+
|
97
|
+
Three options are of particular use when using non-interactive creation:
|
98
|
+
|
99
|
+
--add: a space-separated list of repository paths to add, can be relative or
|
100
|
+
absolute path names; if relative, manifestly tries to find them based on the
|
101
|
+
--search_paths option. The special all option adds all available repos.
|
102
|
+
|
103
|
+
--remove: a space-separated list of repository paths to remove, only useful
|
104
|
+
if you've also passed a --based_on manifest as a starting point.
|
105
|
+
|
106
|
+
--save_as: lets you provide a name for the created manifest, otherwise defaults
|
107
|
+
to a timestamp name with a random hex hash
|
108
|
+
|
109
|
+
Examples:
|
110
|
+
|
111
|
+
$ manifestly create --search_paths=.. --add=repo1 repo2 repo3
|
112
|
+
|
113
|
+
The above is the same as:
|
114
|
+
|
115
|
+
$ manifestly create --add=../repo1 ../repo2 ../repo3
|
116
|
+
|
117
|
+
You can add "all":
|
118
|
+
|
119
|
+
$ manifestly create --add=all
|
120
|
+
|
121
|
+
$ manifestly create --based_on=existing.manifest --remove=repo1 --save_as=new.manifest
|
122
|
+
|
123
|
+
INTERACTIVE CREATION
|
124
|
+
|
125
|
+
If the interactive option is specified, a series of screens will guide
|
126
|
+
you through creation of a manifest file, either from scratch or using
|
69
127
|
an exisitng manifest as a starting point.
|
70
128
|
|
71
129
|
When run, the current manifest will be shown and you will have the
|
@@ -106,13 +164,13 @@ module Manifestly
|
|
106
164
|
|
107
165
|
Examples:
|
108
166
|
|
109
|
-
$ manifestly create\x5
|
167
|
+
$ manifestly create -i\x5
|
110
168
|
Create manifest from scratch with the default search path
|
111
169
|
|
112
|
-
$ manifestly create --search_paths=..\x5
|
170
|
+
$ manifestly create -i --search_paths=..\x5
|
113
171
|
Create manifest looking for repositories one dir up
|
114
172
|
|
115
|
-
$ manifestly create --based_on=~my.manifest --search_paths=~jim/repos\x5
|
173
|
+
$ manifestly create -i --based_on=~my.manifest --search_paths=~jim/repos\x5
|
116
174
|
Create manifest starting from an existing one
|
117
175
|
DESC
|
118
176
|
def create
|
@@ -122,7 +180,21 @@ module Manifestly
|
|
122
180
|
Manifest.new
|
123
181
|
end
|
124
182
|
|
125
|
-
|
183
|
+
if options[:interactive]
|
184
|
+
present_create_menu(manifest)
|
185
|
+
else
|
186
|
+
repos_to_remove = get_repos_from_options(options[:remove])
|
187
|
+
repos_to_remove.each do |repo_to_remove|
|
188
|
+
manifest.remove_repository(repo_to_remove)
|
189
|
+
end
|
190
|
+
|
191
|
+
repos_to_add = get_repos_from_options(options[:add])
|
192
|
+
repos_to_add.each do |repo_to_add|
|
193
|
+
manifest.add_repository(repo_to_add)
|
194
|
+
end
|
195
|
+
|
196
|
+
write_manifest(manifest, false)
|
197
|
+
end
|
126
198
|
end
|
127
199
|
|
128
200
|
desc "apply", "Sets the manifest's repository's current states to the commits listed in the manifest"
|
@@ -247,11 +319,7 @@ module Manifestly
|
|
247
319
|
indices = convert_args_to_indices(args, true) || next
|
248
320
|
present_commit_menu(manifest[indices.first])
|
249
321
|
when 'w'
|
250
|
-
|
251
|
-
filename = ask("Enter desired manifest filename (ENTER for '#{default_filename}'):")
|
252
|
-
filename = default_filename if filename.blank?
|
253
|
-
|
254
|
-
manifest.write(filename)
|
322
|
+
write_manifest(manifest, true)
|
255
323
|
break
|
256
324
|
when 'q!'
|
257
325
|
break
|
@@ -261,6 +329,20 @@ module Manifestly
|
|
261
329
|
end
|
262
330
|
end
|
263
331
|
|
332
|
+
def write_manifest(manifest, prompt_for_filename=false, filename="")
|
333
|
+
default_filename = options[:save_as].blank? ?
|
334
|
+
Time.now.strftime("%Y%m%d-%H%M%S") + "-#{::SecureRandom.hex(2)}.manifest" :
|
335
|
+
options[:save_as]
|
336
|
+
|
337
|
+
if prompt_for_filename
|
338
|
+
filename = ask("Enter desired manifest filename (ENTER for '#{default_filename}'):")
|
339
|
+
end
|
340
|
+
|
341
|
+
filename = default_filename if filename.blank?
|
342
|
+
|
343
|
+
manifest.write(filename)
|
344
|
+
end
|
345
|
+
|
264
346
|
def present_commit_menu(manifest_item, options={})
|
265
347
|
page = 0
|
266
348
|
|
@@ -516,5 +598,27 @@ module Manifestly
|
|
516
598
|
%x{stty size 2>/dev/null}.split[0].to_i
|
517
599
|
end
|
518
600
|
|
601
|
+
def get_repos_from_options(options)
|
602
|
+
if options.include?("all")
|
603
|
+
available_repositories
|
604
|
+
else
|
605
|
+
dirs = options.collect{|option| find_dir(option)}.compact
|
606
|
+
dirs.collect{|dir| Repository.load(dir)}
|
607
|
+
end
|
608
|
+
end
|
609
|
+
|
610
|
+
# Finds the provided directory looking first to see if it is an absolute
|
611
|
+
# directory, and then looking for it on the search paths
|
612
|
+
def find_dir(path)
|
613
|
+
return path if path.starts_with?('/') && Dir.exist?(path)
|
614
|
+
|
615
|
+
repository_search_paths.each do |search_path|
|
616
|
+
combined_path = File.join(search_path, path)
|
617
|
+
return combined_path if Dir.exist?(combined_path)
|
618
|
+
end
|
619
|
+
|
620
|
+
nil
|
621
|
+
end
|
622
|
+
|
519
623
|
end
|
520
624
|
end
|
data/lib/manifestly/manifest.rb
CHANGED
@@ -11,6 +11,10 @@ module Manifestly
|
|
11
11
|
@items.push(Manifestly::ManifestItem.new(repository))
|
12
12
|
end
|
13
13
|
|
14
|
+
def remove_repository(repository)
|
15
|
+
@items.reject!{|item| item.repository.display_name == repository.display_name}
|
16
|
+
end
|
17
|
+
|
14
18
|
def add_item(manifest_item)
|
15
19
|
@items.push(manifest_item)
|
16
20
|
end
|
@@ -40,6 +44,7 @@ module Manifestly
|
|
40
44
|
|
41
45
|
def write(filename)
|
42
46
|
File.open(filename, 'w') do |file|
|
47
|
+
@items.sort_by!(&:repository_name)
|
43
48
|
@items.each do |item|
|
44
49
|
file.write(item.to_file_string + "\n")
|
45
50
|
end
|
data/lib/manifestly/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: manifestly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JP Slavinsky
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|