atlassian-stash 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/README.md +37 -12
  2. data/VERSION +1 -1
  3. data/bin/stash +12 -7
  4. data/lib/atlassian/stash/git.rb +4 -0
  5. metadata +3 -3
data/README.md CHANGED
@@ -1,17 +1,42 @@
1
- Atlassian Stash CLI
2
- ===================
1
+ # Atlassian Stash Command Line Tools
3
2
 
3
+ ## Installing this tool
4
+ This command line helper for Stash is written in Ruby and is deployed as a [Ruby Gem](https://rubygems.org/gems/atlassian-stash/). Installation is easy, simply run the following command
4
5
 
5
- Build instructions
6
- ------------------
7
- 1. gem install bundler
8
- 2. bundle install
6
+ $> gem install atlassian-stash
9
7
 
10
- Configuration
11
- -------------
12
- 1. run `stash setup`
13
- 2. Setup a Git alias! ``git config --global alias.create-pull-request "stash pull-request \"\$0\""``
14
- 3. From your git repository, run `git create-pull-request master` to create a pull request from your current branch to master
8
+ (Protip: you might need to `sudo`)
9
+
10
+ Once the gem is installed, the command `stash` will be in your `$PATH`
11
+
12
+ ## Configuration and usage
13
+ Run `stash configure`. This will prompt for details about your Stash instance.
14
+
15
+ ### Creating a pull request
16
+ Use the `pull-request` command to create a pull request in Stash. E.g:
17
+
18
+ $> stash pull-request topicBranch master @michael
19
+ Create a pull request from branch 'topicBranch' into 'master' with 'michael' added as a reviewer
20
+
21
+ See the usage for command details
15
22
 
16
- See the usage help for more information by running
17
23
  stash help
24
+
25
+ ## Troubleshooting
26
+ Q: I installed the gem, but the `stash` command doesn't work.
27
+ A: Do you have another command called `stash` or do you have an alias? Have a look where the command maps to
28
+
29
+ $> which -a stash
30
+
31
+ Then check the value of your $PATH
32
+
33
+ ## I want to contribute
34
+ Thanks! Please [fork this project](https://bitbucket.org/atlassian/atlassian-stash-rubygem/fork) and create a pull request to submit changes back to the original project.
35
+
36
+ ### Build instructions
37
+ Building this gem is easy. To get started, run the following commands:
38
+
39
+ $> gem install bundler
40
+ $> bundler install
41
+
42
+ Now start hacking, and run the stash command by invoking `./bin/stash command`
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
data/bin/stash CHANGED
@@ -22,10 +22,8 @@ def load_config
22
22
  config
23
23
  end
24
24
 
25
- program :help_formatter, :compact
26
-
27
- command 'setup' do |c|
28
- c.syntax = 'setup'
25
+ command 'configure' do |c|
26
+ c.syntax = 'configure'
29
27
  c.description = 'Setup configuration details to your Stash instance'
30
28
  c.example 'stash setup --username sebr --password s3cre7 --stash_url http://stash.mycompany.com', 'Setup Stash CLI with credentials to the Stash server'
31
29
  c.option '--username user', String, 'Writes your Stash username to the configuration file'
@@ -47,6 +45,8 @@ command 'setup' do |c|
47
45
  end
48
46
 
49
47
  File.chmod 0600, $configFile
48
+
49
+ create_git_alias if agree "Create a git alias 'git create-pull-request'? "
50
50
  end
51
51
  end
52
52
 
@@ -57,12 +57,13 @@ command 'pull-request' do |c|
57
57
  }.compact
58
58
  end
59
59
 
60
- c.syntax = 'pull-request source target'
60
+ c.syntax = 'pull-request [sourceBranch] targetBranch [@reviewer1 @reviewer2]'
61
61
  c.description = 'Create a pull request in Stash'
62
- c.example 'stash pull-request topicBranch master', "Creates a pull request from branch 'topicBranch' into 'master'"
62
+ c.example 'stash pull-request topicBranch master @michael', "Create a pull request from branch 'topicBranch' into 'master' with 'michael' added as a reviewer"
63
+ c.example 'stash pull-request master', "Create a pull request from the current git branch into 'master'"
63
64
  c.action do |args, options|
64
65
  if args.length == 0
65
- command(:help).run(*args)
66
+ command(:help).run('pull-request')
66
67
  Process.exit
67
68
  end
68
69
 
@@ -84,5 +85,9 @@ command 'pull-request' do |c|
84
85
  end
85
86
 
86
87
  default_command :help
88
+ program :help_formatter, :compact
89
+ program :help, 'Authors', 'Seb Ruiz <sruiz@atlassian.com> with others'
90
+ program :help, 'Website', 'https://bitbucket.org/atlassian/atlassian-stash-rubygem'
91
+
87
92
 
88
93
  # vim set ft=ruby
@@ -22,6 +22,10 @@ module Atlassian
22
22
  raise "fatal: Not a git repository"
23
23
  end
24
24
  end
25
+
26
+ def create_git_alias
27
+ %x(git config --global alias.create-pull-request "\!sh -c 'stash pull-request \\$0'")
28
+ end
25
29
  end
26
30
  end
27
31
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 1
9
- version: 0.1.1
8
+ - 2
9
+ version: 0.1.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Seb Ruiz
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2012-10-26 00:00:00 +11:00
17
+ date: 2012-10-27 00:00:00 +11:00
18
18
  default_executable: stash
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency