jiveapps 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/History.txt +5 -0
- data/lib/jiveapps/commands/app.rb +30 -13
- data/lib/jiveapps/commands/help.rb +2 -0
- data/lib/jiveapps/commands/oauth.rb +14 -21
- data/lib/jiveapps/commands/sharing.rb +12 -11
- data/lib/jiveapps/helpers.rb +11 -0
- data/lib/jiveapps/version.rb +1 -1
- data/spec/commands/sharing_spec.rb +3 -6
- metadata +4 -4
data/Gemfile.lock
CHANGED
data/History.txt
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
=== 0.1.1 2011-02-21
|
2
|
+
* Major enhancements
|
3
|
+
* "jiveapps clone <appname>" command, shortcut for git clone command for jive apps
|
4
|
+
* Better user feedback for usage output and argument for oauth and sharing commands
|
5
|
+
|
1
6
|
=== 0.1.0 2011-02-16
|
2
7
|
* Major enhancements
|
3
8
|
* Multi Developer Collaboration features. Added jiveapps sharing:list, sharing:add, and sharing:remove commands.
|
@@ -34,12 +34,33 @@ module Jiveapps::Command
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
+
def clone
|
38
|
+
usage "jiveapps clone <appname>"
|
39
|
+
catch_args :appname
|
40
|
+
|
41
|
+
app = jiveapps.info(@appname)
|
42
|
+
if app == nil
|
43
|
+
display "=== App not found."
|
44
|
+
else
|
45
|
+
# if dir already exists, output message and stop
|
46
|
+
if File.exists?(@appname) && File.directory?(@appname)
|
47
|
+
display "=== #{@appname} folder already exists."
|
48
|
+
else
|
49
|
+
display "=== Cloning #{@appname}..."
|
50
|
+
`git clone #{app['git_url']} --origin jiveapps`
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
37
55
|
def create
|
56
|
+
usage = "\n Usage:\n $ jiveapps create <appname>"
|
57
|
+
catch_args :appname
|
58
|
+
|
38
59
|
debug "Running in debug mode."
|
39
60
|
app_list = Jiveapps::Command.run_internal('auth:check', []) # check auth credentials and ssh key before generating app
|
40
61
|
return unless app_list.class == Array
|
41
62
|
Jiveapps::Command.run_internal('keys:add', [])
|
42
|
-
display "Creating new Jive App \"#{
|
63
|
+
display "=== Creating new Jive App \"#{@appname}\"..."
|
43
64
|
create_remote_app
|
44
65
|
generate_app
|
45
66
|
create_local_git_repo_and_push_to_remote
|
@@ -49,7 +70,7 @@ module Jiveapps::Command
|
|
49
70
|
|
50
71
|
def install
|
51
72
|
name = (args.first && !args.first =~ /^\-\-/) ? args.first : extract_app
|
52
|
-
display "Installing \"#{name}\" on the Jive App Sandbox: ", false
|
73
|
+
display "=== Installing \"#{name}\" on the Jive App Sandbox: ", false
|
53
74
|
app = jiveapps.install(name)
|
54
75
|
handle_response_errors
|
55
76
|
if app == nil
|
@@ -75,7 +96,7 @@ module Jiveapps::Command
|
|
75
96
|
|
76
97
|
def create_remote_app
|
77
98
|
display "Step 1 of 4. Check availability and create remote repository: ", false
|
78
|
-
@current_app = jiveapps.create(
|
99
|
+
@current_app = jiveapps.create(@appname)
|
79
100
|
handle_response_errors
|
80
101
|
end
|
81
102
|
|
@@ -87,14 +108,14 @@ module Jiveapps::Command
|
|
87
108
|
require 'rubigen'
|
88
109
|
require 'rubigen/scripts/generate'
|
89
110
|
RubiGen::Base.use_application_sources!
|
90
|
-
RubiGen::Scripts::Generate.new.run(@
|
111
|
+
RubiGen::Scripts::Generate.new.run([@appname], :generator => 'create')
|
91
112
|
end
|
92
113
|
|
93
114
|
def create_local_git_repo_and_push_to_remote
|
94
115
|
return unless current_app
|
95
116
|
display "Step 3 of 4. Creating local Git repository and push to remote: ", false
|
96
117
|
|
97
|
-
Dir.chdir(File.join(Dir.pwd,
|
118
|
+
Dir.chdir(File.join(Dir.pwd, @appname)) do
|
98
119
|
|
99
120
|
run("git init")
|
100
121
|
run("git add .")
|
@@ -111,7 +132,7 @@ module Jiveapps::Command
|
|
111
132
|
"$ jiveapps keys:list\n" +
|
112
133
|
"$ jiveapps keys:remove <user@machine>\n" +
|
113
134
|
"$ jiveapps keys:add\n" +
|
114
|
-
"$ jiveapps create #{
|
135
|
+
"$ jiveapps create #{@appname}"
|
115
136
|
delete_app
|
116
137
|
end
|
117
138
|
end
|
@@ -120,13 +141,13 @@ module Jiveapps::Command
|
|
120
141
|
return unless current_app
|
121
142
|
display "Step 4 of 4. Registering app on the Jive Apps Dev Center and installing on sandbox: ", false
|
122
143
|
|
123
|
-
@current_app = jiveapps.register(
|
144
|
+
@current_app = jiveapps.register(@appname)
|
124
145
|
handle_response_errors
|
125
146
|
end
|
126
147
|
|
127
148
|
def delete_app
|
128
|
-
run("rm -rf #{
|
129
|
-
jiveapps.delete_app(
|
149
|
+
run("rm -rf #{@appname}")
|
150
|
+
jiveapps.delete_app(@appname)
|
130
151
|
@current_app = nil # halt further actions
|
131
152
|
end
|
132
153
|
|
@@ -155,10 +176,6 @@ module Jiveapps::Command
|
|
155
176
|
end
|
156
177
|
end
|
157
178
|
|
158
|
-
def app_name
|
159
|
-
args.first
|
160
|
-
end
|
161
|
-
|
162
179
|
def run(command)
|
163
180
|
if debug_mode?
|
164
181
|
puts "DEBUG: $ #{command}"
|
@@ -13,6 +13,8 @@ help # show this usage
|
|
13
13
|
|
14
14
|
list # list your apps
|
15
15
|
create <app_name> # create a new app
|
16
|
+
clone <app_name> # clone the repository of an existing app
|
17
|
+
|
16
18
|
info [--app <app_name>] # displays information about an app
|
17
19
|
install [--app <app_name>] # install an app on the sandbox (if you removed it, you can reinstall)
|
18
20
|
|
@@ -1,39 +1,32 @@
|
|
1
1
|
module Jiveapps::Command
|
2
|
-
class Oauth <
|
2
|
+
class Oauth < BaseWithApp
|
3
3
|
|
4
4
|
# Lists OAuth Services registered for this app
|
5
5
|
def list
|
6
|
-
|
7
|
-
|
8
|
-
oauth_services = jiveapps.oauth_services(app_name)
|
9
|
-
display_oauth_services(oauth_services, app_name)
|
6
|
+
oauth_services = jiveapps.oauth_services(app)
|
7
|
+
display_oauth_services(oauth_services, app)
|
10
8
|
end
|
11
9
|
alias :index :list
|
12
10
|
|
13
11
|
# Register a new OAuth Service for use with this app
|
14
12
|
def add
|
15
|
-
usage
|
16
|
-
|
17
|
-
raise CommandFailed, "Missing 3 parameters: <servicename>, <key>, and <secret>#{usage}" unless servicename = args.shift
|
18
|
-
raise CommandFailed, "Missing 2 parameters: <key> and <secret>#{usage}" unless key = args.shift
|
19
|
-
raise CommandFailed, "Missing 1 parameter: <secret>#{usage}" unless secret = args.shift
|
13
|
+
usage "jiveapps oauth:add <servicename> <key> <secret>"
|
14
|
+
catch_args :servicename, :key, :secret
|
20
15
|
|
21
|
-
display "=== Registering a new OAuth Service: \"#{servicename}\""
|
22
|
-
response = jiveapps.add_oauth_service(
|
23
|
-
Jiveapps::Command.run_internal('oauth:list', ["--app",
|
16
|
+
display "=== Registering a new OAuth Service: \"#{@servicename}\""
|
17
|
+
response = jiveapps.add_oauth_service(app, @servicename, @key, @secret)
|
18
|
+
Jiveapps::Command.run_internal('oauth:list', ["--app", app])
|
24
19
|
end
|
25
20
|
|
26
21
|
# Remove an OAuth Service
|
27
22
|
def remove
|
28
|
-
usage
|
29
|
-
|
30
|
-
raise CommandFailed, "Missing 1 parameter: <servicename>#{usage}" unless servicename = args.shift
|
23
|
+
usage "jiveapps oauth:remove <servicename>"
|
24
|
+
catch_args :servicename
|
31
25
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
end
|
26
|
+
return unless confirm "Are you sure you wish to remove the OAuth service \"#{@servicename}\"? (y/n)?"
|
27
|
+
display "=== Removing Oauth Service \"#{@servicename}\""
|
28
|
+
response = jiveapps.remove_oauth_service(app, @servicename)
|
29
|
+
Jiveapps::Command.run_internal('oauth:list', ["--app", app])
|
37
30
|
end
|
38
31
|
|
39
32
|
end
|
@@ -6,21 +6,22 @@ module Jiveapps::Command
|
|
6
6
|
alias :index :list
|
7
7
|
|
8
8
|
def add
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
usage "jiveapps sharing:add <username>"
|
10
|
+
catch_args :username
|
11
|
+
|
12
|
+
display "=== Adding commit access to #{app} for \"#{@username}\""
|
13
|
+
jiveapps.add_collaborator(app, @username)
|
13
14
|
display_collaborators
|
14
15
|
end
|
15
16
|
|
16
17
|
def remove
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
18
|
+
usage "jiveapps sharing:remove <username>"
|
19
|
+
catch_args :username
|
20
|
+
|
21
|
+
return unless confirm("Are you sure you wish to remove commit access to #{app} for \"#{@username}\"? (y/n)?")
|
22
|
+
display "=== Removing commit access to #{app} for \"#{@username}\""
|
23
|
+
jiveapps.remove_collaborator(app, @username)
|
24
|
+
display_collaborators
|
24
25
|
end
|
25
26
|
|
26
27
|
def display_collaborators
|
data/lib/jiveapps/helpers.rb
CHANGED
@@ -63,6 +63,17 @@ module Jiveapps
|
|
63
63
|
gets.strip
|
64
64
|
end
|
65
65
|
|
66
|
+
def usage(text)
|
67
|
+
@usage = "\n Usage:\n $ #{text}"
|
68
|
+
end
|
69
|
+
|
70
|
+
def catch_args(*list)
|
71
|
+
while current_arg = args.shift
|
72
|
+
instance_variable_set "@#{list.shift}", current_arg
|
73
|
+
end
|
74
|
+
raise Jiveapps::Command::CommandFailed, "Missing #{list.length} parameter#{list.length > 1 ? 's' : ''}: #{list.map{|l| '<' + l.to_s + '>'}.join(' ')}#{@usage}" if list.length > 0
|
75
|
+
end
|
76
|
+
|
66
77
|
# Display Oauth Service list
|
67
78
|
# Example Output:
|
68
79
|
# === 2 OAuth services for app-name
|
data/lib/jiveapps/version.rb
CHANGED
@@ -14,19 +14,16 @@ module Jiveapps::Command
|
|
14
14
|
it "adds collaborators with default access to view only" do
|
15
15
|
@cli.stub!(:args).and_return(['joe_coworker'])
|
16
16
|
@cli.jiveapps.should_receive(:add_collaborator).with('myapp', 'joe_coworker')
|
17
|
+
@cli.jiveapps.should_receive(:list_collaborators).and_return([])
|
17
18
|
@cli.add
|
18
19
|
end
|
19
20
|
|
20
21
|
it "removes collaborators" do
|
21
22
|
@cli.stub!(:args).and_return(['joe_coworker'])
|
23
|
+
@cli.stub!(:confirm).and_return(true)
|
22
24
|
@cli.jiveapps.should_receive(:remove_collaborator).with('myapp', 'joe_coworker')
|
25
|
+
@cli.jiveapps.should_receive(:list_collaborators).and_return([])
|
23
26
|
@cli.remove
|
24
27
|
end
|
25
|
-
|
26
|
-
# it "transfers ownership" do
|
27
|
-
# @cli.stub!(:args).and_return(['joe_coworker'])
|
28
|
-
# @cli.jiveapps.should_receive(:update).with('myapp', :transfer_owner => 'joe_coworker')
|
29
|
-
# @cli.transfer
|
30
|
-
# end
|
31
28
|
end
|
32
29
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jiveapps
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Scott Becker
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-02-
|
18
|
+
date: 2011-02-21 00:00:00 -08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|