locomotivecms_wagon 2.0.0.pre.alpha → 2.0.0.pre.alpha.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 739043b4c31b8face271da2d37048fcc126cc8ca
4
- data.tar.gz: 5d10493f0944c8d441532881ff2347ff680e7d0a
3
+ metadata.gz: 8531aa80c7fdee5e9e863387e699827b4ae7ae18
4
+ data.tar.gz: 6f6efe6257adde660654dc4b931a624a1d094520
5
5
  SHA512:
6
- metadata.gz: 124f103b49617bc7f6185945dbe753259bc19ce350d6e9ba5a5bd44436508e4258a2f54739163d2821952d58df623b705f4c3aba1bcaf294ca97245106ab738c
7
- data.tar.gz: 96f069b17d7d062dd831cc5580a525b53a24e2be3ae40c345989ddd20398a5e04335159a9d90b9fa17916b8bf261557001373f1b1d47488adefb206fc8ce718f
6
+ metadata.gz: 58bbaf91c7ee0dfeb1271e6424e247e1a77100325248756ceeb921e3d1f3a3d3503ae8477cf89e6426d5c47f44fbb098d55c1791760628aa833e7f07e2c9868a
7
+ data.tar.gz: 4da3d8c28daf5ecc343f66240b5e15f99bc455d3faa4a746a73d70b899733de98de14adec8331979d3961b4cd56f669a7390e19cd2c3e64b9c3c6f0724014119
@@ -70,22 +70,7 @@ module Locomotive
70
70
  #
71
71
  def self.push(env, path, options = {})
72
72
  require_relative 'wagon/commands/push_command'
73
- Locomotive::Wagon::PushCommand.generate(env, path, options)
74
-
75
- # if reader = self.require_mounter(path, true)
76
-
77
- # reader.mounting_point.site.domains = connection_info['domains'] if connection_info['domains']
78
- # reader.mounting_point.site.subdomain = connection_info['subdomain'] if connection_info['subdomain']
79
-
80
- # writer = Locomotive::Mounter::Writer::Api.instance
81
- # resources = self.validate_resources(options[:resources], writer.writers)
82
-
83
- # connection_info[:uri] = "#{connection_info.delete(:host)}/locomotive/api"
84
-
85
- # _options = { mounting_point: reader.mounting_point, only: resources, console: true }.merge(options).symbolize_keys
86
-
87
- # writer.run!(_options.merge(connection_info).with_indifferent_access)
88
- # end
73
+ Locomotive::Wagon::PushCommand.push(env, path, options)
89
74
  end
90
75
 
91
76
  # Pull a site from a remote LocomotiveCMS engine described
@@ -96,19 +81,20 @@ module Locomotive
96
81
  # @param [ Hash ] options The options passed to the pull process
97
82
  #
98
83
  def self.pull(path, connection_info, options = {})
99
- self.require_mounter(path, false, options[:disable_misc])
84
+ raise 'TODO'
85
+ # self.require_mounter(path, false, options[:disable_misc])
100
86
 
101
- connection_info[:uri] = "#{connection_info.delete(:host)}/locomotive/api"
87
+ # connection_info[:uri] = "#{connection_info.delete(:host)}/locomotive/api"
102
88
 
103
- _options = { console: true }.merge(options).symbolize_keys
104
- _options[:only] = _options.delete(:resources)
89
+ # _options = { console: true }.merge(options).symbolize_keys
90
+ # _options[:only] = _options.delete(:resources)
105
91
 
106
- reader = Locomotive::Mounter::Reader::Api.instance
107
- self.validate_resources(_options[:only], reader.readers)
108
- reader.run!(_options.merge(connection_info))
92
+ # reader = Locomotive::Mounter::Reader::Api.instance
93
+ # self.validate_resources(_options[:only], reader.readers)
94
+ # reader.run!(_options.merge(connection_info))
109
95
 
110
- writer = Locomotive::Mounter::Writer::FileSystem.instance
111
- writer.run!(_options.merge(mounting_point: reader.mounting_point, target_path: path))
96
+ # writer = Locomotive::Mounter::Writer::FileSystem.instance
97
+ # writer.run!(_options.merge(mounting_point: reader.mounting_point, target_path: path))
112
98
  end
113
99
 
114
100
  # Clone a site from a remote LocomotiveCMS engine.
