prologue 0.3.0 → 0.3.6

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/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- prologue (0.2.0)
4
+ prologue (0.3.1)
5
5
  rails (>= 3.0.0)
6
6
  thor
7
7
 
@@ -102,7 +102,7 @@ PLATFORMS
102
102
 
103
103
  DEPENDENCIES
104
104
  aruba
105
- bundler (>= 1.0.0)
105
+ bundler (~> 1.0.0)
106
106
  cucumber
107
107
  prologue!
108
108
  rails (>= 3.0.0)
data/bin/prologue CHANGED
@@ -1,3 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
+ $:.unshift(File.dirname(__FILE__) + '/../lib') unless $:.include?(File.dirname(__FILE__) + '/../lib')
2
3
  require 'prologue/cli'
3
4
  Prologue::CLI.start
data/features/new.feature CHANGED
@@ -1,9 +1,9 @@
1
+ @disable-bundler
1
2
  Feature: Generate new prologue app
2
3
  In order to start a new project with prologue
3
4
  As a CLI
4
5
  I want to generate a rails3 app with prologue
5
6
 
6
- @disable-bundler
7
7
  Scenario: Run prologue new my_app
8
8
  When I run "prologue new my_app"
9
9
  Then the output should contain "Building authentication"
@@ -11,7 +11,6 @@ Feature: Generate new prologue app
11
11
  And the output should contain "Building admin"
12
12
  And the output should contain "Prologue just added like 6 hours to your life."
13
13
 
14
- @disable-bundler
15
14
  Scenario: Run prologue new my_app --no-auth
16
15
  When I run "prologue new my_app --no-auth"
17
16
  Then the output should not contain "Building authentication"
@@ -19,7 +18,6 @@ Feature: Generate new prologue app
19
18
  And the output should not contain "Building admin"
20
19
  And the output should contain "Prologue just added like 6 hours to your life."
21
20
 
22
- @disable-bundler
23
21
  Scenario: Run prologue new my_app --no-roles
24
22
  When I run "prologue new my_app --no-roles"
25
23
  Then the output should contain "Building authentication"
@@ -27,7 +25,6 @@ Feature: Generate new prologue app
27
25
  And the output should contain "Building admin"
28
26
  And the output should contain "Prologue just added like 6 hours to your life."
29
27
 
30
- @disable-bundler
31
28
  Scenario: Run prologue new my_app --no-admin
32
29
  When I run "prologue new my_app --no-admin"
33
30
  Then the output should contain "Building authentication"
@@ -35,7 +32,6 @@ Feature: Generate new prologue app
35
32
  And the output should not contain "Building admin"
36
33
  And the output should contain "Prologue just added like 6 hours to your life."
37
34
 
38
- @disable-bundler
39
35
  Scenario: Run prologue new my_app --no-admin --no-roles
40
36
  When I run "prologue new my_app --no-admin --no-roles"
41
37
  Then the output should contain "Building authentication"
data/lib/prologue/cli.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  require 'thor'
2
2
  require 'thor/actions'
3
3
  require 'active_support/secure_random'
4
- require 'prologue/version'
5
4
 
6
5
  module Prologue
7
6
  class CLI < Thor
@@ -1,3 +1,3 @@
1
1
  module Prologue
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.6"
3
3
  end
data/lib/prologue.rb CHANGED
@@ -1,3 +1,7 @@
1
+ $:.unshift(File.dirname(__FILE__) + '/../lib') unless $:.include?(File.dirname(__FILE__) + '/../lib')
2
+ require 'prologue/version'
3
+ require 'prologue/cli'
4
+
1
5
  module Prologue
2
6
 
3
7
  end
data/prologue.gemspec CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
16
16
 
17
17
  s.add_dependency "thor"
18
18
  s.add_dependency('rails', '>= 3.0.0')
19
- s.add_development_dependency "bundler", ">= 1.0.0"
19
+ s.add_development_dependency "bundler", "~> 1.0.0"
20
20
  s.add_development_dependency "cucumber"
21
21
  s.add_development_dependency "aruba"
22
22
  s.add_development_dependency "rspec", "~> 2.0.0"
@@ -22,7 +22,9 @@ end
22
22
 
23
23
  inject_into_file 'app/controllers/admin/users_controller.rb', :after => "def create\n" do
24
24
  <<-'FILE'
25
- @user = User.new(params[:user])
25
+ @user = User.new
26
+ # attr_accessor logic here
27
+ @user.attributes = params[:user]
26
28
  if @user.save
27
29
  flash[:notice] = "User created!"
28
30
  redirect_to admin_users_url
@@ -36,7 +38,7 @@ inject_into_file 'app/controllers/admin/users_controller.rb', :after => "def upd
36
38
  <<-'FILE'
37
39
  params[:user].delete(:password) if params[:user][:password].blank?
38
40
  params[:user].delete(:password_confirmation) if params[:user][:password].blank? and params[:user][:password_confirmation].blank?
39
-
41
+ # attr_accessor logic here
40
42
  if @user.update_attributes(params[:user])
41
43
  flash[:notice] = "Successfully updated #{@user.name}."
42
44
  redirect_to admin_users_url
@@ -1,5 +1,21 @@
1
+ require "net/http"
2
+ require "net/https"
3
+ require "uri"
4
+ require 'rbconfig'
5
+
1
6
  say "Building Application with Prologue..."
