inline_forms 1.0.19 → 1.1.0

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.rdoc CHANGED
@@ -1,14 +1,29 @@
1
1
  = inline_forms
2
2
 
3
- Ever tired of setting up forms to manage your data? Inline Forms aims at quick and easy setup of models, migrations and controllers and providing a user-friendly interface.
3
+ Inline Forms is almost a complete admin application. You can try it out easily.
4
4
 
5
5
  = Usage
6
6
 
7
- Look in the generator files for a hint about usage. In short:
8
- rails g inline_forms Person first_name:string last_name:string age:dropdown_with_integers
9
- will create a model, a migration an a controller. In the model you would only have to add
10
- values for the dropdown, for instance 12..45.
11
- In going to /persons you would see a nice form to add and edit persons.
7
+ gem install inline_forms
8
+ inline_forms MyAppName
9
+ rails g inline_forms Picture \
10
+ name:string \
11
+ caption:string \
12
+ image:image_field \
13
+ description:text \
14
+ apartment:belongs_to \
15
+ _presentation:'#{name}' -f
16
+ rails generate uploader Image
17
+ rails g inline_forms Apartment \
18
+ name:string \
19
+ title:string \
20
+ description:text \
21
+ pictures:has_many \
22
+ pictures:associated \
23
+ _enabled:yes \
24
+ _presentation:'#{name}' -f
25
+ rails s
26
+ point your browser to http://localhost:3000/apartments (make sure JavaScript is enabled)
12
27
 
13
28
  It's work in progress.
14
29
 
data/bin/inline_forms CHANGED
@@ -1,10 +1,8 @@
1
- THIS IS NOT YET A GOOD THING ITS A COPY OF THE HOBO BIN FILE
2
-
3
1
  #!/usr/bin/env ruby
2
+ # copied from hobo and then modified. Some stuff is there because of that.
4
3
 
5
4
  require 'fileutils'
6
5
  require 'pathname'
7
-
8
6
  require 'rbconfig'
9
7
 
10
8
  RUBY = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name']).sub(/.*\s.*/m, '"\&"')
@@ -16,28 +14,30 @@ end
16
14
 
17
15
  Signal.trap("INT") { puts; exit }
18
16
 
19
- hobo_src = File.join(File.dirname(__FILE__), "../hobo_files/plugin")
17
+ src = File.join(File.dirname(__FILE__), "..")
18
+
20
19
 
21
- USAGE = "USAGE: hobo <options> <app-path>
20
+ USAGE = "
21
+ USAGE: inline_forms <options> <app-name>
22
+
23
+ 'inline_forms MyApp' will create a rails app in directory MyApp. It will also
24
+ try to create a MyApp_development mysql database and grant permissions on that
25
+ database to user 'MyApp' identified by 'MyApp', unless you specify
26
+ --skip-db-setup
22
27
 
23
28
  Options:
24
- --user-model <model-name-or-false>
25
- --db-create # Run rake db:create:all
26
- --hobo-src <path to hobo src>
27
- -d | --database <database> # e.g. mysql, sqlite
28
- -r | --rails <version> # rails version to use
29
- -n | --no-rails # don't run 'rails'. Assumes app-path=='.'
30
- --invite-only # add features for an invite-only website (admin site, no signup)
31
- "
29
+ --skip-db-setup # skip setup of mysql development database
30
+ --help # show this message
32
31
 
32
+ "
33
33
 
34
34
  ### Nasty stuff needed for Windows :-( ###
35
- if Config::CONFIG["arch"] =~ /win32/
36
- require "win32/registry"
37
- def system(command)
38
- win = Win32API.new("crtdll", "system", ['P'], 'L').Call(command)
39
- end
40
- end
35
+ #if Config::CONFIG["arch"] =~ /win32/
36
+ # require "win32/registry"
37
+ # def system(command)
38
+ # win = Win32API.new("crtdll", "system", ['P'], 'L').Call(command)
39
+ # end
40
+ #end
41
41
  ### end nasty stuff ###
42
42
 
43
43
 
@@ -48,106 +48,118 @@ def command(*s)
48
48
  exit(1) unless ok
49
49
  end
50
50
 
51
- user_model = "user"
52
- create_db = false
53
- run_rails = true
54
- invite_only = ""
51
+ skip_db_setup = false
55
52
 
56
53
  while true
57
54
  case arg_name = ARGV.shift
