Skip to content

Commit 5a2fa01

Browse files
committed
restructure folders, added generator
1 parent a6d52b6 commit 5a2fa01

File tree

11 files changed

+49
-24
lines changed

11 files changed

+49
-24
lines changed

editmode.gemspec

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
# coding: utf-8
22
lib = File.expand_path('../lib', __FILE__)
33
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4-
require 'editmode-rails/version'
4+
require 'editmode/version'
55

66
Gem::Specification.new do |spec|
77
spec.name = "editmode"
8-
spec.version = EditModeRails::VERSION
8+
spec.version = Editmode::VERSION
99
spec.authors = ["Tony Ennis"]
1010
spec.email = ["[email protected]"]
1111
spec.summary = %q{Editmode allows you to turn plain text in your rails app into easily inline-editable bits of content that can be managed by anyone with no technical knowledge}
1212
spec.description = %q{The Editmode gem allows you to include chunks from the Editmode platform in your rails views}
1313
spec.homepage = "https://github.com/tonyennis145/editmode-rails"
1414
spec.license = "MIT"
1515

16-
spec.files = Dir["{app,lib,config}/**/*"] + ["Rakefile", "Gemfile", "README.md"]
16+
spec.files = Dir["{app,lib,config}/**/*", "Rakefile", "Gemfile", "README.md"]
17+
spec.require_paths = ["lib"]
1718

1819
spec.add_dependency "bundler"
1920
spec.add_dependency "rake"

lib/editmode-rails/version.rb

-3
This file was deleted.

lib/editmode.rb

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
require "active_support/dependencies"
2-
require "editmode-rails/version"
3-
require 'editmode-rails/script_tag'
4-
require 'editmode-rails/action_view_extensions/editmode_helper'
5-
require 'editmode-rails/auto_include_filter'
6-
require 'editmode-rails/railtie' if defined? Rails
7-
require 'editmode-rails/engine' if defined?(Rails)
2+
require "editmode/version"
3+
require 'editmode/script_tag'
4+
require 'editmode/action_view_extensions/editmode_helper'
5+
require 'editmode/auto_include_filter'
6+
require 'editmode/railtie' if defined? Rails
7+
require 'editmode/engine' if defined?(Rails)
88

9-
class Editmode
9+
module Editmode
1010
class << self
11-
include ::EditModeRails::ActionViewExtensions::EditModeHelper
11+
include Editmode::ActionViewExtensions::EditmodeHelper
1212
def project_id=(id)
1313
config.project_id = id
1414
end

lib/editmode-rails/action_view_extensions/editmode_helper.rb lib/editmode/action_view_extensions/editmode_helper.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
module EditModeRails
1+
module Editmode
22
module ActionViewExtensions
3-
module EditModeHelper
3+
module EditmodeHelper
44

55
require 'httparty'
66

lib/editmode-rails/auto_include_filter.rb lib/editmode/auto_include_filter.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
module EditModeRails
1+
module Editmode
22

33
module AutoInclude
44

55
module Method
66
def editmode_auto_include
7-
EditModeRails::AutoInclude::Filter.filter(self)
7+
Editmode::AutoInclude::Filter.filter(self)
88
end
99
end
1010

@@ -49,7 +49,7 @@ def response_has_closing_body_tag?
4949
end
5050

5151
def editmode_script_tag
52-
@script_tag ||= EditModeRails::ScriptTag.new()
52+
@script_tag ||= Editmode::ScriptTag.new()
5353
end
5454

5555
def enabled_for_environment?

lib/editmode-rails/engine.rb lib/editmode/engine.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module EditMode
1+
module Editmode
22

33
class Engine < Rails::Engine
44

lib/editmode-rails/railtie.rb lib/editmode/railtie.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
module EditModeRails
1+
module Editmode
22
class Railtie < Rails::Railtie
3-
initializer "editmode-rails" do |app|
3+
initializer "editmode" do |app|
44

55
ActiveSupport.on_load :action_view do
6-
include EditModeRails::ActionViewExtensions::EditModeHelper
6+
include Editmode::ActionViewExtensions::EditmodeHelper
77
end
88
ActiveSupport.on_load :action_controller do
99
include AutoInclude::Method

lib/editmode-rails/script_tag.rb lib/editmode/script_tag.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module EditModeRails
1+
module Editmode
22

33
class ScriptTag
44

lib/editmode/version.rb

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module Editmode
2+
VERSION = "0.0.9.127"
3+
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
2+
require 'rails/generators/base'
3+
4+
module Editmode
5+
module Generators
6+
class InstallGenerator < Rails::Generators::Base
7+
source_root File.expand_path("../templates", __FILE__)
8+
9+
def install
10+
copy_initializer
11+
end
12+
13+
private
14+
def copy_initializer
15+
template "editmode.rb", "config/initializers/editmode.rb"
16+
end
17+
end
18+
end
19+
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Editmode.setup do |config|
2+
# Replace TodoProjectId with your Editmode Project ID,
3+
# visit https://editmode.com/projects
4+
config.project_id = TodoProjectId
5+
end

0 commit comments

Comments
 (0)