2
7
 
8
+ def get_remote_https_file(source, destination)
9
+ uri = URI.parse(source)
10
+ http = Net::HTTP.new(uri.host, uri.port)
11
+ http.use_ssl = true
12
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
13
+ request = Net::HTTP::Get.new(uri.request_uri)
14
+ response = http.request(request)
15
+ path = File.join(destination_root, destination)
16
+ File.open(path, "w") { |file| file.write(response.body) }
17
+ end
18
+
3
19
  append_file '.gitignore' do
4
20
  '.DS_Store'
5
21
  'log/*.log'
data/templates/cancan.rb CHANGED
@@ -87,28 +87,11 @@ if ENV['PROLOGUE_ADMIN']
87
87
  .check_box_item
88
88
  = check_box_tag "user[role_ids][]", role.id, @user.roles.include?(role), :id => "user_role_#{role.id}"
89
89
  %label{:for => "user_role_#{role.id}"}= role.name.humanize
90
+ = hidden_field_tag "user[role_ids][]", ""
90
91
  RUBY
91
92
  end
92
93
 
93
- inject_into_file 'app/controllers/admin/users_controller.rb', :after => "@user = User.new(params[:user])\n" do
94
- <<-'RUBY'
95
- @user.role_ids = params[:user][:role_ids] if current_user.role? :admin
96
- RUBY
97
- end
98
-
99
- inject_into_file 'app/controllers/admin/users_controller.rb', :before => "if @user.update_attributes(params[:user])\n" do
100
- <<-'RUBY'
101
- @user.send(:attributes=, { :role_ids => params[:user][:role_ids] }, false) if current_user.role? :admin
102
- params[:user].delete(:role_ids)
103
-
104
- RUBY
105
- end
106
-
107
- inject_into_file 'app/controllers/admin/users_controller.rb', :after => "def update\n" do
108
- <<-'RUBY'
109
- params[:user][:role_ids] ||= []
110
- RUBY
111
- end
94
+ gsub_file 'app/controllers/admin/users_controller.rb', /# attr_accessor logic here/, '@user.accessible = [:role_ids] if current_user.role? :admin'
112
95
  end
113
96
 
114
97
  append_file 'db/seeds.rb' do
data/templates/gemfile.rb CHANGED
@@ -31,4 +31,10 @@ gem "launchy", :group => [:cucumber]
31
31
  gem "timecop", :group => [:test, :cucumber]
32
32
  gem "pickle", :group => [:test, :cucumber]
33
33
 
34
+ # for windows users
35
+ if ( (Config::CONFIG['host_os'] =~ /mswin|mingw/) && (Config::CONFIG["ruby_version"] =~ /1.8/) )
36
+ gem "win32console", :group => [:test, :cucumber]
37
+ gem "windows-pr", :group => [:test, :cucumber]
38
+ gem "win32-open3"
39
+ end
34
40
  run 'bundle install'
@@ -1,7 +1,19 @@
1
- initializer('active_record.rb') do
1
+ initializer('accessible_attributes.rb') do
2
2
  <<-'FILE'
3
- # This forces you to set attr_accessible in all your models
4
- ActiveRecord::Base.send(:attr_accessible, nil)
3
+ class ActiveRecord::Base
4
+ attr_accessible
5
+ attr_accessor :accessible
6
+
7
+ private
8
+
9
+ def mass_assignment_authorizer
10
+ if accessible == :all
11
+ self.class.protected_attributes
12
+ else
13
+ super + (accessible || [])
14
+ end
15
+ end
16
+ end
5
17
  FILE
6
18
  end
7
19
 
data/templates/js.rb CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  get "http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js", "public/javascripts/jquery.js"
3
- get "http://github.com/rails/jquery-ujs/raw/master/src/rails.js", "public/javascripts/rails.js"
3
+ get_remote_https_file "https://github.com/rails/jquery-ujs/raw/master/src/rails.js", "public/javascripts/rails.js"
4
4
  get "http://html5shiv.googlecode.com/svn/trunk/html5.js", "public/javascripts/shiv.js"
5
5
  run 'rm public/javascripts/application.js'
6
6
 
@@ -56,4 +56,5 @@ create_file 'public/javascripts/core.js' do
56
56
 
57
57
  })(jQuery);
58
58
  FILE
59
- end
59
+ end
60
+
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 0
9
- version: 0.3.0
8
+ - 6
9
+ version: 0.3.6
10
10
  platform: ruby
11
11
  authors:
12
12
  - Quick Left
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-10-26 00:00:00 -06:00
17
+ date: 2010-11-05 00:00:00 -06:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -51,7 +51,7 @@ dependencies:
51
51
  requirement: &id003 !ruby/object:Gem::Requirement
52
52
  none: false
53
53
  requirements:
54
- - - ">="
54
+ - - ~>
55
55
  - !ruby/object:Gem::Version
56
56
  segments:
57
57
  - 1
@@ -184,6 +184,6 @@ rubyforge_project: prologue
184
184
  rubygems_version: 1.3.7
185
185
  signing_key:
186
186
  specification_version: 3
187
- summary: prologue-0.3.0
187
+ summary: prologue-0.3.6
188
188
  test_files: []
189
189