@@ -119,20 +105,21 @@ module Locomotive
119
105
  # @param [ Hash ] options The options for the API reader
120
106
  #
121
107
  def self.clone(name, path, connection_info, options = {})
122
- target_path = File.expand_path(File.join(path, name))
108
+ raise 'TODO'
109
+ # target_path = File.expand_path(File.join(path, name))
123
110
 
124
- if File.exists?(target_path)
125
- puts "Path already exists. If it's an existing site, you might want to pull instead of clone."
126
- return false
127
- end
111
+ # if File.exists?(target_path)
112
+ # puts "Path already exists. If it's an existing site, you might want to pull instead of clone."
113
+ # return false
114
+ # end
128
115
 
129
- # generate an almost blank site
130
- require 'locomotive/wagon/generators/site'
131
- generator = Locomotive::Wagon::Generators::Site::Cloned
132
- generator.start [name, path, true, connection_info.symbolize_keys]
116
+ # # generate an almost blank site
117
+ # require 'locomotive/wagon/generators/site'
118
+ # generator = Locomotive::Wagon::Generators::Site::Cloned
119
+ # generator.start [name, path, true, connection_info.symbolize_keys]
133
120
 
134
- # pull the remote site
135
- self.pull(target_path, options.merge(connection_info).with_indifferent_access, { disable_misc: true })
121
+ # # pull the remote site
122
+ # self.pull(target_path, options.merge(connection_info).with_indifferent_access, { disable_misc: true })
136
123
  end
137
124
 
138
125
  # Destroy a remote site
@@ -142,30 +129,31 @@ module Locomotive
142
129
  # @param [ Hash ] options The options passed to the push process
143
130
  #
144
131
  def self.destroy(path, connection_info, options = {})
145
- self.require_mounter(path)
132
+ raise 'TODO'
133
+ # self.require_mounter(path)
146
134
 
147
- connection_info['uri'] = "#{connection_info.delete('host')}/locomotive/api"
135
+ # connection_info['uri'] = "#{connection_info.delete('host')}/locomotive/api"
148
136
 
149
- Locomotive::Mounter::EngineApi.set_token connection_info.symbolize_keys
150
- Locomotive::Mounter::EngineApi.delete('/current_site.json')
137
+ # Locomotive::Mounter::EngineApi.set_token connection_info.symbolize_keys
138
+ # Locomotive::Mounter::EngineApi.delete('/current_site.json')
151
139
  end
152
140
 
153
- protected
141
+ # protected
154
142
 
155
- def self.validate_resources(resources, writers_or_readers)
156
- return if resources.nil?
143
+ # def self.validate_resources(resources, writers_or_readers)
144
+ # return if resources.nil?
157
145
 
158
- # FIXME: for an unknown reason, when called from Cocoa, the resources are a string
159
- resources = resources.map { |resource| resource.split(' ') }.flatten
146
+ # # FIXME: for an unknown reason, when called from Cocoa, the resources are a string
147
+ # resources = resources.map { |resource| resource.split(' ') }.flatten
160
148
 
161
- valid_resources = writers_or_readers.map { |thing| thing.to_s.demodulize.gsub(/Writer$|Reader$/, '').underscore }
149
+ # valid_resources = writers_or_readers.map { |thing| thing.to_s.demodulize.gsub(/Writer$|Reader$/, '').underscore }
162
150
 
163
- resources.each do |resource|
164
- raise ArgumentError, "'#{resource}' resource not recognized. Valid resources are #{valid_resources.join(', ')}." unless valid_resources.include?(resource)
165
- end
151
+ # resources.each do |resource|
152
+ # raise ArgumentError, "'#{resource}' resource not recognized. Valid resources are #{valid_resources.join(', ')}." unless valid_resources.include?(resource)
153
+ # end
166
154
 
167
- resources
168
- end
155
+ # resources
156
+ # end
169
157
 
170
158
  end
171
159
  end
@@ -2,10 +2,12 @@ require 'locomotive/steam'
2
2
 
3
3
  require_relative 'loggers/push_logger'
4
4
 
5
- require_relative_all 'concerns'
6
- require_relative_all '../decorators/concerns'
7
- require_relative_all '../decorators'
8
- require_relative_all 'push_sub_commands'
5
+ require_relative_all 'concerns'
6
+ require_relative_all '../decorators/concerns'
7
+ require_relative_all '../decorators'
8
+
9
+ require_relative 'push_sub_commands/push_base_command'
10
+ require_relative_all 'push_sub_commands'
9
11
 
