jiveapps 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +11 -2
- data/app_generators/create/create_generator.rb +6 -0
- data/app_generators/create/templates/app.xml +10 -11
- data/app_generators/create/templates/hello.html +2 -3
- data/app_generators/create/templates/javascripts/main.js +1 -1
- data/jiveapps.gemspec +1 -0
- data/lib/jiveapps/command.rb +1 -0
- data/lib/jiveapps/commands/app.rb +15 -17
- data/lib/jiveapps/commands/help.rb +5 -2
- data/lib/jiveapps/commands/livedev.rb +41 -10
- data/lib/jiveapps/helpers.rb +12 -7
- data/lib/jiveapps/shell.rb +45 -0
- data/lib/jiveapps/version.rb +1 -1
- metadata +28 -11
data/History.txt
CHANGED
@@ -1,4 +1,13 @@
|
|
1
|
-
=== 1.0.
|
1
|
+
=== 1.0.5 2011-07-29
|
2
|
+
* Enhancements
|
3
|
+
* Update app template to use preferred height of 400 px on home view
|
4
|
+
* Don't run gadgets.window.adjustHeight onload by default, so 400 px height persists
|
5
|
+
* Escape HTML entities in ModulePref attributes to prevent invalid XML
|
6
|
+
* Detect if git errors occur during app creation or livedev, and display if so
|
7
|
+
* Bug Fixes:
|
8
|
+
* Fix example link tags for lifecycle events to have capital L
|
9
|
+
|
10
|
+
=== 1.0.4 2011-06-14
|
2
11
|
* Enhancements
|
3
12
|
* after app has been pushed to git remote, check for existence of web copy. if it does not exist, halt and delete app
|
4
13
|
* validate SSH key format before uploading. halt if its invalid, show user why and how to fix it
|
@@ -80,7 +89,7 @@
|
|
80
89
|
|
81
90
|
=== 0.0.7 2011-01-07
|
82
91
|
* Bug fixes
|
83
|
-
* If Git push fails, delete app and clean up.
|
92
|
+
* If Git push fails, delete app and clean up.
|
84
93
|
* Sync SSH key whenever creating a new app to avoid Git push failures.
|
85
94
|
* Require "fileutils" for older versions of ruby 1.8.6 that do not load it by default
|
86
95
|
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'cgi'
|
1
2
|
class CreateGenerator < RubiGen::Base
|
2
3
|
|
3
4
|
include Jiveapps::Helpers
|
@@ -50,6 +51,11 @@ class CreateGenerator < RubiGen::Base
|
|
50
51
|
end
|
51
52
|
end
|
52
53
|
|
54
|
+
# Escape HTML entities
|
55
|
+
def h(str)
|
56
|
+
CGI.escapeHTML(str)
|
57
|
+
end
|
58
|
+
|
53
59
|
protected
|
54
60
|
def banner
|
55
61
|
<<-EOS
|
@@ -1,11 +1,10 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
2
|
<Module specificationVersion="1">
|
3
|
-
<ModulePrefs title="<%= title %>"
|
4
|
-
description="<%= description %>"
|
5
|
-
author="<%= author_name %>"
|
6
|
-
author_affiliation="<%= author_affiliation %>"
|
7
|
-
author_email="<%= author_email %>"
|
8
|
-
height="300">
|
3
|
+
<ModulePrefs title="<%= h title %>"
|
4
|
+
description="<%= h description %>"
|
5
|
+
author="<%= h author_name %>"
|
6
|
+
author_affiliation="<%= h author_affiliation %>"
|
7
|
+
author_email="<%= h author_email %>">
|
9
8
|
|
10
9
|
<!-- Commonly used features -->
|
11
10
|
<Require feature="dynamic-height" />
|
@@ -42,8 +41,8 @@
|
|
42
41
|
|
43
42
|
<!-- Lifecycle Events: https://developers.jivesoftware.com/community/docs/DOC-1119 -->
|
44
43
|
<!--
|
45
|
-
<
|
46
|
-
<
|
44
|
+
<Link rel="event.addapp" href="http://www.example.com/add" />
|
45
|
+
<Link rel="event.removeapp" href="http://www.example.com/remove" />
|
47
46
|
-->
|
48
47
|
|
49
48
|
<!-- Preloaded Content: http://wiki.opensocial.org/index.php?title=Remote_Data_Requests_%28v0.9%29#Preloading_data -->
|
@@ -56,7 +55,7 @@
|
|
56
55
|
<!-- User Preferences: http://code.google.com/apis/gadgets/docs/reference.html#Userprefs_Ref -->
|
57
56
|
<!--
|
58
57
|
<UserPref name="where_i_live" display_name="Where I Live" datatype="string" default_value="" required="false" />
|
59
|
-
<UserPref name="subscribe_to_newsletter" display_name="Subscribe to Newsletter" datatype="bool"
|
58
|
+
<UserPref name="subscribe_to_newsletter" display_name="Subscribe to Newsletter" datatype="bool" default_value="" required="false" />
|
60
59
|
<UserPref name="difficulty"
|
61
60
|
display_name="Difficulty"
|
62
61
|
datatype="enum"
|
@@ -68,10 +67,10 @@
|
|
68
67
|
-->
|
69
68
|
|
70
69
|
<!-- To begin development, remove the hello view and uncomment the home and canvas views below -->
|
71
|
-
<Content type="html" view="home,canvas" href="hello.html" />
|
70
|
+
<Content type="html" view="home,canvas" href="hello.html" preferred_height="400" />
|
72
71
|
|
73
72
|
<!--
|
74
|
-
<Content type="html" view="home" href="home.html" />
|
73
|
+
<Content type="html" view="home" href="home.html" preferred_height="400" />
|
75
74
|
<Content type="html" view="canvas" href="canvas.html" />
|
76
75
|
-->
|
77
76
|
|
@@ -12,11 +12,10 @@
|
|
12
12
|
autoHeight: false,
|
13
13
|
navigation: true
|
14
14
|
});
|
15
|
-
gadgets.window.adjustHeight();
|
16
15
|
});
|
17
16
|
</script>
|
18
17
|
<style type="text/css" media="screen">
|
19
|
-
body {background: #fff; font-size:
|
18
|
+
body {background: #fff; font-size:80%;color:#333;font-family: arial, helvetica, sans-serif;}
|
20
19
|
#wrapper {width:350px;}
|
21
20
|
#wrapper div {padding:0;margin:0;}
|
22
21
|
#wrapper p {padding:0;margin:0;}
|
@@ -33,7 +32,7 @@
|
|
33
32
|
#devlinks div.documentation {padding:0;margin:0;background: url('images/icon48.png') no-repeat; background-position: 10px 2px ; height:70px;}
|
34
33
|
#devlinks div.login {padding:0;margin:0;background: url('images/icon48.png') no-repeat; background-position: 10px 2px ; height:70px;}
|
35
34
|
#devlinks div.market {padding:0;margin:0;background: url('images/icon48.png') no-repeat; background-position: 10px 2px ; height:70px;}
|
36
|
-
#devlinks div p {margin:
|
35
|
+
#devlinks div p {margin:0px 0px 0px 80px;}
|
37
36
|
#devlinks h3 a,a:hover {text-decoration:none;}
|
38
37
|
#devlinks ul {margin:5px 0px 0px 50px;}
|
39
38
|
#devlinks li a {font-size:95%;}
|
data/jiveapps.gemspec
CHANGED
@@ -39,6 +39,7 @@ Other features:
|
|
39
39
|
s.add_dependency 'directory_watcher', '1.3.2'
|
40
40
|
s.add_dependency 'rest-client', '1.6.1'
|
41
41
|
s.add_dependency 'rubigen', '1.5.5'
|
42
|
+
s.add_dependency 'systemu', '2.2.0'
|
42
43
|
|
43
44
|
s.add_development_dependency 'rspec', '>= 2.2.0'
|
44
45
|
s.add_development_dependency 'rcov', '>= 0.9.9'
|
data/lib/jiveapps/command.rb
CHANGED
@@ -47,7 +47,7 @@ module Jiveapps::Command
|
|
47
47
|
display "=== #{@appname} folder already exists."
|
48
48
|
else
|
49
49
|
display "=== Cloning #{@appname}..."
|
50
|
-
run("git clone #{app['git_url']} --origin jiveapps")
|
50
|
+
run("git clone #{app['git_url']} --origin jiveapps", :exec => true)
|
51
51
|
end
|
52
52
|
end
|
53
53
|
end
|
@@ -106,32 +106,30 @@ module Jiveapps::Command
|
|
106
106
|
return unless current_app
|
107
107
|
display "Step 3 of 4. Creating local Git repository and pushing to remote... ", false
|
108
108
|
|
109
|
+
result = nil
|
109
110
|
Dir.chdir(File.join(Dir.pwd, @appname)) do
|
110
|
-
|
111
|
-
run("git
|
112
|
-
run("git
|
113
|
-
run(
|
114
|
-
run("git
|
115
|
-
run("git push jiveapps master")
|
116
|
-
|
117
|
-
# configure master branch to track to remote branch.
|
118
|
-
# was using "git branch --set-upstream master jiveapps/master"
|
119
|
-
# but it is only supported in git 1.7 and higher
|
120
|
-
run("git config branch.master.remote jiveapps")
|
121
|
-
run("git config branch.master.merge refs/heads/master")
|
122
|
-
run("git config push.default tracking")
|
111
|
+
result = run("git init")
|
112
|
+
result = run("git add .") unless result.error?
|
113
|
+
result = run("git commit -m \"initial commit\"") unless result.error?
|
114
|
+
result = run("git remote add jiveapps #{current_app['git_url']}") unless result.error?
|
115
|
+
result = run("git push jiveapps master") unless result.error?
|
123
116
|
end
|
124
117
|
|
125
|
-
if
|
126
|
-
display "SUCCESS"
|
127
|
-
else
|
118
|
+
if result.error?
|
128
119
|
display "FAILURE"
|
120
|
+
display result.error
|
129
121
|
display_git_push_fail_info
|
130
122
|
delete_app
|
123
|
+
else
|
124
|
+
display "SUCCESS"
|
125
|
+
Dir.chdir(File.join(Dir.pwd, @appname)) do
|
126
|
+
run("git branch --set-upstream master jiveapps/master")
|
127
|
+
end
|
131
128
|
end
|
132
129
|
end
|
133
130
|
|
134
131
|
def check_app_push
|
132
|
+
return unless current_app
|
135
133
|
response_code = get_response_code(current_app['app_url'])
|
136
134
|
if response_code != 200
|
137
135
|
display_git_push_fail_info
|
@@ -15,8 +15,11 @@ module Jiveapps::Command
|
|
15
15
|
display "create <app_name> # create a new app"
|
16
16
|
display "clone <app_name> # clone the repository of an existing app"
|
17
17
|
display ""
|
18
|
-
display "
|
19
|
-
display "
|
18
|
+
display "=== App Specific Commands"
|
19
|
+
display " NOTE: run these within app directory, or pass app name with: --app <app_name>"
|
20
|
+
display ""
|
21
|
+
display "info # displays information about an app"
|
22
|
+
display "install # install an app on the sandbox (if you removed it, you can reinstall)"
|
20
23
|
display ""
|
21
24
|
display "keys # show your user\'s public keys"
|
22
25
|
display "keys:add [<path to keyfile>] # add a public key. optionally include path"
|
@@ -47,9 +47,7 @@ module Jiveapps::Command
|
|
47
47
|
display "\n\n\n=== Stopping LiveDev: #{app}"
|
48
48
|
|
49
49
|
# remove livedev run file if it exists
|
50
|
-
|
51
|
-
File.delete(".git/livedev")
|
52
|
-
end
|
50
|
+
remove_livedev_run_file
|
53
51
|
|
54
52
|
# switch server to run in normal mode
|
55
53
|
display "1/3: Switching the Jive App Sandbox to point to master branch."
|
@@ -98,6 +96,33 @@ module Jiveapps::Command
|
|
98
96
|
|
99
97
|
private
|
100
98
|
|
99
|
+
# This calls the normal Jiveapps::Helper run() method,
|
100
|
+
# detects if there is an error, and if there is, removes
|
101
|
+
# the livedev run/lock file and quits with an error.
|
102
|
+
def run(cmd)
|
103
|
+
result = super(cmd)
|
104
|
+
if result.error?
|
105
|
+
display "FAILURE"
|
106
|
+
display result.error
|
107
|
+
remove_livedev_run_file
|
108
|
+
exit 1
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
# Because STDIN.gets() blocks on Windows with the systemu library
|
113
|
+
# We use this inside the livedev listener loop instead of the normal
|
114
|
+
# run() which calls systemu(). Less error handling is possible.
|
115
|
+
def nonblock_run(command)
|
116
|
+
if debug_mode?
|
117
|
+
puts "DEBUG: $ #{command}"
|
118
|
+
`#{command}`
|
119
|
+
elsif running_on_windows?
|
120
|
+
`#{command} > NUL 2>&1`
|
121
|
+
else
|
122
|
+
`#{command} > /dev/null 2>&1` # silent
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
101
126
|
def livedev_branch_name
|
102
127
|
"livedev/#{jiveapps.user}"
|
103
128
|
end
|
@@ -167,22 +192,22 @@ module Jiveapps::Command
|
|
167
192
|
def watch_dir_and_commit_changes
|
168
193
|
@dw = DirectoryWatcher.new '.', :glob => '**/*', :pre_load => true
|
169
194
|
@dw.interval = 1
|
170
|
-
@dw.add_observer do |*args|
|
195
|
+
@dw.add_observer do |*args|
|
171
196
|
verify_livedev_branch
|
172
197
|
|
173
|
-
changes =
|
198
|
+
changes = []
|
174
199
|
args.each do |event|
|
175
200
|
if event.type == :added || event.type == :modified
|
176
|
-
|
201
|
+
nonblock_run("git add #{event.path}")
|
177
202
|
elsif event.type == :removed
|
178
|
-
|
203
|
+
nonblock_run("git rm #{event.path}")
|
179
204
|
end
|
180
205
|
display " - [#{Time.now.strftime("%Y-%m-%d %T")}] LiveDev: #{event.type} #{event.path}"
|
181
|
-
changes << "
|
206
|
+
changes << "#{event.type} '#{event.path}'"
|
182
207
|
end
|
183
208
|
|
184
|
-
|
185
|
-
|
209
|
+
nonblock_run("git commit -m \"LiveDev Changes: #{changes.join(', ')}\"")
|
210
|
+
nonblock_run("git push -f jiveapps #{livedev_branch_name}")
|
186
211
|
end
|
187
212
|
|
188
213
|
@dw.start
|
@@ -219,6 +244,12 @@ module Jiveapps::Command
|
|
219
244
|
end
|
220
245
|
end
|
221
246
|
|
247
|
+
def remove_livedev_run_file
|
248
|
+
if File.exist?(".git/livedev")
|
249
|
+
File.delete(".git/livedev")
|
250
|
+
end
|
251
|
+
end
|
252
|
+
|
222
253
|
end
|
223
254
|
|
224
255
|
end
|
data/lib/jiveapps/helpers.rb
CHANGED
@@ -74,17 +74,22 @@ module Jiveapps
|
|
74
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
75
|
end
|
76
76
|
|
77
|
-
def run(command)
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
77
|
+
def run(command, options={})
|
78
|
+
options[:exec] ||= false
|
79
|
+
|
80
|
+
puts "DEBUG: $ #{command}" if debug_mode?
|
81
|
+
|
82
|
+
if options[:exec] == true
|
83
|
+
exec command
|
83
84
|
else
|
84
|
-
|
85
|
+
sh(command)
|
85
86
|
end
|
86
87
|
end
|
87
88
|
|
89
|
+
def sh(command)
|
90
|
+
Shell.new(command).run
|
91
|
+
end
|
92
|
+
|
88
93
|
def debug_mode?
|
89
94
|
return @debug_mode if @debug_mode.nil? == false
|
90
95
|
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# Originally taken (and modified) from GitHub-Gem: https://github.com/defunkt/github-gem/blob/master/lib/github/command.rb
|
2
|
+
|
3
|
+
require 'systemu'
|
4
|
+
|
5
|
+
module Jiveapps
|
6
|
+
class Shell < String
|
7
|
+
attr_reader :error
|
8
|
+
attr_reader :out
|
9
|
+
attr_reader :exit_status
|
10
|
+
|
11
|
+
def initialize(command)
|
12
|
+
@command = command
|
13
|
+
end
|
14
|
+
|
15
|
+
def run
|
16
|
+
out = err = nil
|
17
|
+
|
18
|
+
begin
|
19
|
+
status, out, err = systemu(@command)
|
20
|
+
rescue => e
|
21
|
+
puts e.inspect
|
22
|
+
end
|
23
|
+
|
24
|
+
@exit_status = status.exitstatus
|
25
|
+
|
26
|
+
replace @error = err unless err.empty?
|
27
|
+
replace @out = out unless out.empty?
|
28
|
+
|
29
|
+
self
|
30
|
+
end
|
31
|
+
|
32
|
+
def command
|
33
|
+
@command.join(' ')
|
34
|
+
end
|
35
|
+
|
36
|
+
def error?
|
37
|
+
@exit_status != 0
|
38
|
+
end
|
39
|
+
|
40
|
+
def out?
|
41
|
+
!!@out
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
data/lib/jiveapps/version.rb
CHANGED
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: 29
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 5
|
10
|
+
version: 1.0.5
|
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-
|
18
|
+
date: 2011-08-01 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -83,9 +83,25 @@ dependencies:
|
|
83
83
|
type: :runtime
|
84
84
|
version_requirements: *id004
|
85
85
|
- !ruby/object:Gem::Dependency
|
86
|
-
name:
|
86
|
+
name: systemu
|
87
87
|
prerelease: false
|
88
88
|
requirement: &id005 !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - "="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
hash: 7
|
94
|
+
segments:
|
95
|
+
- 2
|
96
|
+
- 2
|
97
|
+
- 0
|
98
|
+
version: 2.2.0
|
99
|
+
type: :runtime
|
100
|
+
version_requirements: *id005
|
101
|
+
- !ruby/object:Gem::Dependency
|
102
|
+
name: rspec
|
103
|
+
prerelease: false
|
104
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
89
105
|
none: false
|
90
106
|
requirements:
|
91
107
|
- - ">="
|
@@ -97,11 +113,11 @@ dependencies:
|
|
97
113
|
- 0
|
98
114
|
version: 2.2.0
|
99
115
|
type: :development
|
100
|
-
version_requirements: *
|
116
|
+
version_requirements: *id006
|
101
117
|
- !ruby/object:Gem::Dependency
|
102
118
|
name: rcov
|
103
119
|
prerelease: false
|
104
|
-
requirement: &
|
120
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
105
121
|
none: false
|
106
122
|
requirements:
|
107
123
|
- - ">="
|
@@ -113,11 +129,11 @@ dependencies:
|
|
113
129
|
- 9
|
114
130
|
version: 0.9.9
|
115
131
|
type: :development
|
116
|
-
version_requirements: *
|
132
|
+
version_requirements: *id007
|
117
133
|
- !ruby/object:Gem::Dependency
|
118
134
|
name: webmock
|
119
135
|
prerelease: false
|
120
|
-
requirement: &
|
136
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
121
137
|
none: false
|
122
138
|
requirements:
|
123
139
|
- - ">="
|
@@ -129,7 +145,7 @@ dependencies:
|
|
129
145
|
- 1
|
130
146
|
version: 1.6.1
|
131
147
|
type: :development
|
132
|
-
version_requirements: *
|
148
|
+
version_requirements: *id008
|
133
149
|
description: |+
|
134
150
|
== Jiveapps
|
135
151
|
|
@@ -197,6 +213,7 @@ files:
|
|
197
213
|
- lib/jiveapps/commands/oauth.rb
|
198
214
|
- lib/jiveapps/commands/sharing.rb
|
199
215
|
- lib/jiveapps/helpers.rb
|
216
|
+
- lib/jiveapps/shell.rb
|
200
217
|
- lib/jiveapps/version.rb
|
201
218
|
- spec/client_spec.rb
|
202
219
|
- spec/commands/app_spec.rb
|
@@ -237,7 +254,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
237
254
|
requirements: []
|
238
255
|
|
239
256
|
rubyforge_project:
|
240
|
-
rubygems_version: 1.3.9.
|
257
|
+
rubygems_version: 1.3.9.2
|
241
258
|
signing_key:
|
242
259
|
specification_version: 3
|
243
260
|
summary: The "jiveapps" gem is a set of command line tools for building and hosting Jive App front-ends.
|