bootstrap_v3 0.0.1 → 0.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.
- checksums.yaml +4 -4
- data/bootstrap.thor +149 -0
- data/lib/bootstrap/v3/rails/version.rb +1 -1
- data/lib/generators/bootstrap/install/install_generator.rb +2 -2
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0d34fd647849f30435ef3d566dc90223e1a3f470
|
|
4
|
+
data.tar.gz: 82e63cb6c144e2ce69a064d67f55a70c34009c0b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 83d6d2f99effdd7b6586f7bc4934c4f5c3653acb5cc8c5269c6757bd3d6076f49df9404c74e829b4ffd83758aad1b061acd98524aa17434e5f03f5f6d5e07bbe
|
|
7
|
+
data.tar.gz: d4e2f0d015a0bba0fa306317c73021f5fc80e003abe1df5cb207fdf2da84464235f7df1dfe15a349e4f4da44575cba7b34f3eb7744a08e65904b9aa5b7b0e4eb
|
data/bootstrap.thor
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
require 'pry'
|
|
2
|
+
require 'fileutils'
|
|
3
|
+
require 'git'
|
|
4
|
+
require 'logger'
|
|
5
|
+
require 'json'
|
|
6
|
+
|
|
7
|
+
class Bootstrap < Thor
|
|
8
|
+
include Thor::Actions
|
|
9
|
+
|
|
10
|
+
REPO_URI = "https://github.com/twbs/bootstrap.git"
|
|
11
|
+
|
|
12
|
+
desc "update", "fetch Bootstrap code from git"
|
|
13
|
+
method_option :branch, default: "master"
|
|
14
|
+
|
|
15
|
+
def update
|
|
16
|
+
if File.directory? working_dir
|
|
17
|
+
say_status "MESSAGE", "WORKING DIR EXIST"
|
|
18
|
+
pull
|
|
19
|
+
else
|
|
20
|
+
say_status "MESSAGE", "THERE IS NO WORKING DIR"
|
|
21
|
+
prepare
|
|
22
|
+
clone
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
parse_version
|
|
26
|
+
copy_files
|
|
27
|
+
generate_templates
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
no_commands do
|
|
31
|
+
|
|
32
|
+
def clone
|
|
33
|
+
say_status "STEP", "CLONE REPO"
|
|
34
|
+
Dir.chdir working_dir
|
|
35
|
+
|
|
36
|
+
git = Git.clone(REPO_URI, 'bootstrap_v3')
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def pull
|
|
40
|
+
say_status "STEP", "PULL REPO"
|
|
41
|
+
git = Git.open(git_root, :log => Logger.new(STDOUT))
|
|
42
|
+
git.pull
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def parse_version
|
|
46
|
+
say_status "STEP", "PARSE VERSION"
|
|
47
|
+
Dir.chdir git_root
|
|
48
|
+
|
|
49
|
+
component = JSON.parse( IO.read('component.json'), :quirks_mode => true)
|
|
50
|
+
version = component["version"]
|
|
51
|
+
|
|
52
|
+
version_file = source_root + "lib/bootstrap/v3/rails/version.rb"
|
|
53
|
+
|
|
54
|
+
gsub_file version_file, /(?<=VERSION = \")(.+)(?=\")/, version
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def copy_files
|
|
58
|
+
say_status "STEP", "COPY FILES"
|
|
59
|
+
|
|
60
|
+
# STYLESHEETS
|
|
61
|
+
stylesheets_path = "vendor/assets/stylesheets/bootstrap_v3/"
|
|
62
|
+
run "rsync -avm --include='*.less' --include='*.css' -f 'hide,! */' #{git_root + 'src/'} #{source_root + stylesheets_path}"
|
|
63
|
+
|
|
64
|
+
# JAVASCRIPTS
|
|
65
|
+
javascripts_path = "vendor/assets/javascripts/bootstrap_v3/"
|
|
66
|
+
run "rsync -avm --include='*.js' -f 'hide,! */' #{git_root + 'src/'} #{source_root + javascripts_path}"
|
|
67
|
+
|
|
68
|
+
# FONTS
|
|
69
|
+
fonts_path = "vendor/assets/fonts/bootstrap_v3"
|
|
70
|
+
run "rsync -avm --include='*.*' -f 'hide,! */' #{git_root + 'src/fonts/'} #{source_root + fonts_path}"
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def generate_templates
|
|
74
|
+
# JAVASCRIPTS
|
|
75
|
+
say_status "STEP", "GENERATE JAVASCRIPT TEMPLATE"
|
|
76
|
+
js_template_path = source_root + "lib/generators/bootstrap/install/templates/bootstrap_v3.js"
|
|
77
|
+
|
|
78
|
+
javascripts_path = Pathname.new(source_root + "vendor/assets/javascripts/bootstrap_v3")
|
|
79
|
+
|
|
80
|
+
FileUtils.rm js_template_path
|
|
81
|
+
|
|
82
|
+
File.open(js_template_path, 'a') do |template|
|
|
83
|
+
Dir.glob(source_root + javascripts_path + "**/*") do |file|
|
|
84
|
+
next if File.directory? file
|
|
85
|
+
|
|
86
|
+
filepath = Pathname.new(file)
|
|
87
|
+
|
|
88
|
+
relative_path = filepath.relative_path_from(javascripts_path)
|
|
89
|
+
|
|
90
|
+
template.write "//= require bootstrap_v3/#{relative_path} \n"
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# STYLESHEETS
|
|
95
|
+
say_status "STEP", "GENERATE STYLESHEETS TEMPLATES"
|
|
96
|
+
css_template_path = source_root + "lib/generators/bootstrap/install/templates/bootstrap_v3/"
|
|
97
|
+
|
|
98
|
+
stylesheets_path = Pathname.new(source_root + "vendor/assets/stylesheets/bootstrap_v3")
|
|
99
|
+
|
|
100
|
+
FileUtils.rm_rf Dir.glob css_template_path + "*.*"
|
|
101
|
+
|
|
102
|
+
Dir.glob stylesheets_path + "**/*" do |file|
|
|
103
|
+
if File.directory? file
|
|
104
|
+
File.open(css_template_path + (Pathname.new(file).basename.to_s + ".less"), 'a') do |template|
|
|
105
|
+
Dir.glob(stylesheets_path + file + "**/*") do |file|
|
|
106
|
+
next if File.directory? file
|
|
107
|
+
|
|
108
|
+
filepath = Pathname.new(file)
|
|
109
|
+
|
|
110
|
+
relative_path = filepath.relative_path_from(stylesheets_path)
|
|
111
|
+
|
|
112
|
+
template.write "@import 'bootstrap_v3/#{relative_path}'; \n"
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
def clean
|
|
120
|
+
say_status "MESSAGE", "DELETE WORKING DIR"
|
|
121
|
+
FileUtils.rm_rf 'tmp/updater'
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def prepare
|
|
125
|
+
say_status "MESSAGE", "CREATE WORKING DIR"
|
|
126
|
+
FileUtils.mkdir_p 'tmp/updater'
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
# dirs
|
|
131
|
+
|
|
132
|
+
def self.source_root
|
|
133
|
+
File.dirname(__FILE__)
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
def git_root
|
|
137
|
+
working_dir + 'bootstrap_v3'
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
def working_dir
|
|
141
|
+
source_root + 'tmp/updater'
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
def source_root
|
|
145
|
+
Pathname.new File.dirname(__FILE__)
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
end
|
|
149
|
+
end
|
|
@@ -8,7 +8,7 @@ module Bootstrap
|
|
|
8
8
|
|
|
9
9
|
def add_assets
|
|
10
10
|
# copy js manifest
|
|
11
|
-
js_manifest = 'app/assets/javascripts/
|
|
11
|
+
js_manifest = 'app/assets/javascripts/bootstrap_v3.js'
|
|
12
12
|
|
|
13
13
|
if File.exist?(js_manifest)
|
|
14
14
|
puts <<-EOM
|
|
@@ -16,7 +16,7 @@ module Bootstrap
|
|
|
16
16
|
#{js_manifest} exist; skipping
|
|
17
17
|
EOM
|
|
18
18
|
else
|
|
19
|
-
copy_file "bootstrap.js", "app/assets/javascripts/
|
|
19
|
+
copy_file "bootstrap.js", "app/assets/javascripts/bootstrap_v3.js"
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
# copy less manifests
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bootstrap_v3
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- AmirolAhmad
|
|
@@ -105,6 +105,7 @@ files:
|
|
|
105
105
|
- LICENSE
|
|
106
106
|
- README.md
|
|
107
107
|
- Rakefile
|
|
108
|
+
- bootstrap.thor
|
|
108
109
|
- bootstrap_v3.gemspec
|
|
109
110
|
- lib/bootstrap/v3/rails.rb
|
|
110
111
|
- lib/bootstrap/v3/rails/engine.rb
|