fredit 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.md +89 -22
  2. data/app/views/fredit/index.html.erb +24 -7
  3. metadata +4 -4
data/README.md CHANGED
@@ -1,34 +1,79 @@
1
1
  # fredit: front-end edit
2
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.
3
+ `fredit` is a very simple, no-frills Rails 3 Engine that lets you edit your
4
+ Rails application's view templates, css stylesheets, and javascript
5
+ files (a.k.a front-end files) through the browser.
6
6
 
7
- fredit injects an edit link into every view template. These edit links
7
+ `fredit` injects an edit link into every view template. These edit links
8
8
  are visible wherever the template is rendered, whether it is a layout,
9
9
  a page, or a partial.
10
10
 
11
+ <img style="width:300px" src="https://github.com/danchoi/fredit/raw/master/screens/links.png"/>
12
+
11
13
  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.
14
+ directly edit the source. An update button lets you save these changes
15
+ and alter the underlying source files.
16
+
17
+ <img style="width:300px" src="https://github.com/danchoi/fredit/raw/master/screens/fredit.png"/>
15
18
 
16
- Stylesheets and javascript files are accessible through a file selection
17
- drop down on the fredit edit page.
19
+ In addition to view templates, stylesheets and javascript files are
20
+ accessible through a file selection drop down at the top of the `fredit`
21
+ edit page.
18
22
 
19
- You can also create and delete front-end files on the fredit edit page.
23
+ You can also create and delete front-end files on the `fredit` edit page.
20
24
 
21
- **NOTE:** Currently only ERB template handlers are supported. You are welcome to
22
- fork and add support for Haml and other templates.
25
+ **NOTE: Currently only the ERB Rails template handler is supported.**
26
+ You are welcome to fork and add support for Haml and other template
27
+ handlers.
23
28
 
24
29
 
25
30
  ## Why fredit?
26
31
 
32
+ On a current Rails project, I needed to delegate responsibility for
33
+ improving the copy, the styling, and the user interface to another
34
+ person. Let's call this person "Chad." Chad:
35
+
36
+ * is not a Ruby or Rails programmer
37
+ * knows HTML and CSS
38
+ * can make perfect sense of ERB, Rails partials, and basic Ruby
39
+ constructs found in ERB after a few minutes of explanation
40
+ * can use a web browser interface to edit files
41
+
42
+ One option here is to set up a full Rails development environment on
43
+ Chad's computer. But this option is not attractive for several
44
+ reasons. Chad is not familiar with Linux or git. I would have to install
45
+ Ruby, gems, and the RDBMS on Chad's computer for him. I would have to
46
+ teach Chad a lot of things: how to check out the application code from
47
+ the git repository, how to start the Rails app, how to run migrations,
48
+ how to check his changes into the git repository and push them upstream.
49
+ All this work just to get Chad to the point where he can edit the view
50
+ templates and the stylesheets of your Rails app.
51
+
52
+ Another option is to integrate a CMS into your Rails app. But in
53
+ addition to being quite heavyweight, this approach is too restrictive when
54
+ you want to give your collaborator as much control over the front-end as
55
+ he or she can handle.
27
56
 
57
+ `fredit` lets a collaborator make significant front-end contributions to a Rails
58
+ application without the hassles of having to set up and run a local
59
+ instance of it on their computer. Just run a `fredit`-enabled instance of
60
+ your Rails app on a server that your collaborator can access through his
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.
28
65
 
29
- ## Install
30
66
 
31
- Put something like this in the `Gemfile` of your Rails app:
67
+ ## Install and setup
68
+
69
+ `fredit` requires Rails 3.
70
+
71
+ `fredit` works best as a gem you include in a specific Rails
72
+ environment. Put something like this in the `Gemfile` of your Rails app:
73
+
74
+ source 'http://rubygems.org'
75
+
76
+ [lines omitted]
32
77
 
33
78
  group :staging do
34
79
  gem 'fredit'
@@ -37,24 +82,46 @@ Put something like this in the `Gemfile` of your Rails app:
37
82
  and then run `RAILS_ENV=staging bundle install`, adjusting the
38
83
  `RAILS_ENV` to your target environment.
39
84
 
85
+ To run your Rails app with `fredit`, just start it in the Rails
86
+ environment Gemfile group you put the `fredit` gem in. When you hit the
87
+ app in the browser, you should see the injected view template links and
88
+ be able to click through them to `fredit`'s source code editor.
89
+
40
90
 
