fredit 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,62 @@
1
+ # fredit: front-end edit
2
+
3
+ fredit is a simple, no-frills Rails Engine that lets you edit your Rails
4
+ application's view templates, css stylesheets, and javascript files
5
+ (a.k.a front-end files) through the browser.
6
+
7
+ fredit injects an edit link into every view template. These edit links
8
+ are visible wherever the template is rendered, whether it is a layout,
9
+ a page, or a partial.
10
+
11
+ By clicking on these links, you call up a edit page that will let you
12
+ directly edit the source, whether it is ERB, css, or javascript. An
13
+ update button lets you save these changes and alter the underlying
14
+ source files.
15
+
16
+ Stylesheets and javascript files are accessible through a file selection
17
+ drop down on the fredit edit page.
18
+
19
+ You can also create and delete front-end files on the fredit edit page.
20
+
21
+ **NOTE:** Currently only ERB template handlers are supported. You are welcome to
22
+ fork and add support for Haml and other templates.
23
+
24
+
25
+ ## Why fredit?
26
+
27
+
28
+
29
+ ## Install
30
+
31
+ Put something like this in the `Gemfile` of your Rails app:
32
+
33
+ group :staging do
34
+ gem 'fredit'
35
+ end
36
+
37
+ and then run `RAILS_ENV=staging bundle install`, adjusting the
38
+ `RAILS_ENV` to your target environment.
39
+
40
+
41
+
42
+
43
+ ## fredit's git workflow
44
+
45
+ fredit assumes that the Rails instance it is running on is a cloned git
46
+ repository.
47
+
48
+ When you save your changes, fredit will make a git commit on
49
+ the git branch this instance of Rails application.
50
+
51
+ Clicking on fredit link will take you to a simple web-based editor where
52
+ you can directly edit the source of the view template.
53
+
54
+
55
+
56
+ commit these edits on a git branch and attribute commits to the author
57
+
58
+
59
+
60
+ ## License
61
+
62
+ Fredit is distributed under the MIT-LICENSE.
@@ -45,6 +45,7 @@ class FreditController < ::ApplicationController
45
45
 
46
46
  def create
47
47
  @path = params[:file]
48
+ FileUtils::mkdir_p File.dirname(@path)
48
49
  File.open(@path, 'w') {|f| f.write("REPLACE WITH CONTENT")}
49
50
  end
50
51
 
@@ -4,6 +4,8 @@ require 'uri'
4
4
  module Fredit
5
5
  extend self
6
6
 
7
+ LINK_CSS = "margin:0;margin-top:-1em;padding:1px;font-size:10px;background-color:#a3f66c;border:1px solid #666;"
8
+
7
9
  def rel_path(path)
8
10
  path.sub(Rails.root.to_s + '/', '')
9
11
  end
@@ -14,9 +16,7 @@ module Fredit
14
16
 
15
17
  # TODO change this to be compatible with HAML
16
18
  def link(x)
17
- s = <<-END
18
- <a href="/fredit?file=#{URI.escape(x)}" target="_blank">#{x}</a>
19
- END
19
+ s = %Q| <a style="#{LINK_CSS}" href="/fredit?file=#{URI.escape(x)}" target="_blank">#{x}</a> |
20
20
  s.strip.html_safe
21
21
  end
22
22
 
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.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -28,7 +28,7 @@ files:
28
28
  - MIT-LICENSE
29
29
  - Rakefile
30
30
  - Gemfile
31
- - README.rdoc
31
+ - README.md
32
32
  homepage:
33
33
  licenses: []
34
34
  post_install_message:
@@ -43,7 +43,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
43
43
  version: '0'
44
44
  segments:
45
45
  - 0
46
- hash: -744117635
46
+ hash: -143000303
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: -744117635
55
+ hash: -143000303
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.2
61
+ summary: fredit 0.0.3
62
62
  test_files: []
@@ -1,5 +0,0 @@
1
- = FrontEdit
2
-
3
- To be written.
4
-
5
- This uses MIT-LICENSE.