greenhouse 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/greenhouse/commands/pull.rb +10 -2
- data/lib/greenhouse/commands/push.rb +10 -2
- data/lib/greenhouse/commands/status.rb +13 -3
- data/lib/greenhouse/commands/sync.rb +10 -2
- data/lib/greenhouse/resources/dotenv_file.rb +2 -2
- data/lib/greenhouse/tasks/project_status.rb +5 -4
- data/lib/greenhouse/tasks/project_task.rb +24 -11
- data/lib/greenhouse/tasks/pull_project.rb +2 -2
- data/lib/greenhouse/tasks/push_project.rb +2 -2
- data/lib/greenhouse/tasks/sync_project.rb +3 -3
- data/lib/greenhouse/version.rb +6 -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: 229698788eac988d4fe2a4b0e02020c411ddd197
|
4
|
+
data.tar.gz: 1690b56ca25c361603b648dad3491a85b8e87b28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33ad676178e147a1584de6e462e939e7e9f78e725093a66c4dfb214110069eed444f84dc5e6d73fc0ae199069a309a2f18c1157bbeece1d1f62546a04e9d99ca
|
7
|
+
data.tar.gz: e15dcb381f91305271916b30ac01d8f4a375d46865f64112d372acff09ec1eedd614e1fd472895b91bc5aa7308e46129fa420823ffc6866d5c48253c4e125128
|
@@ -3,6 +3,7 @@ module Greenhouse
|
|
3
3
|
class Pull
|
4
4
|
include Command
|
5
5
|
command_summary "Pull and merge remote branches for all projects"
|
6
|
+
valid_argument Scripts::Argument.new("-f, --force", :summary => "Pull and merge all projects without prompting")
|
6
7
|
project_arguments *Projects::projects.map(&:to_arg)
|
7
8
|
|
8
9
|
class << self
|
@@ -10,11 +11,18 @@ module Greenhouse
|
|
10
11
|
puts <<USAGE
|
11
12
|
usage: #{::Greenhouse::CLI.command_name} #{command_name} [<project>] #{valid_arguments.to_s}
|
12
13
|
|
14
|
+
Arguments:
|
15
|
+
#{valid_arguments.to_help}
|
16
|
+
|
13
17
|
Projects:
|
14
18
|
#{project_arguments.to_help}
|
15
19
|
USAGE
|
16
20
|
end
|
17
21
|
end
|
22
|
+
|
23
|
+
def force?
|
24
|
+
arguments.map(&:key).include?("-f")
|
25
|
+
end
|
18
26
|
|
19
27
|
def pull_all
|
20
28
|
if Projects.projects.empty?
|
@@ -23,7 +31,7 @@ USAGE
|
|
23
31
|
end
|
24
32
|
|
25
33
|
Projects.projects.each do |project|
|
26
|
-
Tasks::PullProject.perform(project)
|
34
|
+
Tasks::PullProject.perform(project, force?)
|
27
35
|
end
|
28
36
|
end
|
29
37
|
|
@@ -33,7 +41,7 @@ USAGE
|
|
33
41
|
return
|
34
42
|
end
|
35
43
|
|
36
|
-
Tasks::PullProject.perform(project)
|
44
|
+
Tasks::PullProject.perform(project, force?)
|
37
45
|
end
|
38
46
|
|
39
47
|
def run
|
@@ -3,6 +3,7 @@ module Greenhouse
|
|
3
3
|
class Push
|
4
4
|
include Command
|
5
5
|
command_summary "Push local branches for all projects to their git remotes"
|
6
|
+
valid_argument Scripts::Argument.new("-f, --force", :summary => "Push all branches without prompting")
|
6
7
|
project_arguments *Projects::projects.map(&:to_arg)
|
7
8
|
|
8
9
|
class << self
|
@@ -10,11 +11,18 @@ module Greenhouse
|
|
10
11
|
puts <<USAGE
|
11
12
|
usage: #{::Greenhouse::CLI.command_name} #{command_name} [<project>] #{valid_arguments.to_s}
|
12
13
|
|
14
|
+
Arguments:
|
15
|
+
#{valid_arguments.to_help}
|
16
|
+
|
13
17
|
Projects:
|
14
18
|
#{project_arguments.to_help}
|
15
19
|
USAGE
|
16
20
|
end
|
17
21
|
end
|
22
|
+
|
23
|
+
def force?
|
24
|
+
arguments.map(&:key).include?("-f")
|
25
|
+
end
|
18
26
|
|
19
27
|
def push_all
|
20
28
|
if Projects.projects.empty?
|
@@ -23,7 +31,7 @@ USAGE
|
|
23
31
|
end
|
24
32
|
|
25
33
|
Projects.projects.each do |project|
|
26
|
-
Tasks::PushProject.perform(project)
|
34
|
+
Tasks::PushProject.perform(project, force?)
|
27
35
|
end
|
28
36
|
end
|
29
37
|
|
@@ -33,7 +41,7 @@ USAGE
|
|
33
41
|
return
|
34
42
|
end
|
35
43
|
|
36
|
-
Tasks::PushProject.perform(project)
|
44
|
+
Tasks::PushProject.perform(project, force?)
|
37
45
|
end
|
38
46
|
|
39
47
|
def run
|
@@ -3,7 +3,9 @@ module Greenhouse
|
|
3
3
|
class Status
|
4
4
|
include Command
|
5
5
|
summary "List projects and their current status"
|
6
|
-
valid_argument Scripts::Argument.new("-g, --git", :summary => "Check git remotes
|
6
|
+
valid_argument Scripts::Argument.new("-g, --git", :summary => "Check git remotes to ensure you're status report is up-to-date on branch status, etc.")
|
7
|
+
valid_argument Scripts::Argument.new("-v, --verbose", :summary => "Print out verbose information about branch and commit status")
|
8
|
+
valid_argument Scripts::Argument.new("-r, --remote", :summary => "Include information about remote branches that are available to be checked out")
|
7
9
|
valid_argument Scripts::Argument.new("--all", :summary => "Print status for all projects (default)")
|
8
10
|
valid_argument Scripts::Argument.new("--apps", :summary => "Print status for all applications")
|
9
11
|
valid_argument Scripts::Argument.new("--gems", :summary => "Print status for all gems")
|
@@ -34,6 +36,14 @@ USAGE
|
|
34
36
|
def with_git?
|
35
37
|
arguments.map(&:key).include?("-g")
|
36
38
|
end
|
39
|
+
|
40
|
+
def remote?
|
41
|
+
arguments.map(&:key).include?("-r")
|
42
|
+
end
|
43
|
+
|
44
|
+
def verbose?
|
45
|
+
arguments.map(&:key).include?("-v")
|
46
|
+
end
|
37
47
|
|
38
48
|
def project_type
|
39
49
|
arguments.map(&:key).include?("--apps") ? 'applications' : (arguments.map(&:key).include?("--gems") ? 'gems' : 'projects')
|
@@ -46,12 +56,12 @@ USAGE
|
|
46
56
|
end
|
47
57
|
|
48
58
|
Projects::send(project_type).each do |project|
|
49
|
-
Tasks::ProjectStatus.perform(project, with_git?)
|
59
|
+
Tasks::ProjectStatus.perform(project, with_git?, verbose?, remote?)
|
50
60
|
end
|
51
61
|
end
|
52
62
|
|
53
63
|
def project_status
|
54
|
-
Tasks::ProjectStatus.perform(project, with_git?)
|
64
|
+
Tasks::ProjectStatus.perform(project, with_git?, verbose?, remote?)
|
55
65
|
end
|
56
66
|
end
|
57
67
|
end
|
@@ -3,6 +3,7 @@ module Greenhouse
|
|
3
3
|
class Sync
|
4
4
|
include Command
|
5
5
|
command_summary "Sync all projects with their git remotes"
|
6
|
+
valid_argument Scripts::Argument.new("-f, --force", :summary => "Pull and merge all projects without prompting")
|
6
7
|
project_arguments *Projects::projects.map(&:to_arg)
|
7
8
|
|
8
9
|
class << self
|
@@ -10,11 +11,18 @@ module Greenhouse
|
|
10
11
|
puts <<USAGE
|
11
12
|
usage: #{::Greenhouse::CLI.command_name} #{command_name} [<project>] #{valid_arguments.to_s}
|
12
13
|
|
14
|
+
Arguments:
|
15
|
+
#{valid_arguments.to_help}
|
16
|
+
|
13
17
|
Projects:
|
14
18
|
#{project_arguments.to_help}
|
15
19
|
USAGE
|
16
20
|
end
|
17
21
|
end
|
22
|
+
|
23
|
+
def force?
|
24
|
+
arguments.map(&:key).include?("-f")
|
25
|
+
end
|
18
26
|
|
19
27
|
def sync_all
|
20
28
|
if Projects.projects.empty?
|
@@ -23,13 +31,13 @@ USAGE
|
|
23
31
|
end
|
24
32
|
|
25
33
|
Projects.projects.each do |project|
|
26
|
-
Tasks::SyncProject.perform(project)
|
34
|
+
Tasks::SyncProject.perform(project, force?)
|
27
35
|
end
|
28
36
|
Tasks::GenerateProcfile.perform
|
29
37
|
end
|
30
38
|
|
31
39
|
def sync_project(project)
|
32
|
-
Tasks::SyncProject.perform(project)
|
40
|
+
Tasks::SyncProject.perform(project, force?)
|
33
41
|
Tasks::GenerateProcfile.perform if project.type == 'application'
|
34
42
|
end
|
35
43
|
|
@@ -4,9 +4,9 @@ module Greenhouse
|
|
4
4
|
include Task
|
5
5
|
include ProjectTask
|
6
6
|
|
7
|
-
def perform(project, verbose=false)
|
7
|
+
def perform(project, fetch=false, verbose=false, remote=false)
|
8
8
|
@project = project
|
9
|
-
@project.repository.fetch if
|
9
|
+
@project.repository.fetch if fetch && @project.exists?
|
10
10
|
|
11
11
|
Inkjet.indent do
|
12
12
|
print "#{@project.title.cyan} (#{@project.type.capitalize})"
|
@@ -26,15 +26,16 @@ module Greenhouse
|
|
26
26
|
end
|
27
27
|
|
28
28
|
puts
|
29
|
-
|
29
|
+
|
30
30
|
if verbose
|
31
31
|
Inkjet.indent do
|
32
32
|
print_local_changes if @project.repository.changes?
|
33
33
|
print_unpushed_branches if @project.repository.ahead?
|
34
34
|
print_out_of_sync_branches if @project.repository.out_of_sync?
|
35
|
-
print_not_checked_out_branches if @project.repository.not_checked_out?
|
36
35
|
end
|
37
36
|
end
|
37
|
+
|
38
|
+
Inkjet.indent { print_not_checked_out_branches } if remote && @project.repository.not_checked_out?
|
38
39
|
end
|
39
40
|
end
|
40
41
|
|
@@ -43,7 +43,7 @@ module Greenhouse
|
|
43
43
|
false
|
44
44
|
end
|
45
45
|
|
46
|
-
def pull
|
46
|
+
def pull(force=false)
|
47
47
|
print "Checking #{@project.title.cyan} git remotes for upstream commits... "
|
48
48
|
|
49
49
|
@project.repository.fetch # fetch the latest from remotes
|
@@ -62,9 +62,14 @@ module Greenhouse
|
|
62
62
|
stashed = false
|
63
63
|
if @project.repository.changes?(false)
|
64
64
|
puts "You have uncommitted local changes in #{@project.path.cyan} on branch #{@project.repository.git.branch.name.white}".yellow
|
65
|
-
|
66
|
-
|
67
|
-
merge =
|
65
|
+
|
66
|
+
if force
|
67
|
+
merge = 'yes'
|
68
|
+
else
|
69
|
+
while !['y','yes','n','no'].include?(merge) do
|
70
|
+
print "Would you like to stash your changes and merge the latest commits from upstream? ([y]es/[n]o): "
|
71
|
+
merge = STDIN.gets.chomp.downcase
|
72
|
+
end
|
68
73
|
end
|
69
74
|
|
70
75
|
if ['y','yes'].include?(merge)
|
@@ -73,9 +78,13 @@ module Greenhouse
|
|
73
78
|
@project.repository.stash
|
74
79
|
end
|
75
80
|
else
|
76
|
-
|
77
|
-
|
78
|
-
|
81
|
+
if force
|
82
|
+
merge = 'yes'
|
83
|
+
else
|
84
|
+
while !['y','yes','n','no'].include?(merge) do
|
85
|
+
print "Would you like to attempt to merge the latest commits from upstream? ([y]es/[n]o): "
|
86
|
+
merge = STDIN.gets.chomp.downcase
|
87
|
+
end
|
79
88
|
end
|
80
89
|
end
|
81
90
|
|
@@ -108,12 +117,16 @@ module Greenhouse
|
|
108
117
|
end
|
109
118
|
end
|
110
119
|
|
111
|
-
def push
|
120
|
+
def push(force=false)
|
112
121
|
if @project.repository.ahead? || @project.repository.diverged?
|
113
122
|
print_unpushed_branches
|
114
123
|
|
115
|
-
|
116
|
-
|
124
|
+
if force
|
125
|
+
push = 'push'
|
126
|
+
else
|
127
|
+
print "Would you like to push these branches now? ([P]ush/[s]kip): "
|
128
|
+
push = STDIN.gets.chomp.downcase
|
129
|
+
end
|
117
130
|
|
118
131
|
if %w(s skip).include?(push)
|
119
132
|
puts "Skipped #{@project.title}"
|
@@ -188,7 +201,7 @@ module Greenhouse
|
|
188
201
|
|
189
202
|
def print_not_checked_out_branches
|
190
203
|
puts
|
191
|
-
puts "The following branches are available
|
204
|
+
puts "The following branches are available in #{@project.title.cyan}:".green
|
192
205
|
puts
|
193
206
|
@project.repository.not_checked_out.each do |branch|
|
194
207
|
puts "branch #{branch.full.split("/").last.bold} is #{"available".green} from #{branch.full.split("/")[1].bold}".indent
|
@@ -4,12 +4,12 @@ module Greenhouse
|
|
4
4
|
include Task
|
5
5
|
include ProjectTask
|
6
6
|
|
7
|
-
def perform(project)
|
7
|
+
def perform(project, force=false)
|
8
8
|
@project = project
|
9
9
|
|
10
10
|
if @project.exists?
|
11
|
-
pull && bundle
|
12
|
-
push
|
11
|
+
pull(force) && bundle
|
12
|
+
push(force)
|
13
13
|
else
|
14
14
|
clone && bundle
|
15
15
|
end
|
data/lib/greenhouse/version.rb
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
module Greenhouse
|
2
|
-
VERSION = "0.0.
|
2
|
+
VERSION = "0.0.11"
|
3
3
|
end
|
4
4
|
|
5
5
|
__END__
|
6
|
+
0.0.11:
|
7
|
+
* --force flag for push/pull/sync commands
|
8
|
+
* --verbose and --remote flag for status to control verbosity and printing remote branches
|
9
|
+
* explicitly converting dotenv values to strings before checking or writing them
|
10
|
+
|
6
11
|
0.0.10:
|
7
12
|
* Adding a -d/--debug flag to output full backtraces
|
8
13
|
* Not writing empty .env vars
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: greenhouse
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Rebec
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-06-
|
11
|
+
date: 2013-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|