91
+ ## fredit with git
41
92
 
93
+ `fredit` assumes that the Rails instance it is running on is a cloned git
94
+ repository. **It also assumes that you have set the current branch of
95
+ this git repository to the one you want your collaborator's changes
96
+ committed to.**
42
97
 
43
- ## fredit's git workflow
98
+ When your collaborator makes changes, `fredit` will commit those changes
99
+ on the current git branch of this clone of the git repository. There is
100
+ a form field in the `fredit` editor for the collaborator to enter git
101
+ author information and a git log message. These bits of information
102
+ will be added as metadata to the git commit.
44
103
 
45
- fredit assumes that the Rails instance it is running on is a cloned git
46
- repository.
104
+ When you're ready to review and merge the changes your collaborator made
105
+ via `fredit`, it's all just a matter of working with git commits and
106
+ branches. You can set up client-side git hooks on the `fredit`-enabled
107
+ clone to notify you when your collaborator has made changes, to
108
+ automatically push those changes to the appropriate branch in the
109
+ upstream repository, run a CI build server, etc.
47
110
 
48
- When you save your changes, fredit will make a git commit on
49
- the git branch this instance of Rails application.
50
111
 
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.
112
+ ## Security
53
113
 
114
+ `fredit` has basic security features, on top of which you can add anything
115
+ you want. At a minimum, `fredit` will not allow any user to use the `fredit`
116
+ web interface to edit a file above or outside the Rails application root
117
+ directory of that Rails instance.
54
118
 
55
119
 
56
- commit these edits on a git branch and attribute commits to the author
120
+ ## Contribute
57
121
 
122
+ Feel free to fork and take this simple idea wherever you want to. The
123
+ current version of this project is really just a quick and dirty
124
+ implementation that I needed pronto.
58
125
 
59
126
 
60
127
  ## License
@@ -5,10 +5,24 @@
5
5
  <style>
6
6
 
7
7
  body {
8
+ padding-top:0;
8
9
  padding-bottom: 30px;
10
+ font-family: Verdana, Helvetica, sans;
11
+ font-size: 12px;
12
+ margin-left: 40px;
13
+ width: 80%;
14
+ background-color: #EDEDED;
15
+ }
16
+ h1 {
17
+ margin:0;
18
+ padding:0;
19
+ float:left;
20
+ }
21
+ h1 em {
22
+ font-size: smaller;
9
23
  }
10
24
  textarea {
11
- width: 80%;
25
+ width: 100%;
12
26
  height: 500px;
13
27
  font-family: monospace;
14
28
  }
@@ -22,12 +36,15 @@ input[type=text] {
22
36
  width: 100%;
23
37
  }
24
38
  table {
25
- width: 80%
39
+ width: 100%
40
+ }
41
+ form#fileSelector {
42
+ float:right;
26
43
  }
27
44
  form#createFileForm {
28
45
  border-top: 1px solid #CCC;
29
- margin-top: 30px;
30
- padding-top: 30px;
46
+ margin-top: 10px;
47
+ padding-top: 10px;
31
48
  }
32
49
 
33
50
  </style>
@@ -38,9 +55,9 @@ form#createFileForm {
38
55
  <div id="notice"><%= flash[:notice] %></div>
39
56
  <% end %>
40
57
 
41
- <h1>Fredit: front-end edit</h1>
58
+ <h1>fredit <em>front-end edit</em></h1>
42
59
 
43
- <form action="<%=url_for%>">
60
+ <form id="fileSelector" action="<%=url_for%>">
44
61
  <select name="file">
45
62
  <% Fredit.editables.each_pair do |k, v| %>
46
63
  <optgroup label="<%= k %>">
@@ -50,7 +67,7 @@ form#createFileForm {
50
67
  </optgroup>
51
68
  <% end %>
52
69
  </select>
53
- <input type="submit" value="load"/>
70
+ <input type="submit" value="change file"/>
54
71
  </form>
55
72
 
56
73
  <form action="<%=url_for(:action => :update)%>" method="post">
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.4
4
+ version: 0.0.5
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: -722474993
46
+ hash: -378632035
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: -722474993
55
+ hash: -378632035
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.4
61
+ summary: fredit 0.0.5
62
62
  test_files: []