58
- when "--user-model"
59
- arg = ARGV.shift
60
- user_model = arg == "false" ? nil : arg
61
- when "--db-create"
62
- create_db = true
63
- when "--hobo-src"
64
- hobo_src = ARGV.shift
65
- hobo_src = "../" + hobo_src unless Pathname.new(hobo_src).absolute?
66
- when "-d", "--database"
67
- database_type = ARGV.shift
68
- when "-r", "--rails"
69
- rails_version = ARGV.shift
70
- when "-n", "--no-rails"
71
- run_rails = false
72
- when "--invite-only"
73
- invite_only = "--invite-only"
55
+ when "--skip-db-setup"
56
+ skip_db_setup = true
74
57
  when "--help"
75
58
  puts USAGE
76
59
  exit
77
60
  else
78
- app_path = arg_name
61
+ app_name = arg_name
79
62
  break
80
63
  end
81
64
  end
82
65
 
83
- if run_rails==false && app_path.nil?
84
- app_path = '.'
85
- end
86
-
87
- if !ARGV.empty? || app_path.nil?
66
+ if !ARGV.empty? || app_name.nil? || !/^[a-zA-Z][0-9a-zA-Z_-]+/.match(app_name) || File.exists?(app_name)
88
67
  puts USAGE
89
68
  exit 1
90
69
  end
91
70
 
92
- if run_rails
93
- puts "\nGenerating Rails app...\n"
94
- opts = []
95
- if rails_version
96
- opts << "_#{rails_version}_"
97
- else
98
- v=`#{RUBY} -S rails -v`.split[1].split(".")
99
- unless v.length>=3
100
- puts "rails not found!"
101
- exit 2
102
- end
103
- unless v[0]=='2' && ['2', '3'].include?(v[1])
104
- puts "Rails 2.2 or 2.3 required!"
105
- puts "Rails 3 requires Hobo 1.1 or later."
106
- exit 2
107
- end
108
- end
109
- opts << "-d #{database_type}" if database_type
110
- system("#{RUBY} -S rails #{opts * ' '} #{app_path}")
71
+ puts "\nGenerating Rails app '#{app_name}'...\n"
72
+ system("#{RUBY} -S rails new #{app_name}")
73
+
74
+ Dir.chdir(app_name)
75
+ puts "\nWorking directory is now #{`pwd`}"
76
+
77
+ puts "\nInstalling Gemfile and running Bundle...\n"
78
+
79
+ gemfile_sources = "
80
+ source 'http://rubygems.org'
81
+
82
+ "
83
+ gemfile_gems = "
84
+
85
+ gem 'rails', '~> 3.1.0'
86
+ gem 'rake'
87
+ gem 'jquery-rails'
88
+ gem 'mysql2'
89
+ gem 'capistrano'
90
+ gem 'will_paginate', :git => 'git://github.com/acesuares/will_paginate.git', :branch => 'rails3'
91
+ gem 'tabs_on_rails'
92
+ gem 'ckeditor', :git => 'git://github.com/acesuares/ckeditor.git', :branch => 'master'
93
+ gem 'carrierwave'
94
+ gem 'remotipart', '~> 1.0'
95
+ gem 'paper_trail'
96
+ gem 'devise'
97
+ gem 'cancan'
98
+ gem 'inline_forms'
99
+
100
+ "
101
+ gemfile_development_group ="
102
+
103
+ # Include everything needed to run rake, tests, features, etc.
104
+ group :development do
105
+ gem 'rspec-rails'
106
+ gem 'shoulda', '>= 0'
107
+ gem 'bundler', '~> 1.0.0'
108
+ gem 'jeweler', '~> 1.5.2'
109
+ gem 'rcov', '>= 0'
111
110
  end
112
111
 
113
- Dir.chdir(app_path) do
114
- gen = "#{RUBY} #{File.join('script', 'generate')}"
115
- plugin = "#{RUBY} #{File.join('script', 'plugin')}"
112
+ "
113
+ File.open( 'Gemfile', 'w') {|f| f.write(gemfile_sources + gemfile_gems + gemfile_development_group) }
116
114
 
117
- FileUtils.touch("public/stylesheets/application.css")
115
+ system('bundle install')
118
116
 
119
- puts "\nInitialising Hobo...\n"
120
- command(gen, "hobo --add-gem --add-routes")
117
+ if skip_db_setup
118
+ puts "\nDatabase setup skipped on your request!\n"
119
+ else
120
+ puts "\nDatabase setup: creating config/database.yml\n"
121
+ development_stanza = "
122
+ development:
123
+ adapter: mysql2
124
+ database: #{app_name}_development
125
+ username: #{app_name}
126
+ password: #{app_name}
121
127
 
122
- puts "\nInstalling Hobo Rapid and default theme...\n"
123
- command("#{gen} hobo_rapid --import-tags #{invite_only}")
128
+ "
129
+ File.open( 'config/database.yml', 'w') {|f| f.write(development_stanza) }
124
130
 