10
12
  module Locomotive::Wagon
11
13
 
@@ -57,7 +57,7 @@ module Locomotive::Wagon
57
57
  end
58
58
 
59
59
  def path
60
- repositories.adapter.options[:path]
60
+ File.expand_path(repositories.adapter.options[:path])
61
61
  end
62
62
 
63
63
  class SkipPersistingException < Exception
@@ -1,4 +1,5 @@
1
1
  require 'tempfile'
2
+ require 'pry'
2
3
 
3
4
  module Locomotive::Wagon
4
5
 
@@ -36,9 +37,7 @@ module Locomotive::Wagon
36
37
  return unless entity.stylesheet_or_javascript?
37
38
 
38
39
  Tempfile.new(entity.realname).tap do |file|
39
- env = Locomotive::Steam::SprocketsEnvironment.new(File.join(path, 'public'), minify: true)
40
-
41
- file.write(env[entity.short_relative_url].to_s)
40
+ file.write(sprockets_env[entity.short_relative_url].to_s)
42
41
 
43
42
  entity.filepath = file.path
44
43
 
@@ -65,6 +64,10 @@ module Locomotive::Wagon
65
64
  end
66
65
  end
67
66
 
67
+ def sprockets_env
68
+ @sprockets_env ||= Locomotive::Steam::SprocketsEnvironment.new(File.join(path, 'public'), minify: true)
69
+ end
70
+
68
71
  end
69
72
 
70
73
  end
@@ -36,7 +36,11 @@ module Locomotive
36
36
  def realname
37
37
  # - memoize it because it will not change even if we change the filepath (or source)
38
38
  # - we keep the first extension and drop the others (.coffee, .scss, ...etc)
39
- @realname ||= File.basename(filepath).split('.')[0..1].join('.')
39
+ @realname ||= if Sprockets.engine_extensions.include?(File.extname(filepath))
40
+ File.basename(filepath).split('.')[0..1].join('.')
41
+ else
42
+ File.basename(filepath)
43
+ end
40
44
  end
41
45
 
42
46
  def filepath
@@ -1,5 +1,5 @@
1
1
  module Locomotive
2
2
  module Wagon
3
- VERSION = '2.0.0-alpha'
3
+ VERSION = '2.0.0-alpha.1'
4
4
  end
5
5
  end
@@ -25,7 +25,7 @@ Gem::Specification.new do |gem|
25
25
  gem.add_dependency 'rubyzip', '~> 1.1.7'
26
26
  gem.add_dependency 'netrc', '~> 0.10.3'
27
27
 
28
- gem.add_dependency 'locomotivecms_coal', '~> 1.0.0-alpha.2'
28
+ gem.add_dependency 'locomotivecms_coal', '~> 1.0.0-alpha.3'
29
29
  gem.add_dependency 'locomotivecms_steam', '~> 1.0.0-alpha.1'
30
30
 
31
31
  gem.add_dependency 'listen', '~> 2.10.0'
@@ -14,29 +14,4 @@ describe Locomotive::Wagon::CLI do
14
14
 
15
15
  end
16
16
 
17
- # describe '#auth' do
18
-
19
- # subject { }
20
- # expect(capture(:stdout) { A.new.invoke(:two) }).to eq("2\n3\n") }
21
-
22
- # it ''
23
- # let(:output) { }
24
-
25
- # end
26
-
27
17
  end
28
-
29
- # describe Locomotive::Wagon::CLI do
30
- # it "overrides subdomains and domains in different environments" do
31
- # clone_site
32
- # deploy = YAML.load_file('site/config/deploy.yml')
33
- # deploy["staging"] = deploy["production"].merge("domains" => ["staging.example.com"], "subdomain" => "staging", "host" => "staging.example.com:3000")
34
- # File.write('site/config/deploy.yml', deploy.to_yaml)
35
- # VCR.use_cassette("staging") do
36
- # Locomotive::Wagon::CLI::Main.start(['push', 'staging', 'site', '-f'])
37
- # end
38
-
39
- # WebMock.should_not have_requested(:put, /sites\/.+.json\?auth_token=.+/).with(body: /site\[subdomain\]=sample/)
40
- # WebMock.should have_requested(:put, /sites\/.+.json\?auth_token=.+/).with(body: /site\[subdomain\]=staging&site\[domains\]\[\]=staging.example.com/).once
41
- # end
42
- # end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: locomotivecms_wagon
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.pre.alpha
4
+ version: 2.0.0.pre.alpha.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Didier Lafforgue
@@ -87,14 +87,14 @@ dependencies:
87
87
  requirements:
