fredit 0.0.6 → 0.0.9

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.
data/README.md CHANGED
@@ -59,9 +59,7 @@ application without the hassles of having to set up and run a local
59
59
  instance of it on their computer. Just run a `fredit`-enabled instance of
60
60
  your Rails app on a server that your collaborator can access through his
61
61
  or her browser. This `fredit`-enabled instance can have its own Rails
62
- environment, database, and git branch. You can add an authentication
63
- gateway and even run the instance as a special chrooted user if you want
64
- to make the sandbox more secure.
62
+ environment, database, and git branch.
65
63
 
66
64
 
67
65
  ## Install and setup
@@ -1,3 +1,5 @@
1
+ require 'shellwords'
2
+
1
3
  class FreditController < ::ApplicationController
2
4
 
3
5
  layout false
@@ -16,9 +18,10 @@ class FreditController < ::ApplicationController
16
18
  def update
17
19
  @path = secure_path params[:file_path]
18
20
 
19
- edit_msg = !params[:edit_message].blank? ? params[:edit_message] : "unspecified edit"
21
+ edit_msg = !params[:edit_message].blank? ? Shellwords.shellescape(params[:edit_message].gsub('"', '')) : "unspecified edit"
20
22
 
21
- author = (session[:commit_author] = params[:commit_author])
23
+ session[:commit_author] = (params[:commit_author] || '').gsub(/['"]/, '')
24
+ author = session[:commit_author]
22
25
  if session[:commit_author].blank?
23
26
  flash.now[:notice] = "Edited By must not be blank"
24
27
  @source = params[:source]
@@ -29,14 +32,17 @@ class FreditController < ::ApplicationController
29
32
  if params[:commit] =~ /delete/i
30
33
  `git rm #@path`
31
34
  flash[:notice] = "#@path deleted"
32
- `git commit --author="#{author}" -m "#{edit_msg}" #{@path}`
35
+ res = system %Q|git commit --author="#{author}" -m "#{edit_msg}" #{@path}|
33
36
  @path = nil
34
37
  else
35
38
  n = params[:source].gsub(/\r\n/, "\n")
36
39
  File.open(@path, 'w') {|f| f.write(n)}
37
- `git add #{@path}`
40
+ system %Q|git add #{@path}|
38
41
  flash[:notice] = "#@path updated"
39
- `git commit --author="#{author}" -m "#{edit_msg}" #{@path}`
42
+ res = system %Q|git commit --author="#{author}" -m "#{edit_msg}" #{@path}|
43
+ end
44
+ if res == false
45
+ flash[:notice] = "Something went wrong with git. Make sure you changed something and filled in required fields."
40
46
  end
41
47
  params.delete(:source)
42
48
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fredit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -43,7 +43,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
43
43
  version: '0'
44
44
  segments:
45
45
  - 0
46
- hash: -244463729
46
+ hash: 234921565
47
47
  required_rubygems_version: !ruby/object:Gem::Requirement
48
48
  none: false
49
49
  requirements:
@@ -52,11 +52,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
52
52
  version: '0'
53
53
  segments:
54
54
  - 0
55
- hash: -244463729
55
+ hash: 234921565
56
56
  requirements: []
57
57
  rubyforge_project:
58
58
  rubygems_version: 1.8.11
59
59
  signing_key:
60
60
  specification_version: 3
61
- summary: fredit 0.0.6
61
+ summary: fredit 0.0.9
62
62
  test_files: []