Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 5 commits
  • 6 files changed
  • 0 comments
  • 1 contributor
1  Gemfile
... ...
@@ -1,5 +1,6 @@
1 1
 source 'http://rubygems.org'
2 2
 
  3
+gem 'rake'
3 4
 
4 5
 platform :ruby_19 do
5 6
   gem 'soap4r-ruby1.9'
2  Gemfile.lock
... ...
@@ -1,10 +1,12 @@
1 1
 GEM
2 2
   remote: http://rubygems.org/
3 3
   specs:
  4
+    rake (0.9.2.2)
4 5
     soap4r-ruby1.9 (2.0.3)
5 6
 
6 7
 PLATFORMS
7 8
   ruby
8 9
 
9 10
 DEPENDENCIES
  11
+  rake
10 12
   soap4r-ruby1.9
5  README.md
Source Rendered
... ...
@@ -1,8 +1,5 @@
1 1
 # Jira for Ruby
2 2
 
3  
-## Prerequisites 
4  
-SVN HEAD version of SOAP4R [http://dev.ctor.org/soap4r](http://dev.ctor.org/soap4r) is required.
5  
-
6 3
 ## Build
7 4
     gem build jira4r.gemspec
8 5
 
@@ -68,4 +65,4 @@ All Jira's SOAP APIs are exposed via Jira4R. In addtion, Jira4R exposes these me
68 65
 
69 66
 ## Some examples
70 67
 
71  
-[Code examples](http://svn.rubyhaus.org/jira4r/trunk/examples/)
  68
+To be checked in...
15  Rakefile
... ...
@@ -1,3 +1,18 @@
  1
+################################################################################
  2
+#  Copyright 2007 Ben Walding                                                  #
  3
+#                                                                              #
  4
+#  Licensed under the Apache License, Version 2.0 (the "License");             #
  5
+#  you may not use this file except in compliance with the License.            #
  6
+#  You may obtain a copy of the License at                                     #
  7
+#                                                                              #
  8
+#     http://www.apache.org/licenses/LICENSE-2.0                               #
  9
+#                                                                              #
  10
+#  Unless required by applicable law or agreed to in writing, software         #
  11
+#  distributed under the License is distributed on an "AS IS" BASIS,           #
  12
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.    #
  13
+#  See the License for the specific language governing permissions and         #
  14
+#  limitations under the License.                                              #
  15
+################################################################################
1 16
 require 'net/http'
2 17
 require 'fileutils'
3 18
 require 'rake/clean'
38  examples/example-utils.rb
... ...
@@ -0,0 +1,38 @@
  1
+################################################################################
  2
+#  Copyright 2006-2010 OpenXource Australia
  3
+#
  4
+#  Licensed under the Apache License, Version 2.0 (the "License");
  5
+#  you may not use this file except in compliance with the License.
  6
+#  You may obtain a copy of the License at
  7
+#
  8
+#     http://www.apache.org/licenses/LICENSE-2.0
  9
+#
  10
+#  Unless required by applicable law or agreed to in writing, software
  11
+#  distributed under the License is distributed on an "AS IS" BASIS,
  12
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13
+#  See the License for the specific language governing permissions and
  14
+#  limitations under the License.
  15
+################################################################################
  16
+
  17
+require 'yaml'
  18
+require 'lib/jira4r/jira_tool.rb'
  19
+
  20
+# YAML should look like
  21
+# url: http://jira4.atlassian.com
  22
+# username: mr_test
  23
+# password: mr_test99
  24
+def get_credentials(file)
  25
+  result = YAML.load_file(file)
  26
+  raise Exception "No JIRA URL defined (url)" unless result.has_key?('url')
  27
+  raise Exception "No JIRA username defined (username)" unless result.has_key?('url')
  28
+  raise Exception "No JIRA password defined (password)" unless result.has_key?('url')
  29
+  return result
  30
+end
  31
+
  32
+
  33
+def connect_to_jira(file)
  34
+  creds = get_credentials(file)
  35
+  jira = Jira4R::JiraTool.new(2, creds['url'])
  36
+  jira.login(creds['username'], creds['password'])
  37
+  return jira
  38
+end
54  examples/subtract-members
... ...
@@ -0,0 +1,54 @@
  1
+#!/usr/bin/env ruby
  2
+################################################################################
  3
+#  Copyright 2007 Codehaus Foundation                                          #
  4
+#                                                                              #
  5
+#  Licensed under the Apache License, Version 2.0 (the "License");             #
  6
+#  you may not use this file except in compliance with the License.            #
  7
+#  You may obtain a copy of the License at                                     #
  8
+#                                                                              #
  9
+#     http://www.apache.org/licenses/LICENSE-2.0                               #
  10
+#                                                                              #
  11
+#  Unless required by applicable law or agreed to in writing, software         #
  12
+#  distributed under the License is distributed on an "AS IS" BASIS,           #
  13
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.    #
  14
+#  See the License for the specific language governing permissions and         #
  15
+#  limitations under the License.                                              #
  16
+################################################################################
  17
+# This script is extremely useful for migrating users from one group to another
  18
+# where you don't want duplicates; i.e. creating an admin group which has a superset
  19
+# of the permission of the second group.
  20
+$: <<  'lib'
  21
+require 'jira4r/jira_tool.rb'
  22
+
  23
+# Will 
  24
+if ARGV.length != 5
  25
+  puts "Usage: subtract-members URL USER PASS GROUP-A GROUP-B"
  26
+  puts "       Removes all members from GROUP-A that are in GROUP-B"
  27
+  puts "       subtract-members http://jira.example.com jim password clown-developers clown-dev"
  28
+  exit 1
  29
+end
  30
+
  31
+url, username, password, group_a, group_b = ARGV
  32
+jira =  Jira4R::JiraTool.new(2, url)
  33
+jira.login(username, password)
  34
+
  35
+
  36
+jira_group_a = jira.getGroup(group_a)
  37
+jira_group_b = jira.getGroup(group_b)
  38
+
  39
+remote_users = {}
  40
+users_a = jira_group_a.users.collect { |u| 
  41
+  remote_users[u.name] = u
  42
+  u.name 
  43
+}
  44
+users_b = jira_group_b.users.collect { |u| 
  45
+  remote_users[u.name] = u
  46
+  u.name 
  47
+}
  48
+
  49
+for user in users_a
  50
+  if users_b.include?(user)
  51
+    puts "Removing #{user} from #{group_a}"
  52
+    jira.removeUserFromGroup(jira_group_a, remote_users[user])
  53
+  end
  54
+end

No commit comments for this range

Something went wrong with that request. Please try again.