fxos 0.0.1
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 +7 -0
- data/README.md +37 -0
- data/bin/fxos +9 -0
- data/fxos.gemspec +21 -0
- data/lib/fxos/fxos.rb +96 -0
- metadata +50 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: bd3a20dc5d73aa0035e7b85ad97c02412b10d2bb
|
|
4
|
+
data.tar.gz: e8136b9940030e9542b2ada38edf8eaa277f9994
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 76bced56500b8beb75e4c1a049fb5073e0442273aa3d0344d0115ba3d9c85d25ac1d852b46c82afdd6eb22cf133670fd86b78b83fd0622dcf553b1ac2ba59984
|
|
7
|
+
data.tar.gz: 4bb8e4df19039a21b8f4ac896f3b37cc957b21c0e3f2310fc95a605848377277d2bc1aecd7aed8b1fb81092298fc5dd9f6a83ddfd8c1578b9ff488005fe14299
|
data/README.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# FxOS
|
|
2
|
+
The basic purpose is to provide some simple automations based upon common Git workflows
|
|
3
|
+
|
|
4
|
+
## Usage
|
|
5
|
+
|
|
6
|
+
Switch branches. If no branch is provided it will default to 'master'. If the provided branch does not exist, it is created.
|
|
7
|
+
```
|
|
8
|
+
$ fxos switch [branch]
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Rebase branch with in base of other branch. **DO NOT USE THIS FUNCTION, IS NOT COMPLETE**
|
|
12
|
+
```
|
|
13
|
+
$ fxos rebase [branch1] [branch2]
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Push all the commits in your current branch to remote.
|
|
17
|
+
```
|
|
18
|
+
$ fxos push
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Update your from with original repo code.
|
|
22
|
+
```
|
|
23
|
+
$ fxos fork [branch]
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Commit all the changes on your branch with a message.
|
|
27
|
+
```
|
|
28
|
+
$ fxos commit ['message']
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Squash in one commit all the commits you want.
|
|
32
|
+
```
|
|
33
|
+
$ fxos squash [number-of-commits]
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## License
|
|
37
|
+
This tool is licensed under MIT terms.
|
data/bin/fxos
ADDED
data/fxos.gemspec
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Gem::Specification.new do |s|
|
|
2
|
+
s.name = 'fxos'
|
|
3
|
+
s.version = '0.0.1'
|
|
4
|
+
s.summary = "Git workflow tool for Firefox OS developers"
|
|
5
|
+
s.description = "This Ruby gem will help to focus on code and let new contributors don't get confused with git process at contribution time."
|
|
6
|
+
s.authors = ["Giovanny Andres Gongora Granada"]
|
|
7
|
+
s.licenses = ['MIT']
|
|
8
|
+
s.email = "gioyik@gmail.com"
|
|
9
|
+
s.homepage = "http://github.com/Gioyik/fxos/"
|
|
10
|
+
|
|
11
|
+
s.files = %w[
|
|
12
|
+
README.md
|
|
13
|
+
fxos.gemspec
|
|
14
|
+
bin/fxos
|
|
15
|
+
lib/fxos/fxos.rb
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
s.executables = ['fxos']
|
|
19
|
+
s.extra_rdoc_files = %w[README.md]
|
|
20
|
+
s.require_paths = %w[lib]
|
|
21
|
+
end
|
data/lib/fxos/fxos.rb
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
require 'optparse'
|
|
2
|
+
|
|
3
|
+
class FxOS
|
|
4
|
+
|
|
5
|
+
# init
|
|
6
|
+
def initialize(args, stdin)
|
|
7
|
+
parse_commands(args)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
private
|
|
11
|
+
|
|
12
|
+
def parse_commands(args)
|
|
13
|
+
@commands = {}
|
|
14
|
+
display_usage("#!Error: No commands") if args.size == 0
|
|
15
|
+
args.each do |arg|
|
|
16
|
+
case arg
|
|
17
|
+
when "switch"
|
|
18
|
+
# branch -> is the branch to switch
|
|
19
|
+
branch = args[1] ? args[1] : 'master'
|
|
20
|
+
# branches -> list of branches to check if is listed or not
|
|
21
|
+
branches = `git branch`.split
|
|
22
|
+
if branches.include? branch
|
|
23
|
+
# If exist
|
|
24
|
+
`git checkout #{branch}`
|
|
25
|
+
else
|
|
26
|
+
# Not exists, so create it
|
|
27
|
+
`git checkout -b #{branch}`
|
|
28
|
+
end
|
|
29
|
+
break
|
|
30
|
+
when "rebase"
|
|
31
|
+
# branchs to rebase [not upstream]
|
|
32
|
+
branch1 = args[1]
|
|
33
|
+
branch1 = args[2]
|
|
34
|
+
# rebase work
|
|
35
|
+
# Not sure if this will work or is the correct
|
|
36
|
+
# way to do it. DO NOT USE IT
|
|
37
|
+
`git rebase #{branch1} #{branch2}`
|
|
38
|
+
break
|
|
39
|
+
when "fork"
|
|
40
|
+
# branch -> the branch you want to update
|
|
41
|
+
# at your fork
|
|
42
|
+
branch = args[1] ? args[1] : 'master'
|
|
43
|
+
# this is the way I do it, but needs to be
|
|
44
|
+
# extended to all the user cases. DO NOT USE IT
|
|
45
|
+
`git pull --rebase upstream #{branch}`
|
|
46
|
+
`git push origin -f #{@current}`
|
|
47
|
+
break
|
|
48
|
+
when "commit"
|
|
49
|
+
# here we need find the way to get the text
|
|
50
|
+
# inside "". DO NOT USE IT
|
|
51
|
+
message = args[1]
|
|
52
|
+
# let's include everything that changed in the
|
|
53
|
+
# commit
|
|
54
|
+
`git add --all`
|
|
55
|
+
`git commit -m "#{message}"`
|
|
56
|
+
break
|
|
57
|
+
when "squash"
|
|
58
|
+
# we squash in base of commits on current branch
|
|
59
|
+
commits = args[1] ? args[1] : ''
|
|
60
|
+
if commits == ''
|
|
61
|
+
display_usage("#!Error: You must set a number higher than 0")
|
|
62
|
+
break
|
|
63
|
+
end
|
|
64
|
+
`git rebase -i HEAD~#{commits}`
|
|
65
|
+
break
|
|
66
|
+
when "push"
|
|
67
|
+
set_current_branch
|
|
68
|
+
# push everything on current branch. Do you
|
|
69
|
+
# want to push commits from other branch?
|
|
70
|
+
# use 'switch' first.
|
|
71
|
+
`git push origin #{@current}`
|
|
72
|
+
break
|
|
73
|
+
else
|
|
74
|
+
display_usage("#!Error: Uknown command")
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# this piece of code is the most important
|
|
80
|
+
def set_current_branch
|
|
81
|
+
@current ||= `git branch | grep "*" | awk '{print $2}'`.strip
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def display_usage(msg=nil)
|
|
86
|
+
puts "#{msg}\n\n" unless msg.nil?
|
|
87
|
+
puts "Usage:\n\n"
|
|
88
|
+
puts "fxos switch [branch] :Change to [branch]. If not exists it will be created.\n"
|
|
89
|
+
puts "fxos rebase [branch1] [branch2] :Rebase branch with in base of other branch.\n"
|
|
90
|
+
puts "fxos fork [branch] :Update your from with original repo code.\n"
|
|
91
|
+
puts "fxos commit ['message'] :Commit all the changes on your branch with a message.\n"
|
|
92
|
+
puts "fxos squash [number-of-commits] :Squash in one commit all the commits you want\n"
|
|
93
|
+
puts "fxos push :Push all the commits in your current branch to remote.\n"
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
|
metadata
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: fxos
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Giovanny Andres Gongora Granada
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2015-01-18 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: This Ruby gem will help to focus on code and let new contributors don't
|
|
14
|
+
get confused with git process at contribution time.
|
|
15
|
+
email: gioyik@gmail.com
|
|
16
|
+
executables:
|
|
17
|
+
- fxos
|
|
18
|
+
extensions: []
|
|
19
|
+
extra_rdoc_files:
|
|
20
|
+
- README.md
|
|
21
|
+
files:
|
|
22
|
+
- README.md
|
|
23
|
+
- bin/fxos
|
|
24
|
+
- fxos.gemspec
|
|
25
|
+
- lib/fxos/fxos.rb
|
|
26
|
+
homepage: http://github.com/Gioyik/fxos/
|
|
27
|
+
licenses:
|
|
28
|
+
- MIT
|
|
29
|
+
metadata: {}
|
|
30
|
+
post_install_message:
|
|
31
|
+
rdoc_options: []
|
|
32
|
+
require_paths:
|
|
33
|
+
- lib
|
|
34
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
35
|
+
requirements:
|
|
36
|
+
- - ">="
|
|
37
|
+
- !ruby/object:Gem::Version
|
|
38
|
+
version: '0'
|
|
39
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
40
|
+
requirements:
|
|
41
|
+
- - ">="
|
|
42
|
+
- !ruby/object:Gem::Version
|
|
43
|
+
version: '0'
|
|
44
|
+
requirements: []
|
|
45
|
+
rubyforge_project:
|
|
46
|
+
rubygems_version: 2.4.2
|
|
47
|
+
signing_key:
|
|
48
|
+
specification_version: 4
|
|
49
|
+
summary: Git workflow tool for Firefox OS developers
|
|
50
|
+
test_files: []
|