flit 0.2.pre → 0.3.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +3 -0
- data/README.md +6 -1
- data/VERSION +1 -1
- data/lib/flit.rb +7 -0
- data/lib/flit/commands.rb +2 -2
- data/lib/flit/commands/delete.rb +4 -0
- data/lib/flit/commands/finish.rb +4 -0
- data/lib/flit/commands/init.rb +4 -0
- data/lib/flit/commands/list.rb +5 -1
- data/lib/flit/commands/start.rb +4 -0
- data/lib/flit/commands/stop.rb +2 -0
- data/lib/flit/hooks.rb +58 -0
- data/lib/flit/version.rb +1 -1
- metadata +5 -4
data/History.txt
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#Flit
|
2
2
|
|
3
|
-
Flit
|
3
|
+
Flit is a super simple extension manager for Git. It aims to give quick repository functions to improve a typical Git workflow as described at [http://mattkirman.com/2010/08/27/my-git-workflow-introducing-flit/](http://mattkirman.com/2010/08/27/my-git-workflow-introducing-flit/) through a combination of [events](http://github.com/mattkirman/flit/wiki/Events), [commands](http://github.com/mattkirman/flit/wiki/Commands) and [plugins](http://github.com/mattkirman/flit/wiki/Plugins).
|
4
4
|
|
5
5
|
_Flit is an extremely early alpha. Features may be broken or just plain missing, but getting this code out into the open-source community where people can start hacking away with it is much more important. If something’s missing just fork the code, add your fix and send me a pull request._
|
6
6
|
|
@@ -44,6 +44,11 @@ Once your code is finished and you're ready to merge it back into your developme
|
|
44
44
|
This will pull down changes in master, rebase them into your feature branch and then merge your feature back into master.
|
45
45
|
|
46
46
|
|
47
|
+
##Documentation
|
48
|
+
|
49
|
+
Please refer to the [Flit wiki](http://github.com/mattkirman/flit/wiki) for full documentation. As with the rest of the project, the documentation is a work in progress so what's written may differ slightly from what's actually on the ground.
|
50
|
+
|
51
|
+
|
47
52
|
##Contributing
|
48
53
|
|
49
54
|
You want to contribute? Great!
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.pre
|
data/lib/flit.rb
CHANGED
@@ -5,6 +5,7 @@ require 'highline'
|
|
5
5
|
|
6
6
|
module Flit
|
7
7
|
autoload :Help, 'flit/help'
|
8
|
+
autoload :Hooks, 'flit/hooks'
|
8
9
|
autoload :Version, 'flit/version'
|
9
10
|
|
10
11
|
|
@@ -21,11 +22,15 @@ module Flit
|
|
21
22
|
|
22
23
|
|
23
24
|
def self.exec_script!
|
25
|
+
Hooks.instance.load!
|
26
|
+
Hooks.fire :didStart
|
27
|
+
|
24
28
|
if %w(--version -v).include? ARGV.first
|
25
29
|
puts "Flit #{Version::STRING}"
|
26
30
|
|
27
31
|
elsif ARGV[0].nil? || %w(help --help -h).include?(ARGV.first)
|
28
32
|
puts (ARGV[1].nil?) ? Help.display : Help.display_for_command(ARGV[1])
|
33
|
+
Hooks.fire :didShowHelp
|
29
34
|
|
30
35
|
else
|
31
36
|
command = ARGV.first
|
@@ -43,6 +48,8 @@ module Flit
|
|
43
48
|
end
|
44
49
|
|
45
50
|
end
|
51
|
+
|
52
|
+
Hooks.fire :didFinish
|
46
53
|
end
|
47
54
|
|
48
55
|
end
|
data/lib/flit/commands.rb
CHANGED
@@ -14,7 +14,7 @@ module Flit
|
|
14
14
|
|
15
15
|
|
16
16
|
def is_flit?(path = nil)
|
17
|
-
path ||= "#{working_directory}/.
|
17
|
+
path ||= "#{working_directory}/.flit/config"
|
18
18
|
File.exists? path
|
19
19
|
end
|
20
20
|
|
@@ -31,7 +31,7 @@ module Flit
|
|
31
31
|
|
32
32
|
|
33
33
|
def open_config
|
34
|
-
YAML::load(File.open('.
|
34
|
+
YAML::load(File.open('.flit/config'))
|
35
35
|
end
|
36
36
|
|
37
37
|
|
data/lib/flit/commands/delete.rb
CHANGED
@@ -13,6 +13,8 @@ module Flit
|
|
13
13
|
fatal "directory isn't a flit repository" unless is_flit?
|
14
14
|
show_help unless args.count == 2
|
15
15
|
|
16
|
+
Hooks.fire :didStartCommand__delete
|
17
|
+
|
16
18
|
type, name = args
|
17
19
|
config = open_config
|
18
20
|
|
@@ -21,6 +23,8 @@ module Flit
|
|
21
23
|
if h.agree("Delete #{type} branch '#{name}'? [yn]", true)
|
22
24
|
`git branch -d #{type}/#{name}`
|
23
25
|
end
|
26
|
+
|
27
|
+
Hooks.fire :didFinishCommand__delete, {:type => type, :name => name}
|
24
28
|
end
|
25
29
|
|
26
30
|
end
|
data/lib/flit/commands/finish.rb
CHANGED
@@ -13,6 +13,8 @@ module Flit
|
|
13
13
|
fatal "directory isn't a flit repository" unless is_flit?
|
14
14
|
show_help unless args.count == 2
|
15
15
|
|
16
|
+
Hooks.fire :didStartCommand__finish
|
17
|
+
|
16
18
|
type, name = args
|
17
19
|
config = open_config
|
18
20
|
|
@@ -37,6 +39,8 @@ module Flit
|
|
37
39
|
|
38
40
|
puts "\nMerged '#{type}/#{name}' into '#{config[:branches][:bleeding_edge]}'."
|
39
41
|
puts "You should now 'git push' your changes."
|
42
|
+
|
43
|
+
Hooks.fire :didFinishCommand__finish, {:type => type, :name => name}
|
40
44
|
end
|
41
45
|
|
42
46
|
end
|
data/lib/flit/commands/init.rb
CHANGED
@@ -9,6 +9,8 @@ module Flit
|
|
9
9
|
fatal "directory is already a flit repository"
|
10
10
|
end
|
11
11
|
|
12
|
+
Hooks.fire :didStartCommand__init
|
13
|
+
|
12
14
|
# Don't allow us to reinitialise an existing Git repository
|
13
15
|
unless is_git?
|
14
16
|
puts "Creating a new repository..."
|
@@ -33,6 +35,7 @@ module Flit
|
|
33
35
|
|
34
36
|
|
35
37
|
# Save our config
|
38
|
+
`mkdir -p .flit .flit/hooks`
|
36
39
|
save_config ({
|
37
40
|
:branches => {
|
38
41
|
:bleeding_edge => bleeding_edge_branch_name,
|
@@ -47,6 +50,7 @@ module Flit
|
|
47
50
|
})
|
48
51
|
|
49
52
|
# Repository created!
|
53
|
+
Hooks.fire :didFinishCommand__init
|
50
54
|
end
|
51
55
|
|
52
56
|
end
|
data/lib/flit/commands/list.rb
CHANGED
@@ -12,6 +12,8 @@ If TYPE is not specified, 'list' will show you details of both features and bugf
|
|
12
12
|
# Gatekeeper
|
13
13
|
fatal "directory isn't a flit repository" unless is_flit?
|
14
14
|
|
15
|
+
Hooks.fire :didStartCommand__list
|
16
|
+
|
15
17
|
type = args[0]
|
16
18
|
unless type.nil? || type == 'feature' || type == 'bugfix'
|
17
19
|
show_help
|
@@ -22,7 +24,7 @@ If TYPE is not specified, 'list' will show you details of both features and bugf
|
|
22
24
|
bugfix_branches = []
|
23
25
|
other_branches = []
|
24
26
|
|
25
|
-
`git branch`.each do |branch|
|
27
|
+
`git branch`.split("\n").each do |branch|
|
26
28
|
indicator = (branch[0,1] == '*') ? ' => ' : ' '
|
27
29
|
branch = branch[2..-1].downcase
|
28
30
|
split_branch = branch.split('/')
|
@@ -39,6 +41,8 @@ If TYPE is not specified, 'list' will show you details of both features and bugf
|
|
39
41
|
list_branches "Features", feature_branches unless type == 'bugfix'
|
40
42
|
list_branches "Bugfixes", bugfix_branches unless type == 'feature'
|
41
43
|
list_branches "Other", other_branches if type.nil?
|
44
|
+
|
45
|
+
Hooks.fire :didFinishCommand__list
|
42
46
|
end
|
43
47
|
|
44
48
|
private
|
data/lib/flit/commands/start.rb
CHANGED
@@ -13,6 +13,8 @@ module Flit
|
|
13
13
|
fatal "directory isn't a flit repository" unless is_flit?
|
14
14
|
show_help unless args.count == 2
|
15
15
|
|
16
|
+
Hooks.fire :didStartCommand__start
|
17
|
+
|
16
18
|
type, name = args
|
17
19
|
config = open_config
|
18
20
|
|
@@ -26,6 +28,8 @@ module Flit
|
|
26
28
|
|
27
29
|
`git branch #{branch_name}` if `git branch`.match(branch_name).nil?
|
28
30
|
`git checkout #{branch_name}`
|
31
|
+
|
32
|
+
Hooks.fire :didFinishCommand__start, {:type => type, :name => name}
|
29
33
|
end
|
30
34
|
|
31
35
|
end
|
data/lib/flit/commands/stop.rb
CHANGED
data/lib/flit/hooks.rb
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'singleton'
|
2
|
+
|
3
|
+
module Flit
|
4
|
+
class Hooks
|
5
|
+
include Singleton
|
6
|
+
|
7
|
+
@hooks = {}
|
8
|
+
|
9
|
+
def load!
|
10
|
+
# Load hooks on a per-repository basis
|
11
|
+
Dir[File.join(`pwd`.gsub(/\n/, ''), '.flit', 'hooks', '*.rb')].each do |file|
|
12
|
+
load_file file
|
13
|
+
end
|
14
|
+
|
15
|
+
# Load hooks in the user's home directory
|
16
|
+
Dir[File.join(`cd ~ && pwd`.gsub(/\n/, ''), '.flit', 'hooks', '*.rb')].each do |file|
|
17
|
+
load_file file
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def bind(*args, &block)
|
22
|
+
args = parse_args args
|
23
|
+
@hooks = {} if @hooks.nil?
|
24
|
+
|
25
|
+
@hooks[args[:on]] = [] if @hooks[args[:on]].nil?
|
26
|
+
@hooks[args[:on]] << block
|
27
|
+
end
|
28
|
+
|
29
|
+
def fire(e, args = {})
|
30
|
+
unless @hooks[e].nil?
|
31
|
+
@hooks[e].each do |hook|
|
32
|
+
hook.call args
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.fire(e, args = {})
|
38
|
+
instance.fire e, args
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
def load_file(file)
|
43
|
+
hook = File.open(file, 'r').read
|
44
|
+
instance_eval(hook, file || "(eval)")
|
45
|
+
end
|
46
|
+
|
47
|
+
def parse_args(args)
|
48
|
+
arguments = {}
|
49
|
+
args.each do |a|
|
50
|
+
a.each do |c, d|
|
51
|
+
arguments[c] = d
|
52
|
+
end
|
53
|
+
end
|
54
|
+
arguments
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
end
|
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
|
+
- 3
|
8
8
|
- pre
|
9
|
-
version: 0.
|
9
|
+
version: 0.3.pre
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Matt Kirman
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
version: "0"
|
31
31
|
type: :runtime
|
32
32
|
version_requirements: *id001
|
33
|
-
description: Flit
|
33
|
+
description: Flit is a super simple extension manager for Git. It aims to give quick repository functions to improve a typical Git workflow.
|
34
34
|
email: matt@mattkirman.com
|
35
35
|
executables:
|
36
36
|
- flit
|
@@ -48,6 +48,7 @@ files:
|
|
48
48
|
- lib/flit/cli.rb
|
49
49
|
- lib/flit/commands.rb
|
50
50
|
- lib/flit/help.rb
|
51
|
+
- lib/flit/hooks.rb
|
51
52
|
- lib/flit/version.rb
|
52
53
|
- lib/flit/commands/delete.rb
|
53
54
|
- lib/flit/commands/finish.rb
|
@@ -93,6 +94,6 @@ rubyforge_project:
|
|
93
94
|
rubygems_version: 1.3.7
|
94
95
|
signing_key:
|
95
96
|
specification_version: 3
|
96
|
-
summary:
|
97
|
+
summary: Git extension manager
|
97
98
|
test_files: []
|
98
99
|
|