88
88
  - - "~>"
89
89
  - !ruby/object:Gem::Version
90
- version: 1.0.0.pre.alpha.2
90
+ version: 1.0.0.pre.alpha.3
91
91
  type: :runtime
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - "~>"
96
96
  - !ruby/object:Gem::Version
97
- version: 1.0.0.pre.alpha.2
97
+ version: 1.0.0.pre.alpha.3
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: locomotivecms_steam
100
100
  requirement: !ruby/object:Gem::Requirement
@@ -631,7 +631,6 @@ files:
631
631
  - spec/integration/generators/page_spec.rb
632
632
  - spec/integration/generators/relationship_spec.rb
633
633
  - spec/integration/integration_helper.rb
634
- - spec/integration/sites_spec.rb
635
634
  - spec/spec_helper.rb
636
635
  - spec/support/api_settings.rb
637
636
  - spec/support/helpers.rb
@@ -755,7 +754,6 @@ test_files:
755
754
  - spec/integration/generators/page_spec.rb
756
755
  - spec/integration/generators/relationship_spec.rb
757
756
  - spec/integration/integration_helper.rb
758
- - spec/integration/sites_spec.rb
759
757
  - spec/spec_helper.rb
760
758
  - spec/support/api_settings.rb
761
759
  - spec/support/helpers.rb
@@ -1,54 +0,0 @@
1
- # # encoding: utf-8
2
-
3
- # require File.dirname(__FILE__) + '/integration_helper'
4
-
5
- # describe Locomotive::Wagon do
6
- # it 'imports' do
7
- # File.exists?('site/config/site.yml').should be_false
8
- # clone_site
9
- # YAML.load_file('site/config/site.yml').should == {
10
- # 'name' => 'locomotive',
11
- # 'locales' => ['en', 'es'],
12
- # 'subdomain' => 'sample',
13
- # 'domains' => ['sample.example.com'],
14
- # 'timezone' => 'UTC'
15
- # }
16
- # end
17
-
18
- # it "pulls the expected data" do
19
- # clone_site
20
- # es = YAML.load_file('site/app/views/pages/products.es.liquid')
21
- # es["seo_title"].should == "Productos SEO"
22
- # es["meta_description"].should == "Descripción molona de los productos"
23
- # es["meta_keywords"].should == "palabras, clave, productos"
24
- # en = YAML.load_file('site/app/views/pages/products.liquid')
25
- # en["seo_title"].should == "Search friendly products"
26
- # en["meta_description"].should == "Fancy products description"
27
- # en["meta_keywords"].should == "fancy, products, keywords"
28
- # end
29
-
30
- # it 'pushes' do
31
- # clone_site
32
- # file_name = File.dirname(__FILE__) + '/../../site/app/views/pages/index.liquid'
33
- # text = File.read(file_name)
34
- # text.gsub!(/Content of the home page/, 'New content of the home page')
35
- # File.open(file_name, 'w') { |file| file.puts text}
36
- # VCR.use_cassette('push') do
37
- # Locomotive::Wagon.push('site', { host: 'sample.example.com:3000', email: 'admin@locomotivecms.com', password: 'locomotive' })
38
- # end
39
- # WebMock.should have_requested(:put, /pages\/.+.json\?auth_token=.+/).with(body: /page\[raw_template\]=New%20content%20of%20the%20home%20page/).once
40
- # end
41
-
42
- # describe "push with unrecognized resources" do
43
- # subject do
44
- # lambda do
45
- # clone_site
46
- # VCR.use_cassette('push') do
47
- # Locomotive::Wagon.push('site', { host: 'sample.example.com:3000', email: 'admin@locomotivecms.com', password: 'locomotive' }, {resources: ['all']})
48
- # end
49
- # end
50
- # end
51
-
52
- # it { should raise_exception(ArgumentError, /'all' resource not recognized/) }
53
- # end
54
- # end