125
- if user_model
126
- puts "\nCreating #{user_model} model and controller...\n"
127
- command("#{gen} hobo_user_model #{user_model} #{invite_only}")
128
- command("#{gen} hobo_user_controller #{user_model} #{invite_only}")
129
- end
131
+ puts "CREATE #{app_name}_development database"
132
+ system("sudo mysqladmin create #{app_name}_development")
130
133
 
131
- puts "\nCreating standard pages...\n"
132
- command("#{gen} hobo_front_controller front --delete-index --add-routes #{invite_only}")
134
+ puts "GRANT ALL ON #{app_name}_development.* to '#{app_name}'@'localhost' identified by '#{app_name}'"
135
+ system("echo \"GRANT ALL ON #{app_name}_development.* to '#{app_name}'@'localhost' identified by '#{app_name}';\" | sudo mysql -v mysql")
136
+ system('echo "FLUSH PRIVILEGES;" | sudo mysql mysql')
133
137
 
134
- if create_db
135
- puts "\nCreating databases"
136
- command("#{RUBY} -S rake db:create:all")
137
- end
138
138
  end
139
139
 
140
- if !invite_only.empty?
141
- puts %(
142
- Invite-only website
143
- If you wish to prevent all access to the site to non-members, add 'before_filter :login_required'
144
- to the relevant controllers, e.g. to prevent all access to the site, add
145
-
146
- include Hobo::AuthenticationSupport
147
- before_filter :login_required
148
-
149
- to application_controller.rb (note that the include statement is not required for hobo_controllers)
150
-
151
- NOTE: You might want to sign up as the administrator before adding this!
152
- )
140
+ puts "\nDevise install..."
141
+ system('bundle exec rails g devise:install')
142
+ puts "\nDevise User model install..."
143
+ system('bundle exec rails g devise User')
144
+ puts "\nInstall ckeditor..."
145
+ system('bundle exec rails g ckeditor:install')
146
+ puts "Create config file in app/assets/javascripts/ckeditor/config.js"
147
+ FileUtils.mkdir_p 'app/assets/javascripts/ckeditor'
148
+ system("cp #{src}/app/assets/javascripts/ckeditor/config.js app/assets/javascripts/ckeditor")
149
+ puts "Add remotipart to app/assets/javascripts/application.js..."
150
+ system('echo >> app/assets/javascripts/application.js')
151
+ system('echo "//= require jquery.remotipart" >> app/assets/javascripts/application.js')
152
+ system('echo >> app/assets/javascripts/application.js')
153
+ puts "Paper_trail install..."
154
+ system('bundle exec rails g paper_trail:install')
155
+
156
+
157
+ if skip_db_setup
158
+ puts "Migrations skipped on your request!\n"
159
+ else
160
+ puts "Migrating Devise and Versions"
161
+ system('bundle exec rake db:migrate')
153
162
  end
163
+
164
+ puts "\n\nDone! Now make your tables.\n\n\n"
165
+
@@ -1,3 +1,3 @@
1
1
  module InlineForms
2
- VERSION = "1.0.19"
2
+ VERSION = "1.1.0"
3
3
  end
File without changes
File without changes
File without changes
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inline_forms
3
3
  version: !ruby/object:Gem::Version
4
- hash: 49
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
+ - 1
8
9
  - 0
9
- - 19
10
- version: 1.0.19
10
+ version: 1.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ace Suares
@@ -171,14 +171,6 @@ files:
171
171
  - app/views/layouts/inline_forms.html.erb
172
172
  - bin/inline_forms
173
173
  - inline_forms.gemspec
174
- - lib/appcreator/Gemfile
175
- - lib/appcreator/database.yml
176
- - lib/appcreator/mk31-app
177
- - lib/appcreator/otherstuff/add_roles.sql
178
- - lib/appcreator/otherstuff/bump
179
- - lib/appcreator/otherstuff/diffie
180
- - lib/appcreator/otherstuff/mkrole
181
- - lib/appcreator/otherstuff/roles_users.sql
182
174
  - lib/generators/inline_forms/USAGE
183
175
  - lib/generators/inline_forms/inline_forms_generator.rb
184
176
  - lib/generators/inline_forms/templates/_inline_forms_tabs.html.erb
@@ -187,6 +179,11 @@ files:
187
179
  - lib/generators/inline_forms/templates/model.erb
188
180
  - lib/inline_forms.rb
189
181
  - lib/inline_forms/version.rb
182
+ - lib/otherstuff/add_roles.sql
183
+ - lib/otherstuff/bump
184
+ - lib/otherstuff/diffie
185
+ - lib/otherstuff/mkrole
186
+ - lib/otherstuff/roles_users.sql
190
187
  - test/helper.rb
