alchemy_cms 2.0.1 → 2.0.2

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.
@@ -15,7 +15,7 @@ class Admin::ClipboardController < AlchemyController
15
15
  def insert
16
16
  @clipboard = get_clipboard(params[:remarkable_type].tableize)
17
17
  @item = params[:remarkable_type].classify.constantize.find(params[:remarkable_id])
18
- unless @clipboard.include?(params[:remarkable_id])
18
+ unless @clipboard.collect { |i| i[:id] }.include?(params[:remarkable_id])
19
19
  @clipboard.push({:id => params[:remarkable_id], :action => params[:remove] ? 'cut' : 'copy'})
20
20
  end
21
21
  respond_to do |format|
@@ -1,30 +1,42 @@
1
1
  #!/usr/bin/env ruby
2
2
  begin
3
- require "rubygems"
4
- require "thor"
5
- rescue LoadError
6
- raise LoadError, "\n\nThor not installed. Please run: gem install thor\n\n"
3
+ require "rubygems"
4
+ require "thor"
5
+ require 'alchemy/version'
6
+ require 'rails'
7
+ if Rails.version >= "3.1" || Rails.version < "3.0"
8
+ raise LoadError, "Wrong rails version installed. Please run gem install rails -v'~>3.0.10'"
9
+ end
7
10
  end
8
11
 
9
- class Alchemy < Thor
12
+ class AlchemyInstaller < Thor
10
13
 
11
14
  include Thor::Actions
12
-
15
+
16
+ map "-v" => :version
17
+ map "--version" => :version
18
+
19
+ desc "version", "Prints current Alchemy version", :hide => true
20
+ def version
21
+ puts Alchemy::VERSION
22
+ end
23
+
13
24
  desc "new PROJECT", "Creates a new Alchemy project."
14
25
  method_option :scm, :type => :string, :aliases => "-s", :desc => "Type of scm to use for this project. Leave blank for none."
26
+ method_option :database, :type => :string, :default => 'mysql', :aliases => "-d", :desc => "Type of database to use for this project. Default mysql."
15
27
  def new(project)
16
28
  project = project.downcase.strip.gsub(/ /, '_')
17
29
  if yes?("Install Alchemy into ./#{project}? (y/N)")
18
30
 
19
- say "Installing...", :yellow
31
+ say "Generating new Rails App...", :yellow
20
32
 
21
- if system "rails _3.0.10_ new #{project} -m #{File.join(File.dirname(__FILE__), '..', 'lib', 'rails', 'templates', 'alchemy.rb')} -d mysql -JT"
33
+ if system("rails _#{Rails.version}_ new #{project} -m #{File.join(File.dirname(__FILE__), '..', 'lib', 'rails', 'templates', 'alchemy.rb')} -d #{options[:database]} -JT")
22
34
 
23
35
  @application = project
24
36
 
25
- create_database_yml
37
+ create_database_yml if options[:database] == 'mysql'
26
38
 
27
- with_standard_set = yes?("\nDo you want to install Alchemys Standardset? (y/N)")
39
+ with_standard_set = yes?("\nDo you want to install Alchemys Standardset files into your App? (y/N)")
28
40
 
