flit 0.1.pre → 0.2.pre
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.
- data/History.txt +6 -1
- data/VERSION +1 -1
- data/lib/flit.rb +4 -2
- data/lib/flit/commands/delete.rb +28 -0
- data/lib/flit/commands/finish.rb +32 -2
- data/lib/flit/commands/init.rb +1 -1
- data/lib/flit/commands/list.rb +55 -0
- data/lib/flit/commands/stop.rb +1 -3
- data/lib/flit/help.rb +16 -3
- data/lib/flit/version.rb +1 -1
- metadata +5 -3
data/History.txt
CHANGED
@@ -1,2 +1,7 @@
|
|
1
|
-
== 0.
|
1
|
+
== 0.2.pre / 2010-08-29
|
2
|
+
* Feature: Added delete, finish and list commands
|
3
|
+
* Feature: Commands can now have their own help pages. Accessible via 'flit help COMMAND'
|
4
|
+
* Bugfix: Commands are no longer initialised when loading their help docs
|
5
|
+
|
6
|
+
== 0.1.pre / 2010-08-27
|
2
7
|
* Developer preview
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.pre
|
data/lib/flit.rb
CHANGED
@@ -10,10 +10,12 @@ module Flit
|
|
10
10
|
|
11
11
|
module Commands
|
12
12
|
autoload :Base, "flit/commands"
|
13
|
+
autoload :Delete, "flit/commands/delete"
|
14
|
+
autoload :Finish, "flit/commands/finish"
|
13
15
|
autoload :Init, "flit/commands/init"
|
16
|
+
autoload :List, "flit/commands/list"
|
14
17
|
autoload :Start, "flit/commands/start"
|
15
18
|
autoload :Stop, "flit/commands/stop"
|
16
|
-
autoload :Finish, "flit/commands/finish"
|
17
19
|
autoload :Version, "flit/commands/version"
|
18
20
|
end
|
19
21
|
|
@@ -23,7 +25,7 @@ module Flit
|
|
23
25
|
puts "Flit #{Version::STRING}"
|
24
26
|
|
25
27
|
elsif ARGV[0].nil? || %w(help --help -h).include?(ARGV.first)
|
26
|
-
puts Help.display
|
28
|
+
puts (ARGV[1].nil?) ? Help.display : Help.display_for_command(ARGV[1])
|
27
29
|
|
28
30
|
else
|
29
31
|
command = ARGV.first
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Flit
|
2
|
+
module Commands
|
3
|
+
class Delete
|
4
|
+
DESC = "Delete a feature or bugfix branch. Use with caution."
|
5
|
+
USAGE = "TYPE NAME"
|
6
|
+
OPTIONS = {
|
7
|
+
:type => "Can be either a feature or bugfix",
|
8
|
+
:name => "The name of your feature or bugfix",
|
9
|
+
}
|
10
|
+
|
11
|
+
def run(args)
|
12
|
+
# Gatekeepers
|
13
|
+
fatal "directory isn't a flit repository" unless is_flit?
|
14
|
+
show_help unless args.count == 2
|
15
|
+
|
16
|
+
type, name = args
|
17
|
+
config = open_config
|
18
|
+
|
19
|
+
h = HighLine.new
|
20
|
+
|
21
|
+
if h.agree("Delete #{type} branch '#{name}'? [yn]", true)
|
22
|
+
`git branch -d #{type}/#{name}`
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/flit/commands/finish.rb
CHANGED
@@ -2,11 +2,41 @@ module Flit
|
|
2
2
|
module Commands
|
3
3
|
class Finish
|
4
4
|
DESC = "Finish up a feature or bugfix and merge it back into the development branch"
|
5
|
+
USAGE = "TYPE NAME"
|
6
|
+
OPTIONS = {
|
7
|
+
:type => "Can be either a feature or bugfix",
|
8
|
+
:name => "The name of your feature or bugfix",
|
9
|
+
}
|
5
10
|
|
6
11
|
def run(args)
|
7
|
-
#
|
12
|
+
# Gatekeepers
|
13
|
+
fatal "directory isn't a flit repository" unless is_flit?
|
14
|
+
show_help unless args.count == 2
|
8
15
|
|
9
|
-
|
16
|
+
type, name = args
|
17
|
+
config = open_config
|
18
|
+
|
19
|
+
current_branch = nil
|
20
|
+
`git branch`.split("\n").each do |branch|
|
21
|
+
if branch[0,1] == '*'
|
22
|
+
current_branch = branch[2..-1].downcase.split('/')
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
`git checkout #{config[:branches][:bleeding_edge]}` unless current_branch[0] == config[:branches][:bleeding_edge]
|
27
|
+
`git pull`
|
28
|
+
`git checkout #{type}/#{name}`
|
29
|
+
`git merge master`
|
30
|
+
|
31
|
+
# Todo: do merge conflict detection here
|
32
|
+
|
33
|
+
`git checkout #{config[:branches][:bleeding_edge]}`
|
34
|
+
`git merge #{type}/#{name}`
|
35
|
+
|
36
|
+
`flit delete #{type} #{name}`
|
37
|
+
|
38
|
+
puts "\nMerged '#{type}/#{name}' into '#{config[:branches][:bleeding_edge]}'."
|
39
|
+
puts "You should now 'git push' your changes."
|
10
40
|
end
|
11
41
|
|
12
42
|
end
|
data/lib/flit/commands/init.rb
CHANGED
@@ -0,0 +1,55 @@
|
|
1
|
+
module Flit
|
2
|
+
module Commands
|
3
|
+
class List
|
4
|
+
DESC = "Allows you to view an outline of ongoing features and bugfixes in your Git repo.
|
5
|
+
If TYPE is not specified, 'list' will show you details of both features and bugfixes."
|
6
|
+
USAGE = "[TYPE]"
|
7
|
+
OPTIONS = {
|
8
|
+
:type => "Can be either a feature or bugfix",
|
9
|
+
}
|
10
|
+
|
11
|
+
def run(args)
|
12
|
+
# Gatekeeper
|
13
|
+
fatal "directory isn't a flit repository" unless is_flit?
|
14
|
+
|
15
|
+
type = args[0]
|
16
|
+
unless type.nil? || type == 'feature' || type == 'bugfix'
|
17
|
+
show_help
|
18
|
+
end
|
19
|
+
|
20
|
+
config = open_config
|
21
|
+
feature_branches = []
|
22
|
+
bugfix_branches = []
|
23
|
+
other_branches = []
|
24
|
+
|
25
|
+
`git branch`.each do |branch|
|
26
|
+
indicator = (branch[0,1] == '*') ? ' => ' : ' '
|
27
|
+
branch = branch[2..-1].downcase
|
28
|
+
split_branch = branch.split('/')
|
29
|
+
|
30
|
+
if branch.include?(config[:branches][:feature_prefix])
|
31
|
+
feature_branches << "#{indicator}#{split_branch[1..-1].join('/')}"
|
32
|
+
elsif branch.include?(config[:branches][:bugfix_prefix])
|
33
|
+
bugfix_branches << "#{indicator}#{split_branch[1..-1].join('/')}"
|
34
|
+
else
|
35
|
+
other_branches << "#{indicator}#{branch}"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
list_branches "Features", feature_branches unless type == 'bugfix'
|
40
|
+
list_branches "Bugfixes", bugfix_branches unless type == 'feature'
|
41
|
+
list_branches "Other", other_branches if type.nil?
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
def list_branches(type, branches)
|
46
|
+
if branches.count > 0
|
47
|
+
puts "#{type}:"
|
48
|
+
branches.each {|f| puts f}
|
49
|
+
puts ""
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
data/lib/flit/commands/stop.rb
CHANGED
@@ -1,11 +1,9 @@
|
|
1
1
|
module Flit
|
2
2
|
module Commands
|
3
3
|
class Stop
|
4
|
-
DESC = "Stop work on a feature
|
4
|
+
DESC = "Stop work on a feature or bugfix"
|
5
5
|
|
6
6
|
def run(args)
|
7
|
-
# TODO: Show the help page if no options are set
|
8
|
-
|
9
7
|
`git checkout #{open_config[:branches][:bleeding_edge]}`
|
10
8
|
end
|
11
9
|
|
data/lib/flit/help.rb
CHANGED
@@ -7,7 +7,7 @@ Usage:
|
|
7
7
|
Commands:
|
8
8
|
{{commands}}
|
9
9
|
|
10
|
-
help
|
10
|
+
help [COMMAND] # Show this page
|
11
11
|
-v, --version # Get Flit version information
|
12
12
|
|
13
13
|
USAGE
|
@@ -26,7 +26,8 @@ USAGE
|
|
26
26
|
begin
|
27
27
|
command = f.gsub(/\.rb/, '')
|
28
28
|
klass = "Flit::Commands::#{command.camelize}"
|
29
|
-
|
29
|
+
desc = eval("#{klass}::DESC").split('.')[0]
|
30
|
+
commands << "#{command.ljust(20)}# #{desc}"
|
30
31
|
rescue
|
31
32
|
end
|
32
33
|
end
|
@@ -37,9 +38,21 @@ USAGE
|
|
37
38
|
|
38
39
|
|
39
40
|
def self.display_for_command(klass)
|
41
|
+
if klass.split(/::/).count == 1
|
42
|
+
klass = "Flit::Commands::#{klass.camelize}"
|
43
|
+
end
|
44
|
+
|
40
45
|
command = klass.split(/::/)[-1].downcase
|
46
|
+
help = ""
|
47
|
+
|
48
|
+
begin
|
49
|
+
help << "#{eval("#{klass}::DESC")}\n\n"
|
50
|
+
rescue
|
51
|
+
puts "flit: '#{command}' is not a command. See 'flit help'."
|
52
|
+
exit(0)
|
53
|
+
end
|
41
54
|
|
42
|
-
help
|
55
|
+
help << "Usage:\n flit #{command}"
|
43
56
|
begin
|
44
57
|
help << " #{eval("#{klass}::USAGE")}"
|
45
58
|
rescue
|
data/lib/flit/version.rb
CHANGED
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: true
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
7
|
+
- 2
|
8
8
|
- pre
|
9
|
-
version: 0.
|
9
|
+
version: 0.2.pre
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Matt Kirman
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-08-
|
17
|
+
date: 2010-08-29 00:00:00 +01:00
|
18
18
|
default_executable: flit
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -49,8 +49,10 @@ files:
|
|
49
49
|
- lib/flit/commands.rb
|
50
50
|
- lib/flit/help.rb
|
51
51
|
- lib/flit/version.rb
|
52
|
+
- lib/flit/commands/delete.rb
|
52
53
|
- lib/flit/commands/finish.rb
|
53
54
|
- lib/flit/commands/init.rb
|
55
|
+
- lib/flit/commands/list.rb
|
54
56
|
- lib/flit/commands/start.rb
|
55
57
|
- lib/flit/commands/stop.rb
|
56
58
|
- lib/flit/commands/version.rb
|