191
188
  - test/test_inline_forms.rb
192
189
  has_rdoc: true
@@ -1,42 +0,0 @@
1
- source 'http://rubygems.org'
2
-
3
- gem 'rails', "~> 3.1.0"
4
-
5
- gem 'rake'
6
-
7
- gem 'jquery-rails'
8
-
9
- gem 'mysql2'
10
-
11
- gem 'capistrano'
12
-
13
- gem 'will_paginate', :git => 'git://github.com/acesuares/will_paginate.git', :branch => 'rails3'
14
-
15
- gem 'tabs_on_rails'
16
-
17
- gem 'ckeditor', :git => 'git://github.com/acesuares/ckeditor.git', :branch => 'master'
18
-
19
- gem 'carrierwave'
20
-
21
- gem "remotipart", "~> 1.0"
22
-
23
- gem "paper_trail"
24
-
25
- gem 'devise'
26
-
27
- gem 'cancan'
28
-
29
- gem 'inline_forms'
30
-
31
- # Include everything needed to run rake, tests, features, etc.
32
- group :development do
33
- gem "rspec-rails"
34
- gem "shoulda", ">= 0"
35
- gem "bundler", "~> 1.0.0"
36
- gem "jeweler", "~> 1.5.2"
37
- gem "rcov", ">= 0"
38
- end
39
-
40
-
41
-
42
-
@@ -1,32 +0,0 @@
1
- # MySQL. Versions 4.1 and 5.0 are recommended.
2
- #
3
- #
4
- # Be sure to use new-style password hashing:
5
- # http://dev.mysql.com/doc/refman/5.0/en/old-client.html
6
- development:
7
- adapter: mysql2
8
- database: APPNAME_development
9
- username: APPNAME
10
- password: APPNAME
11
-
12
- # Warning: The database defined as 'test' will be erased and
13
- # re-generated from your development database when you run 'rake'.
14
- # Do not set this db to the same as development or production.
15
- test:
16
- adapter: mysql2
17
- database: APPNAME_test
18
- username: APPNAME
19
- password: APPNAME
20
-
21
- # Warning: The database defined as 'test' will be erased and
22
- # re-generated from your development database when you run 'rake'.
23
- # Do not set this db to the same as development or production.
24
- production:
25
- adapter: mysql2
26
- database: APPNAME_production
27
- username: APPNAME
28
- password: APPNAME
29
-
30
- # Warning: The database defined as 'test' will be erased and
31
- # re-generated from your development database when you run 'rake'.
32
- # Do not set this db to the same as development or production.
@@ -1,38 +0,0 @@
1
- #/bin/bash
2
- APPNAME=$1
3
- echo "Creating Rails app: $1..."
4
- echo "Working directory: `pwd`."
5
- rails new $APPNAME
6
- echo "Create $APPNAME/config/databse.yml..."
7
- cat database.yml | sed "s/APPNAME/$APPNAME/g" > $APPNAME/config/database.yml
8
- echo "Create Gemfile in $APPNAME..."
9
- cp -v Gemfile $APPNAME
10
- cd $APPNAME
11
- echo "Working directory: `pwd`."
12
- echo "Bundle install..."
13
- bundle install
14
- echo "Devise install..."
15
- rails g devise:install
16
- echo "Devise User model..."
17
- rails g devise User
18
- echo "Install ckeditor..."
19
- rails g ckeditor:install
20
- echo "Create config file in app/assets/javascripts/ckeditor/config.js"
21
- mkdir app/assets/javascripts/ckeditor
22
- cp ../config.js app/assets/javascripts/ckeditor
23
- echo "Add remotipart to app/assets/javascripts/application.js..."
24
- echo >> app/assets/javascripts/application.js
25
- echo "//= require jquery.remotipart" >> app/assets/javascripts/application.js
26
- echo >> app/assets/javascripts/application.js
27
- echo "Paper_trail install..."
28
- bundle exec rails generate paper_trail:install
29
- echo "DROP ${APPNAME}_development database"
30
- sudo mysqladmin drop ${APPNAME}_development
31
- echo "CREATE ${APPNAME}_development database"
32
- sudo mysqladmin create ${APPNAME}_development
33
- echo "GRANT permissions"
34
- echo "GRANT ALL ON ${APPNAME}_development.* to '${APPNAME}'@'localhost' identified by '${APPNAME}';" | sudo mysql -v mysql
35
- echo "FLUSH PRIVILEGES;" | sudo mysql mysql
36
- echo "Migrating Devise and Versions"
37
- bundle exec rake db:migrate
38
- echo "Done! Now make your tables."