29
41
  %x[
30
42
  cd ./#{project}
@@ -50,7 +62,7 @@ class Alchemy < Thor
50
62
  repository = ask("\nName of the repository? (#{project})")
51
63
  repository = project if repository.empty?
52
64
 
53
- say "\nImporting #{project} into #{server}/#{repository} ...", :yellow
65
+ say "\nImporting #{project} into #{server}/#{repository} ...", :yellow
54
66
  output = %x[svn import ./#{project} #{server}/#{repository} -m 'initial import by Alchemy installer']; imported = $?.success?
55
67
 
56
68
  if imported
@@ -83,17 +95,17 @@ class Alchemy < Thor
83
95
  @ssh_port = standard_port if @ssh_port.empty?
84
96
 
85
97
  # db settings
86
- @db_user = ask "Database User (#{@ssh_user}):"
98
+ @db_user = ask "Production Database User (#{@ssh_user}):"
87
99
  @db_user = @ssh_user if @db_user.empty?
88
- @db_password = ask "Database Password:"
100
+ @db_password = ask "Production Database Password:"
89
101
  standard_db_name = "usr_#{@db_user}_1"
90
- @db_name = ask "Database Name (#{standard_db_name}):"
102
+ @db_name = ask "Production Database Name (#{standard_db_name}):"
91
103
  @db_name = standard_db_name if @db_name.empty?
92
104
  standard_host = "localhost"
93
- @db_host = ask "Database Host (#{standard_host}):"
105
+ @db_host = ask "Production Database Host (#{standard_host}):"
94
106
  @db_host = standard_host if @db_host.empty?
95
107
  standard_socket = '/var/run/mysqld/mysqld.sock'
96
- @db_socket = ask "Database Socket (#{standard_socket}):"
108
+ @db_socket = ask "Production Database Socket (#{standard_socket}):"
97
109
  @db_socket = standard_socket if @db_socket.empty?
98
110
 
99
111
  # deploy_path
@@ -193,7 +205,7 @@ private
193
205
  local_standard_socket = '/tmp/mysql.sock'
194
206
  @db_local_socket = ask("\nPlease provide your local mysql socket (#{local_standard_socket}):")
195
207
  @db_local_socket = local_standard_socket if @db_local_socket.empty?
196
- create_file "./#{@application}/config/database.yml" do
208
+ create_file "./#{@application}/config/database.yml", :force => true do
197
209
  <<-DATABASE
198
210
  development:
199
211
  adapter: mysql2
@@ -344,4 +356,4 @@ DEPLOY
344
356
 
345
357
  end
346
358
 
347
- Alchemy.start
359
+ AlchemyInstaller.start
@@ -1,5 +1,5 @@
1
1
  module Alchemy
2
2
 
3
- VERSION = "2.0.1"
3
+ VERSION = "2.0.2"
4
4
 
5
5
  end
@@ -22,9 +22,9 @@ module Alchemy
22
22
  end
23
23
 
24
24
  def create_defaults
25
- template("translation.pot", "#{@plugin_path}/locale/#{@plugin_name}.pot")
26
- template("translation_de.po", "#{@plugin_path}/locale/de/#{@plugin_name}.po")
27
- template("translation_en.po", "#{@plugin_path}/locale/en/#{@plugin_name}.po")
25
+ copy_file("#{File.dirname(__FILE__)}/files/translation.pot", "#{@plugin_path}/locale/#{@plugin_name}.pot")
26
+ copy_file("#{File.dirname(__FILE__)}/files/translation_de.po", "#{@plugin_path}/locale/de/#{@plugin_name}.po")
27
+ copy_file("#{File.dirname(__FILE__)}/files/translation_en.po", "#{@plugin_path}/locale/en/#{@plugin_name}.po")
28
28
  template("gettext.rb", "#{@plugin_path}/config/initializers/gettext.rb")
29
29
  template("config.yml", "#{@plugin_path}/config/alchemy/config.yml")
30
30
  template("authorization_rules.rb", "#{@plugin_path}/config/authorization_rules.rb")
@@ -0,0 +1,10 @@
1
+ <!DOCTYPE>
2
+ <html>
3
+ <head>
4
+ <%= render_meta_data %>
5
+ </head>
6
+ <body>
7
+ <%= yield %>
8
+ <%= alchemy_preview_mode_code %>
9
+ </body>
10
+ </html>
@@ -3,20 +3,25 @@ require 'rails'
3
3
  module Alchemy
4
4
  module Generators
5
5
  class ScaffoldGenerator < ::Rails::Generators::Base
6
- desc "This generator generates the Alchemy scaffold. Pass --with-standard-set to copy Alchemys standard set into your app."
6
+ desc "This generator generates the Alchemy scaffold. Pass --with-standard-set to copy Alchemys Standardset files into your app."
7
7
  class_option 'with-standard-set', :type => :boolean, :desc => "Copy standard set files."
8
8
  source_root File.expand_path('templates', File.dirname(__FILE__))
9
9
 
10
10
  def create_config_dir
11
11
  empty_directory "#{Rails.root}/config/alchemy"
12
12
  end
13
+
14
+ def create_view_dirs
15
+ empty_directory Rails.root.join("app/views/elements")
16
+ empty_directory Rails.root.join("app/views/page_layouts")
17
+ end
13
18
 
14
19
  def copy_config
15
20
  @config_path = File.expand_path('../../../../../config/alchemy', File.dirname(__FILE__))
16
21
  copy_file "#{@config_path}/config.yml", "#{Rails.root}/config/alchemy/config.yml"
17
22
  end
18
23
 
19
- def copy_yamls
24
+ def copy_files
20
25
  if options['with-standard-set']
21
26
  layouts_path = File.expand_path('../../../../../app/views/layouts', File.dirname(__FILE__))
22
27
  copy_file "#{@config_path}/elements.yml", "#{Rails.root}/config/alchemy/elements.yml"
@@ -25,8 +30,9 @@ module Alchemy
25
30
  Rails::Generators.invoke("alchemy:elements")
26
31
  Rails::Generators.invoke("alchemy:page_layouts")
27
32
  else
28
- template "elements.yml", "#{Rails.root}/config/alchemy/elements.yml"
29
- template "page_layouts.yml", "#{Rails.root}/config/alchemy/page_layouts.yml"
33
+ copy_file "#{File.dirname(__FILE__)}/files/elements.yml", "#{Rails.root}/config/alchemy/elements.yml"
34
+ copy_file "#{File.dirname(__FILE__)}/files/page_layouts.yml", "#{Rails.root}/config/alchemy/page_layouts.yml"
35
+ copy_file "#{File.dirname(__FILE__)}/files/pages.html.erb", "#{Rails.root}/app/views/layouts/pages.html.erb"
30
36
  end
31
37
  end
32
38
 
@@ -1,8 +1,9 @@
1
+ require 'alchemy/version'
1
2
  # This rails template installs Alchemy and all depending gems.
2
3
 
3
4
  # Installing Alchemy Gem
4
5
 
5
- gem 'alchemy_cms'
6
+ gem 'alchemy_cms', "~> #{Alchemy::VERSION}"
6
7
  gem 'ruby-debug', :group => :development, :platform => :ruby_18
7
8
  gem 'ruby-debug19', :group => :development, :platform => :ruby_19
8
9
 
@@ -13,26 +13,26 @@ describe Admin::ClipboardController do
13
13
  @page = Factory(:page, :parent_id => Page.rootpage.id)
14
14
  @element = Factory(:element, :page => @page)
15
15
  @another_element = Factory(:element, :page => @page)
16
- session[:clipboard] = { :elements => [@element.id] }
16
+ session[:clipboard] = { :elements => [{:id => @element.id, :action => 'copy'}] }
17
17
  post(:insert, {:remarkable_type => 'element', :remarkable_id => @another_element.id, :format => :js})
18
- session[:clipboard][:elements].should == [@element.id, @another_element.id]
18
+ session[:clipboard][:elements].should == [{:id => @element.id, :action => 'copy'}, {:id => @another_element.id, :action => 'copy'}]
19
19
  end
20
20
 
21
21
  it "should not have the same element twice" do
22
22
  @page = Factory(:page, :parent_id => Page.rootpage.id)
23
23
  @element = Factory(:element, :page => @page)
24
- session[:clipboard] = { :elements => [@element.id] }
24
+ session[:clipboard] = { :elements => [{:id => @element.id, :action => 'copy'}] }
25
25
  post(:insert, {:remarkable_type => 'element', :remarkable_id => @element.id, :format => :js})
26
- session[:clipboard][:elements].should == [@element.id]
26
+ session[:clipboard][:elements].should == [{:id => @element.id, :action => 'copy'}]
27
27
  end
28
28
 
29
29
  it "should remove element ids" do
30
30
  @page = Factory(:page, :parent_id => Page.rootpage.id)
31
31
  @element = Factory(:element, :page => @page)
32
32
  @another_element = Factory(:element, :page => @page)
33
- session[:clipboard] = { :elements => [@element.id, @another_element.id] }
33
+ session[:clipboard] = { :elements => [{:id => @element.id, :action => 'copy'}, {:id => @another_element.id, :action => 'copy'}] }
34
34
  delete(:remove, {:remarkable_type => 'element', :remarkable_id => @another_element.id, :format => :js})
35
- session[:clipboard][:elements].should == [@element.id]
35
+ session[:clipboard][:elements].should == [{:id => @element.id, :action => 'copy'}]
36
36
  end
37
37
 
38
38
  it "should be clearable" do
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: alchemy_cms
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 2.0.1
5
+ version: 2.0.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Thomas von Deyen
@@ -677,6 +677,9 @@ files:
677
677
  - lib/rails/generators/alchemy/elements/templates/view.html.erb
678
678
  - lib/rails/generators/alchemy/page_layouts/page_layouts_generator.rb
679
679
  - lib/rails/generators/alchemy/page_layouts/templates/layout.html.erb
680
+ - lib/rails/generators/alchemy/plugin/files/translation.pot
681
+ - lib/rails/generators/alchemy/plugin/files/translation_de.po
682
+ - lib/rails/generators/alchemy/plugin/files/translation_en.po
680
683
  - lib/rails/generators/alchemy/plugin/plugin_generator.rb
681
684
  - lib/rails/generators/alchemy/plugin/templates/authorization_rules.rb
682
685
  - lib/rails/generators/alchemy/plugin/templates/config.yml
@@ -684,12 +687,10 @@ files:
684
687
  - lib/rails/generators/alchemy/plugin/templates/init.rb
685
688
  - lib/rails/generators/alchemy/plugin/templates/plugin.rb
686
689
  - lib/rails/generators/alchemy/plugin/templates/routes.rb
687
- - lib/rails/generators/alchemy/plugin/templates/translation.pot
688
- - lib/rails/generators/alchemy/plugin/templates/translation_de.po
689
- - lib/rails/generators/alchemy/plugin/templates/translation_en.po
690
+ - lib/rails/generators/alchemy/scaffold/files/elements.yml
691
+ - lib/rails/generators/alchemy/scaffold/files/page_layouts.yml
692
+ - lib/rails/generators/alchemy/scaffold/files/pages.html.erb
690
693
  - lib/rails/generators/alchemy/scaffold/scaffold_generator.rb
691
- - lib/rails/generators/alchemy/scaffold/templates/elements.yml
692
- - lib/rails/generators/alchemy/scaffold/templates/page_layouts.yml
693
694
  - lib/rails/templates/alchemy.rb
694
695
  - lib/tasks/fleximage.rake
695
696
  - lib/tasks/gettext.rake