bigcommerce_tool 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +39 -0
- data/Rakefile +2 -0
- data/bigcommerce_tool.gemspec +33 -0
- data/bin/bigcommerce +7 -0
- data/lib/bigcommerce_tool/app.rb +113 -0
- data/lib/bigcommerce_tool/cli.rb +30 -0
- data/lib/bigcommerce_tool/deployer.rb +83 -0
- data/lib/bigcommerce_tool/discount.rb +8 -0
- data/lib/bigcommerce_tool/generic_lookup.rb +24 -0
- data/lib/bigcommerce_tool/global.rb +27 -0
- data/lib/bigcommerce_tool/language.rb +12 -0
- data/lib/bigcommerce_tool/long_descriptions/serve.txt +15 -0
- data/lib/bigcommerce_tool/page.rb +9 -0
- data/lib/bigcommerce_tool/template.rb +97 -0
- data/lib/bigcommerce_tool/version.rb +3 -0
- data/lib/bigcommerce_tool.rb +27 -0
- data/lib/utility.rb +9 -0
- metadata +221 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f958d4ef65a32214e77b59bd64e55894fc2b7334
|
4
|
+
data.tar.gz: 7eafac847d8062ab64ef4a95e8ce986f7b5e13fe
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3dc4f93e8792605233195cf06723823930e5db0a45f9c9e0f791f3c3b1f08d2638e8fbd71efc7a0abf43e7093db64dd9a6679b9b78b665cf374781826798ca8d
|
7
|
+
data.tar.gz: 0e5b3053e7d0188ad5d45b3b20f8a35b2cbbe2f29e4cf3e5e1b409db5881b6f9b6acfe1d45c6970b8da042eb8b9768d1edf97fa4933cb8144830a4f772f8efb4
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Tyler Ewing
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# BigcommerceTool
|
2
|
+
|
3
|
+
This tool is used to locally serve Bigcommerce templates and deploy changed templates to your Bigcommerce store. It is still in its infancy but provides some useful features for local development.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'bigcommerce_tool'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install bigcommerce_tool
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
The basic commands are:
|
24
|
+
|
25
|
+
Commands:
|
26
|
+
bigcommerce deploy # Deploy changed templates to Bigcommerce using WebDAV
|
27
|
+
bigcommerce help [COMMAND] # Describe available commands or one specific command
|
28
|
+
bigcommerce init # Initialize default configuration settings
|
29
|
+
bigcommerce serve # Serve local Bigcommerce templates
|
30
|
+
|
31
|
+
Currently, this gem works best when deploying from CircleCI.
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
1. Fork it ( https://github.com/secondrotation/bigcommerce_tool/fork )
|
36
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
37
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
38
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
39
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'bigcommerce_tool/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "bigcommerce_tool"
|
8
|
+
spec.version = BigcommerceTool::VERSION
|
9
|
+
spec.authors = ["Jason Vanderhoof", "Tyler Ewing"]
|
10
|
+
spec.email = ["engineering@gazelle.com"]
|
11
|
+
spec.summary = %q{Useful tool for local development of Bigcommerce templates}
|
12
|
+
spec.description = %q{Useful tool for local development of Bigcommerce templates and deploying templates}
|
13
|
+
spec.homepage = "https://github.com/secondrotation/bigcommerce_tool"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
spec.add_development_dependency "pry-byebug", "~> 3.0"
|
24
|
+
|
25
|
+
spec.add_dependency "net_dav", "~> 0.5"
|
26
|
+
spec.add_dependency "curb", "~> 0.8"
|
27
|
+
spec.add_dependency "dotenv", "~> 2.0"
|
28
|
+
spec.add_dependency "sinatra", "~> 1.4"
|
29
|
+
spec.add_dependency "thin", "~> 1.6"
|
30
|
+
spec.add_dependency "json", "~> 1.8"
|
31
|
+
spec.add_dependency "thor", "~> 0.19"
|
32
|
+
spec.add_dependency "rack", "~> 1.6"
|
33
|
+
end
|
data/bin/bigcommerce
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
require 'sinatra/base'
|
2
|
+
|
3
|
+
module BigcommerceTool
|
4
|
+
class App < Sinatra::Base
|
5
|
+
|
6
|
+
set :template_folder, './template'
|
7
|
+
set :override_templates_folder, './config/templates'
|
8
|
+
set :global_variables, './config/global.yml'
|
9
|
+
set :global_files, './config/global_files'
|
10
|
+
set :language_variables, './config/language.yml'
|
11
|
+
set :page_variables, './config/page.yml'
|
12
|
+
set :discount_variables, './config/discount.yml'
|
13
|
+
|
14
|
+
configure do
|
15
|
+
mime_type :javascript, 'text/javascript'
|
16
|
+
mime_type :css, 'text/css'
|
17
|
+
mime_type :png, 'image/png'
|
18
|
+
mime_type :svg, 'image/svg+xml'
|
19
|
+
mime_type :jpg, 'image/jpeg'
|
20
|
+
mime_type :woff, 'application/x-font-woff'
|
21
|
+
mime_type :gif, 'image/gif'
|
22
|
+
end
|
23
|
+
|
24
|
+
def mime_type_by_file(file)
|
25
|
+
type = file.split('.').last.downcase
|
26
|
+
case type
|
27
|
+
when 'js'
|
28
|
+
:javascript
|
29
|
+
when 'css'
|
30
|
+
:css
|
31
|
+
when 'svg'
|
32
|
+
:svg
|
33
|
+
when 'png'
|
34
|
+
:png
|
35
|
+
when 'jpeg','jpg'
|
36
|
+
:jpg
|
37
|
+
when 'woff','woff2'
|
38
|
+
:woff
|
39
|
+
when 'gif'
|
40
|
+
:gif
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def template
|
45
|
+
@template ||= BigcommerceTool::Template.new(settings.template_folder,
|
46
|
+
settings.override_templates_folder,
|
47
|
+
settings.global_variables,
|
48
|
+
settings.global_files,
|
49
|
+
settings.language_variables,
|
50
|
+
settings.page_variables,
|
51
|
+
settings.discount_variables)
|
52
|
+
end
|
53
|
+
|
54
|
+
def template_results(page)
|
55
|
+
rtn = template.render(page)
|
56
|
+
unless rtn.empty?
|
57
|
+
rtn
|
58
|
+
else
|
59
|
+
missing_page(page)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def missing_page(page)
|
64
|
+
halt(404, "404, No page found for #{page}")
|
65
|
+
end
|
66
|
+
|
67
|
+
def existing_variables(file_path)
|
68
|
+
puts template.extract_variables(File.open(file_path, "rb").read).inspect
|
69
|
+
end
|
70
|
+
|
71
|
+
def remote(params)
|
72
|
+
puts "params: #{params.inspect}"
|
73
|
+
json_path = File.join('config', 'json_responses', "#{params[:w]}.json")
|
74
|
+
if File.exists?(json_path)
|
75
|
+
template.load_file(json_path)
|
76
|
+
else
|
77
|
+
missing_page('remote.php: '+params.inspect)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
helpers do
|
82
|
+
def json_template(template_name)
|
83
|
+
template.process_file(template.get_snippet(template_name).inspect).gsub(/^"|"$/, '')
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
post '/remote.php' do
|
88
|
+
#@template = self.template
|
89
|
+
erb remote(params)
|
90
|
+
end
|
91
|
+
|
92
|
+
get '/cms/:name' do
|
93
|
+
template.cms(params[:name])
|
94
|
+
end
|
95
|
+
|
96
|
+
get '/' do
|
97
|
+
template_results('default.html')
|
98
|
+
end
|
99
|
+
|
100
|
+
get '/:name' do
|
101
|
+
template_results(params[:name].gsub(/\.php$/, '.html'))
|
102
|
+
end
|
103
|
+
|
104
|
+
get '/Emails/:name' do
|
105
|
+
template_results("Emails/#{params[:name]}")
|
106
|
+
end
|
107
|
+
|
108
|
+
get %r{/(js|Styles|fonts|images)/(.+)} do
|
109
|
+
content_type mime_type_by_file(params[:captures].last)
|
110
|
+
template_results("#{params[:captures].first}/#{params[:captures].last}")
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module BigcommerceTool
|
2
|
+
class CLI < Thor
|
3
|
+
|
4
|
+
desc "serve", "Serve local Bigcommerce templates"
|
5
|
+
long_desc File.read(File.expand_path('../long_descriptions/serve.txt', __FILE__))
|
6
|
+
option :template_folder
|
7
|
+
option :override_templates_folder
|
8
|
+
option :global_variables
|
9
|
+
option :global_files
|
10
|
+
option :language_variables
|
11
|
+
option :page_variables
|
12
|
+
option :discount_variables
|
13
|
+
def serve
|
14
|
+
options.each { |key, value| BigcommerceTool::App.set key.to_sym, value }
|
15
|
+
Rack::Server.start(app: Rack::ShowExceptions.new(Rack::Lint.new(BigcommerceTool::App.new)), Port: 9292)
|
16
|
+
end
|
17
|
+
|
18
|
+
desc "init", "Initialize default configuration settings"
|
19
|
+
def init
|
20
|
+
puts "dump sane configs"
|
21
|
+
end
|
22
|
+
|
23
|
+
desc "deploy", "Deploy changed templates to Bigcommerce using WebDAV"
|
24
|
+
option :branch
|
25
|
+
option :config_path
|
26
|
+
def deploy
|
27
|
+
BigcommerceTool::Deployer.new(options).deploy
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
module BigcommerceTool
|
2
|
+
class Deployer
|
3
|
+
def initialize(options)
|
4
|
+
raise 'Missing config file' unless File.exists?('bigcommerce.yml')
|
5
|
+
@branch = options[:branch] || ENV['CIRCLE_BRANCH']
|
6
|
+
@config = YAML.load_file(options[:config_path] || 'bigcommerce.yml')
|
7
|
+
end
|
8
|
+
|
9
|
+
def deploy
|
10
|
+
Net::DAV.start(URI("https://#{url}/dav/")) do |dav|
|
11
|
+
dav.credentials(ENV['USERNAME'], password)
|
12
|
+
puts "push to: #{url}"
|
13
|
+
changed_files.each do |file|
|
14
|
+
begin
|
15
|
+
if File.exists?(file)
|
16
|
+
if file.include?(' ')
|
17
|
+
puts "skipping: #{file}, file has a space in the name."
|
18
|
+
next
|
19
|
+
else
|
20
|
+
create_path_if_missing(dav, file)
|
21
|
+
dav.put_string(file, File.open(file, 'r').read)
|
22
|
+
puts "add/update #{file}"
|
23
|
+
end
|
24
|
+
else
|
25
|
+
dav.delete(file) if dav.exists?(file)
|
26
|
+
puts "remove: #{file}"
|
27
|
+
end
|
28
|
+
rescue Exception => e
|
29
|
+
puts "file: #{file}"
|
30
|
+
puts e.message
|
31
|
+
puts e.backtrace
|
32
|
+
raise e
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def environments_mapping
|
41
|
+
@config['deploy']['environments_mapping']
|
42
|
+
end
|
43
|
+
|
44
|
+
def env_name
|
45
|
+
environments_mapping[@branch].or_if_nil? do
|
46
|
+
raise "Should not be deploying for: #{@branch}"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def url
|
51
|
+
ENV["#{env_name}_URL"]
|
52
|
+
end
|
53
|
+
|
54
|
+
def password
|
55
|
+
ENV["#{env_name}_PASSWORD"]
|
56
|
+
end
|
57
|
+
|
58
|
+
def create_directory(conn, path, arr)
|
59
|
+
@current_folders ||= {}
|
60
|
+
create_path = (path.empty?) ? arr.shift : "#{path}/#{arr.shift}"
|
61
|
+
unless @current_folders.has_key?(create_path)
|
62
|
+
conn.mkdir(create_path) unless conn.exists?(create_path)
|
63
|
+
@current_folders[create_path] = 1
|
64
|
+
end
|
65
|
+
create_directory(conn, create_path, arr) if arr.length > 0
|
66
|
+
end
|
67
|
+
|
68
|
+
def create_path_if_missing(conn, file)
|
69
|
+
create_directory(conn, '', File.dirname(file).split(/\//))
|
70
|
+
end
|
71
|
+
|
72
|
+
def changed_files
|
73
|
+
all_files = Dir.glob('template/**/*.*')
|
74
|
+
return all_files if !ENV['CIRCLE_COMPARE_URL'] || ENV['CIRCLE_COMPARE_URL'].empty?
|
75
|
+
puts ENV['CIRCLE_COMPARE_URL']
|
76
|
+
|
77
|
+
range = ENV['CIRCLE_COMPARE_URL'].split('/').last
|
78
|
+
|
79
|
+
`git diff --name-only #{range}`.split("\n").reject{|file| file !~ /^template\//}
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class GenericLookup
|
2
|
+
def initialize(yaml_path)
|
3
|
+
@translations = YAML::load(File.open(File.join(Dir.pwd, yaml_path)))
|
4
|
+
end
|
5
|
+
|
6
|
+
def merge_additional_options(hsh)
|
7
|
+
@translations.merge!(hsh)
|
8
|
+
end
|
9
|
+
|
10
|
+
def render_in_div(key)
|
11
|
+
"<div style='border:1px solid red'>#{code}#{key}: [-- %%#{code}#{key}%% --]</div>"
|
12
|
+
end
|
13
|
+
|
14
|
+
def lookup(key)
|
15
|
+
if @translations.has_key?(key)
|
16
|
+
@translations[key]
|
17
|
+
else
|
18
|
+
puts render_in_div(key)
|
19
|
+
#puts " --- missing (#{self.class} lookup): #{key}" #unless @translations.has_key?(key)
|
20
|
+
#puts "#{code}#{key}: '%%#{code}#{key}%%'"
|
21
|
+
"#{self.code}#{key}"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module BigcommerceTool
|
2
|
+
class Global < GenericLookup
|
3
|
+
|
4
|
+
def initialize(config_path, file_load_path)
|
5
|
+
@file_load_path = file_load_path
|
6
|
+
super(config_path)
|
7
|
+
end
|
8
|
+
|
9
|
+
def lookup(key)
|
10
|
+
unless @translations[key].to_s.match(/From File/)
|
11
|
+
super(key)
|
12
|
+
else
|
13
|
+
load_from_file(key)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def code
|
18
|
+
"GLOBAL_"
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def load_from_file(key)
|
24
|
+
File.open(File.join(Dir.pwd, @file_load_path, "#{key}.html") , "rb").read
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
`bct serve` will serve the local Bigcommerce template files.
|
2
|
+
|
3
|
+
It assumes sane default locations for the following directories:
|
4
|
+
|
5
|
+
- template_folder
|
6
|
+
- overide_templates_folder
|
7
|
+
- global_variables
|
8
|
+
- global_files
|
9
|
+
- language_variables
|
10
|
+
- page_variables
|
11
|
+
- discount_variables
|
12
|
+
|
13
|
+
You can optionally specifcy locations for any of the previous directories.
|
14
|
+
|
15
|
+
> $ bct serve --template-folder "../bigcommerce_templates"
|
@@ -0,0 +1,97 @@
|
|
1
|
+
module BigcommerceTool
|
2
|
+
class Template
|
3
|
+
attr_accessor :global, :language, :page, :discount
|
4
|
+
|
5
|
+
def initialize(template_path, missing_template_path, global_yaml_path, global_files_path, language_yaml_path, page_yaml_path, discount_yaml_path)
|
6
|
+
self.global = Global.new(global_yaml_path, global_files_path)
|
7
|
+
self.language = Language.new(language_yaml_path)
|
8
|
+
self.page = Page.new(page_yaml_path)
|
9
|
+
self.discount = Discount.new(discount_yaml_path)
|
10
|
+
@template_path = template_path
|
11
|
+
@missing_template_path = missing_template_path
|
12
|
+
end
|
13
|
+
|
14
|
+
def label_element(str, name)
|
15
|
+
"<!-- start #{name} -->\n#{str}\n<!-- end #{name} -->"
|
16
|
+
str
|
17
|
+
end
|
18
|
+
|
19
|
+
def load_current_or_backup(name, type)
|
20
|
+
path = File.join(@template_path, type, name)
|
21
|
+
config_path = File.join(@missing_template_path, type, name)
|
22
|
+
if File.exists?(path)
|
23
|
+
load_file(path)
|
24
|
+
elsif File.exists?(config_path)
|
25
|
+
load_file(config_path)
|
26
|
+
else
|
27
|
+
puts " --- missing (#{config_path}): #{name} - #{type}"
|
28
|
+
label_element('', "(#{type} - #{name})")
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def get_panel(panel_name)
|
33
|
+
return '' if ['ProductVideos.html'].include?(panel_name)
|
34
|
+
load_current_or_backup(panel_name, 'Panels')
|
35
|
+
end
|
36
|
+
|
37
|
+
def get_snippet(snippet_name)
|
38
|
+
return '' if ['ProductAddToCartBelow.html'].include?(snippet_name)
|
39
|
+
load_current_or_backup(snippet_name, 'Snippets')
|
40
|
+
end
|
41
|
+
|
42
|
+
def process_file(string)
|
43
|
+
extract_variables(string).each do |variable|
|
44
|
+
rendered = if variable.match(/Panel\.(.+)/)
|
45
|
+
get_panel("#{$1}.html")
|
46
|
+
elsif variable.match(/SNIPPET_(.+)/)
|
47
|
+
get_snippet("#{$1}.html")
|
48
|
+
elsif variable.match(/ASSET_(.+)/)
|
49
|
+
"/#{$1}"
|
50
|
+
elsif variable.match(/GLOBAL_([\w_]+)/)
|
51
|
+
self.global.lookup($1)
|
52
|
+
elsif variable.match(/LNG_([\w_]+)/)
|
53
|
+
self.language.lookup($1)
|
54
|
+
elsif variable.match(/Discount\.(.+)/)
|
55
|
+
self.discount.lookup($1)
|
56
|
+
elsif variable.match(/Page\.(.+)/)
|
57
|
+
self.page.lookup($1)
|
58
|
+
else
|
59
|
+
puts " --- missing: #{variable}"
|
60
|
+
''
|
61
|
+
end
|
62
|
+
string.gsub!("%%#{variable}%%", rendered.to_s)
|
63
|
+
end
|
64
|
+
string
|
65
|
+
end
|
66
|
+
|
67
|
+
def extract_variables(string)
|
68
|
+
string.scan(/%%([A-Za-z0-9\.\-_\/]+)%%/).flatten
|
69
|
+
end
|
70
|
+
|
71
|
+
def load_file(file_path)
|
72
|
+
if File.exists?(file_path)
|
73
|
+
process_file(File.open(file_path, "rb").read)
|
74
|
+
else
|
75
|
+
puts "missing file: #{file_path}"
|
76
|
+
''
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def cms(page_name)
|
81
|
+
template = YAML::load(File.open(File.join(Dir.pwd, 'config', 'cms.yml')))[page_name]
|
82
|
+
if template && template['template']
|
83
|
+
self.global.merge_additional_options(
|
84
|
+
'PageTitle' => template['title'],
|
85
|
+
'PageContent' => load_file(File.join(Dir.pwd, 'config', 'cms', "#{page_name}.html"))
|
86
|
+
)
|
87
|
+
render(template['template'])
|
88
|
+
else
|
89
|
+
"missing: #{template.inspect}"
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
def render(file_path)
|
94
|
+
load_file(File.join(@template_path, file_path))
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'erb'
|
3
|
+
require 'thor'
|
4
|
+
require 'rack'
|
5
|
+
require 'rack/showexceptions'
|
6
|
+
require 'dotenv'
|
7
|
+
require 'uri'
|
8
|
+
require 'curb'
|
9
|
+
require 'net/dav'
|
10
|
+
|
11
|
+
require 'utility'
|
12
|
+
|
13
|
+
require 'bigcommerce_tool/version'
|
14
|
+
require 'bigcommerce_tool/generic_lookup'
|
15
|
+
require 'bigcommerce_tool/language'
|
16
|
+
require 'bigcommerce_tool/global'
|
17
|
+
require 'bigcommerce_tool/discount'
|
18
|
+
require 'bigcommerce_tool/page'
|
19
|
+
require 'bigcommerce_tool/template'
|
20
|
+
require 'bigcommerce_tool/app'
|
21
|
+
require 'bigcommerce_tool/deployer'
|
22
|
+
require 'bigcommerce_tool/cli'
|
23
|
+
|
24
|
+
Dotenv.load
|
25
|
+
|
26
|
+
module BigcommerceTool
|
27
|
+
end
|
data/lib/utility.rb
ADDED
metadata
ADDED
@@ -0,0 +1,221 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bigcommerce_tool
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jason Vanderhoof
|
8
|
+
- Tyler Ewing
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2015-04-22 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '1.7'
|
21
|
+
type: :development
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '1.7'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: rake
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '10.0'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '10.0'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: pry-byebug
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '3.0'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '3.0'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: net_dav
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0.5'
|
63
|
+
type: :runtime
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0.5'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: curb
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0.8'
|
77
|
+
type: :runtime
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0.8'
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: dotenv
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - "~>"
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '2.0'
|
91
|
+
type: :runtime
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - "~>"
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '2.0'
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: sinatra
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - "~>"
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '1.4'
|
105
|
+
type: :runtime
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - "~>"
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '1.4'
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: thin
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - "~>"
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '1.6'
|
119
|
+
type: :runtime
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - "~>"
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '1.6'
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: json
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - "~>"
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '1.8'
|
133
|
+
type: :runtime
|
134
|
+
prerelease: false
|
135
|
+
version_requirements: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - "~>"
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '1.8'
|
140
|
+
- !ruby/object:Gem::Dependency
|
141
|
+
name: thor
|
142
|
+
requirement: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - "~>"
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: '0.19'
|
147
|
+
type: :runtime
|
148
|
+
prerelease: false
|
149
|
+
version_requirements: !ruby/object:Gem::Requirement
|
150
|
+
requirements:
|
151
|
+
- - "~>"
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '0.19'
|
154
|
+
- !ruby/object:Gem::Dependency
|
155
|
+
name: rack
|
156
|
+
requirement: !ruby/object:Gem::Requirement
|
157
|
+
requirements:
|
158
|
+
- - "~>"
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: '1.6'
|
161
|
+
type: :runtime
|
162
|
+
prerelease: false
|
163
|
+
version_requirements: !ruby/object:Gem::Requirement
|
164
|
+
requirements:
|
165
|
+
- - "~>"
|
166
|
+
- !ruby/object:Gem::Version
|
167
|
+
version: '1.6'
|
168
|
+
description: Useful tool for local development of Bigcommerce templates and deploying
|
169
|
+
templates
|
170
|
+
email:
|
171
|
+
- engineering@gazelle.com
|
172
|
+
executables:
|
173
|
+
- bigcommerce
|
174
|
+
extensions: []
|
175
|
+
extra_rdoc_files: []
|
176
|
+
files:
|
177
|
+
- ".gitignore"
|
178
|
+
- Gemfile
|
179
|
+
- LICENSE.txt
|
180
|
+
- README.md
|
181
|
+
- Rakefile
|
182
|
+
- bigcommerce_tool.gemspec
|
183
|
+
- bin/bigcommerce
|
184
|
+
- lib/bigcommerce_tool.rb
|
185
|
+
- lib/bigcommerce_tool/app.rb
|
186
|
+
- lib/bigcommerce_tool/cli.rb
|
187
|
+
- lib/bigcommerce_tool/deployer.rb
|
188
|
+
- lib/bigcommerce_tool/discount.rb
|
189
|
+
- lib/bigcommerce_tool/generic_lookup.rb
|
190
|
+
- lib/bigcommerce_tool/global.rb
|
191
|
+
- lib/bigcommerce_tool/language.rb
|
192
|
+
- lib/bigcommerce_tool/long_descriptions/serve.txt
|
193
|
+
- lib/bigcommerce_tool/page.rb
|
194
|
+
- lib/bigcommerce_tool/template.rb
|
195
|
+
- lib/bigcommerce_tool/version.rb
|
196
|
+
- lib/utility.rb
|
197
|
+
homepage: https://github.com/secondrotation/bigcommerce_tool
|
198
|
+
licenses:
|
199
|
+
- MIT
|
200
|
+
metadata: {}
|
201
|
+
post_install_message:
|
202
|
+
rdoc_options: []
|
203
|
+
require_paths:
|
204
|
+
- lib
|
205
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
206
|
+
requirements:
|
207
|
+
- - ">="
|
208
|
+
- !ruby/object:Gem::Version
|
209
|
+
version: '0'
|
210
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
211
|
+
requirements:
|
212
|
+
- - ">="
|
213
|
+
- !ruby/object:Gem::Version
|
214
|
+
version: '0'
|
215
|
+
requirements: []
|
216
|
+
rubyforge_project:
|
217
|
+
rubygems_version: 2.4.5
|
218
|
+
signing_key:
|
219
|
+
specification_version: 4
|
220
|
+
summary: Useful tool for local development of Bigcommerce templates
|
221
|
+
test_files: []
|